Skip to content

Commit 3e11561

Browse files
committed
link #936 Add vibration feedback control setting
- Implement `AppVibrationState` provider to manage and persist vibration preference. - Add a switch in `HomeDrawer` to toggle vibration. - Update `CupertinoSliverRefreshControl` to check the vibration setting before triggering haptic feedback. - Initialize vibration state in `UserRepository` from local storage. - Add localization strings for the vibration setting. - Apply code formatting and style improvements across modified files.
1 parent 45f337b commit 3e11561

File tree

15 files changed

+427
-254
lines changed

15 files changed

+427
-254
lines changed

lib/common/config/config.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
class Config {
2-
32
// Private constructor to prevent instantiation
43
Config._();
54

65
static bool? DEBUG = true;
76

8-
9-
107
static const PAGE_SIZE = 20;
118

129
/// //////////////////////////////////////常量////////////////////////////////////// ///
@@ -21,4 +18,5 @@ class Config {
2118
static const REFRESH_LANGUAGE = "refreshLanguageApp";
2219
static const THEME_COLOR = "theme-color";
2320
static const LOCALE = "locale";
21+
static const VIBRATION_ENABLE = "vibration-enable";
2422
}

lib/common/localization/l10n/app_en.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"login_deprecated": "The API via password authentication will remove on November 13, 2020 by Github",
2525
"home_reply": "Feedback",
2626
"home_change_language": "Language",
27+
"home_vibration": "Vibration",
2728
"home_change_grey": "Grey",
2829
"home_about": "About",
2930
"home_check_update": "Check Update",
@@ -135,4 +136,4 @@
135136
"search_sort": "Sort",
136137
"search_language": "Language",
137138
"feed_back_tip": "Your feedback will be sent to Github as a public issue"
138-
}
139+
}

lib/common/localization/l10n/app_ja.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"login_deprecated": "パスワード認証APIは2020年11月13日にGithubによって削除されます",
2525
"home_reply": "フィードバック",
2626
"home_change_language": "言語",
27+
"home_vibration": "振動フィードバック",
2728
"home_change_grey": "グレースケール",
2829
"home_about": "について",
2930
"home_check_update": "更新確認",
@@ -135,4 +136,4 @@
135136
"search_sort": "並び替え",
136137
"search_language": "言語",
137138
"feed_back_tip": "あなたのフィードバックは公開IssueとしてGitHubに送信されます"
138-
}
139+
}

lib/common/localization/l10n/app_ko.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"login_deprecated": "비밀번호 인증 API는 2020년 11월 13일에 Github에서 제거됩니다",
2525
"home_reply": "피드백",
2626
"home_change_language": "언어",
27+
"home_vibration": "진동 피드백",
2728
"home_change_grey": "그레이스케일",
2829
"home_about": "정보",
2930
"home_check_update": "업데이트 확인",
@@ -135,4 +136,4 @@
135136
"search_sort": "정렬",
136137
"search_language": "언어",
137138
"feed_back_tip": "귀하의 피드백은 Github에 공개 이슈로 제출됩니다"
138-
}
139+
}

lib/common/localization/l10n/app_localizations.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ abstract class AppLocalizations {
252252
/// **'Language'**
253253
String get home_change_language;
254254

255+
/// No description provided for @home_vibration.
256+
///
257+
/// In en, this message translates to:
258+
/// **'Vibration'**
259+
String get home_vibration;
260+
255261
/// No description provided for @home_change_grey.
256262
///
257263
/// In en, this message translates to:

lib/common/localization/l10n/app_localizations_en.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ class AppLocalizationsEn extends AppLocalizations {
8484
@override
8585
String get home_change_language => 'Language';
8686

87+
@override
88+
String get home_vibration => 'Vibration';
89+
8790
@override
8891
String get home_change_grey => 'Grey';
8992

lib/common/localization/l10n/app_localizations_ja.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ class AppLocalizationsJa extends AppLocalizations {
8383
@override
8484
String get home_change_language => '言語';
8585

86+
@override
87+
String get home_vibration => '振動フィードバック';
88+
8689
@override
8790
String get home_change_grey => 'グレースケール';
8891

lib/common/localization/l10n/app_localizations_ko.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ class AppLocalizationsKo extends AppLocalizations {
8383
@override
8484
String get home_change_language => '언어';
8585

86+
@override
87+
String get home_vibration => '진동 피드백';
88+
8689
@override
8790
String get home_change_grey => '그레이스케일';
8891

lib/common/localization/l10n/app_localizations_zh.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ class AppLocalizationsZh extends AppLocalizations {
8383
@override
8484
String get home_change_language => '语言切换';
8585

86+
@override
87+
String get home_vibration => '震动反馈';
88+
8689
@override
8790
String get home_change_grey => '灰度模式';
8891

lib/common/localization/l10n/app_zh.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"login_deprecated": "密码登陆API将在2020年11月13日被Github移除",
2525
"home_reply": "问题反馈",
2626
"home_change_language": "语言切换",
27+
"home_vibration": "震动反馈",
2728
"home_change_grey": "灰度模式",
2829
"home_about": "关于",
2930
"home_check_update": "检测更新",
@@ -135,4 +136,4 @@
135136
"search_sort": "排序",
136137
"search_language": "语言",
137138
"feed_back_tip": "您的反馈会作为公共Issue提交到Github,您确定要继续吗?"
138-
}
139+
}

0 commit comments

Comments
 (0)