这是indexloc提供的服务,不要输入任何密码
Skip to content

feat: disable data saver when on Wi-Fi #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/i18n/aria/aria.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ deleteFilesConfirm:
one: "Are you sure you want to delete {n} file?"
other: "Are you sure you want to delete {n} files?"
deleteTabConfirm: "Are you sure you want to delete this tab?"
disableDataSaverWhenOnWifi: "Disable data saver when on Wi-Fi"
disableSubscribingNotes: "Disable real-time reaction updates"
discardChangesConfirm: "Are you sure you want to discard changes and back?"
doubleTapToShow: "Double tap to show"
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/aria/aria_ja-JP.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ crop: "クロップ"
custom: "カスタム"
deleteFilesConfirm: "{n}個のファイルを削除しますか?"
deleteTabConfirm: "このタブを削除しますか?"
disableDataSaverWhenOnWifi: "Wi-Fi接続中はデータセーバーを無効にする"
disableSubscribingNotes: "リアクションのリアルタイム更新を無効にする"
discardChangesConfirm: "変更せずに戻りますか?"
doubleTapToShow: "ダブルタップして表示"
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/aria/aria_ja-KS.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ crop: "クロップ"
custom: "カスタム"
deleteFilesConfirm: "ファイルが{n}個あるけどほかしてええか?"
deleteTabConfirm: "このタブほかしてええか?"
disableDataSaverWhenOnWifi: "Wi-Fi接続中はデータセーバーを止めとく"
disableSubscribingNotes: "ツッコミをいちいち更新せんようにする"
discardChangesConfirm: "変えんと戻ってええか?"
doubleTapToShow: "二度押ししたら見えるで"
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/strings.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// To regenerate, run: `dart run slang`
///
/// Locales: 31
/// Strings: 50698 (1635 per locale)
/// Strings: 50701 (1635 per locale)

// coverage:ignore-file
// ignore_for_file: type=lint
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/strings_en_US.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class _StringsAriaEnUs {
other: 'Are you sure you want to delete ${n} files?',
);
String get deleteTabConfirm => 'Are you sure you want to delete this tab?';
String get disableDataSaverWhenOnWifi => 'Disable data saver when on Wi-Fi';
String get disableSubscribingNotes => 'Disable real-time reaction updates';
String get discardChangesConfirm => 'Are you sure you want to discard changes and back?';
String get doubleTapToShow => 'Double tap to show';
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/strings_ja_JP.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class _StringsAriaJaJp extends _StringsAriaEnUs {
@override String get custom => 'カスタム';
@override String deleteFilesConfirm({required Object n}) => '${n}個のファイルを削除しますか?';
@override String get deleteTabConfirm => 'このタブを削除しますか?';
@override String get disableDataSaverWhenOnWifi => 'Wi-Fi接続中はデータセーバーを無効にする';
@override String get disableSubscribingNotes => 'リアクションのリアルタイム更新を無効にする';
@override String get discardChangesConfirm => '変更せずに戻りますか?';
@override String get doubleTapToShow => 'ダブルタップして表示';
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/strings_ja_KS.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class _StringsAriaJaKs extends _StringsAriaEnUs {
@override String get custom => 'カスタム';
@override String deleteFilesConfirm({required Object n}) => 'ファイルが${n}個あるけどほかしてええか?';
@override String get deleteTabConfirm => 'このタブほかしてええか?';
@override String get disableDataSaverWhenOnWifi => 'Wi-Fi接続中はデータセーバーを止めとく';
@override String get disableSubscribingNotes => 'ツッコミをいちいち更新せんようにする';
@override String get discardChangesConfirm => '変えんと戻ってええか?';
@override String get doubleTapToShow => '二度押ししたら見えるで';
Expand Down
1 change: 1 addition & 0 deletions lib/model/general_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class GeneralSettings with _$GeneralSettings {
@Default(false) bool useGroupedNotifications,
@Default(false) bool dataSaverMedia,
@Default(false) bool dataSaverUrlPreview,
@Default(false) bool disableDataSaverWhenOnWifi,
@Default(false) bool showLikeButtonInNoteFooter,
@Default(false) bool showTranslateButtonInNoteFooter,
@Default(defaultFontSize) double fontSize,
Expand Down
32 changes: 27 additions & 5 deletions lib/model/general_settings.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ mixin _$GeneralSettings {
bool get useGroupedNotifications => throw _privateConstructorUsedError;
bool get dataSaverMedia => throw _privateConstructorUsedError;
bool get dataSaverUrlPreview => throw _privateConstructorUsedError;
bool get disableDataSaverWhenOnWifi => throw _privateConstructorUsedError;
bool get showLikeButtonInNoteFooter => throw _privateConstructorUsedError;
bool get showTranslateButtonInNoteFooter =>
throw _privateConstructorUsedError;
Expand Down Expand Up @@ -109,6 +110,7 @@ abstract class $GeneralSettingsCopyWith<$Res> {
bool useGroupedNotifications,
bool dataSaverMedia,
bool dataSaverUrlPreview,
bool disableDataSaverWhenOnWifi,
bool showLikeButtonInNoteFooter,
bool showTranslateButtonInNoteFooter,
double fontSize,
Expand Down Expand Up @@ -173,6 +175,7 @@ class _$GeneralSettingsCopyWithImpl<$Res, $Val extends GeneralSettings>
Object? useGroupedNotifications = null,
Object? dataSaverMedia = null,
Object? dataSaverUrlPreview = null,
Object? disableDataSaverWhenOnWifi = null,
Object? showLikeButtonInNoteFooter = null,
Object? showTranslateButtonInNoteFooter = null,
Object? fontSize = null,
Expand Down Expand Up @@ -287,6 +290,10 @@ class _$GeneralSettingsCopyWithImpl<$Res, $Val extends GeneralSettings>
? _value.dataSaverUrlPreview
: dataSaverUrlPreview // ignore: cast_nullable_to_non_nullable
as bool,
disableDataSaverWhenOnWifi: null == disableDataSaverWhenOnWifi
? _value.disableDataSaverWhenOnWifi
: disableDataSaverWhenOnWifi // ignore: cast_nullable_to_non_nullable
as bool,
showLikeButtonInNoteFooter: null == showLikeButtonInNoteFooter
? _value.showLikeButtonInNoteFooter
: showLikeButtonInNoteFooter // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -434,6 +441,7 @@ abstract class _$$GeneralSettingsImplCopyWith<$Res>
bool useGroupedNotifications,
bool dataSaverMedia,
bool dataSaverUrlPreview,
bool disableDataSaverWhenOnWifi,
bool showLikeButtonInNoteFooter,
bool showTranslateButtonInNoteFooter,
double fontSize,
Expand Down Expand Up @@ -496,6 +504,7 @@ class __$$GeneralSettingsImplCopyWithImpl<$Res>
Object? useGroupedNotifications = null,
Object? dataSaverMedia = null,
Object? dataSaverUrlPreview = null,
Object? disableDataSaverWhenOnWifi = null,
Object? showLikeButtonInNoteFooter = null,
Object? showTranslateButtonInNoteFooter = null,
Object? fontSize = null,
Expand Down Expand Up @@ -610,6 +619,10 @@ class __$$GeneralSettingsImplCopyWithImpl<$Res>
? _value.dataSaverUrlPreview
: dataSaverUrlPreview // ignore: cast_nullable_to_non_nullable
as bool,
disableDataSaverWhenOnWifi: null == disableDataSaverWhenOnWifi
? _value.disableDataSaverWhenOnWifi
: disableDataSaverWhenOnWifi // ignore: cast_nullable_to_non_nullable
as bool,
showLikeButtonInNoteFooter: null == showLikeButtonInNoteFooter
? _value.showLikeButtonInNoteFooter
: showLikeButtonInNoteFooter // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -752,6 +765,7 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
this.useGroupedNotifications = false,
this.dataSaverMedia = false,
this.dataSaverUrlPreview = false,
this.disableDataSaverWhenOnWifi = false,
this.showLikeButtonInNoteFooter = false,
this.showTranslateButtonInNoteFooter = false,
this.fontSize = defaultFontSize,
Expand Down Expand Up @@ -852,6 +866,9 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
final bool dataSaverUrlPreview;
@override
@JsonKey()
final bool disableDataSaverWhenOnWifi;
@override
@JsonKey()
final bool showLikeButtonInNoteFooter;
@override
@JsonKey()
Expand Down Expand Up @@ -939,7 +956,7 @@ class _$GeneralSettingsImpl implements _GeneralSettings {

@override
String toString() {
return 'GeneralSettings(locale: $locale, collapseRenotes: $collapseRenotes, sensitive: $sensitive, highlightSensitiveMedia: $highlightSensitiveMedia, animatedMfm: $animatedMfm, advancedMfm: $advancedMfm, showReactionsCount: $showReactionsCount, loadRawImages: $loadRawImages, emojiStyle: $emojiStyle, emojiPickerUseDialog: $emojiPickerUseDialog, emojiPickerScale: $emojiPickerScale, emojiPickerAutofocus: $emojiPickerAutofocus, squareAvatars: $squareAvatars, showAvatarDecorations: $showAvatarDecorations, showClipButtonInNoteFooter: $showClipButtonInNoteFooter, reactionsDisplayScale: $reactionsDisplayScale, limitWidthOfReaction: $limitWidthOfReaction, forceShowAds: $forceShowAds, useGroupedNotifications: $useGroupedNotifications, dataSaverMedia: $dataSaverMedia, dataSaverUrlPreview: $dataSaverUrlPreview, showLikeButtonInNoteFooter: $showLikeButtonInNoteFooter, showTranslateButtonInNoteFooter: $showTranslateButtonInNoteFooter, fontSize: $fontSize, fontFamily: $fontFamily, showAvatarsInNote: $showAvatarsInNote, showAvatarsInSubNote: $showAvatarsInSubNote, showNoteReactionsViewer: $showNoteReactionsViewer, showNoteFooter: $showNoteFooter, showSubNoteReactionsViewer: $showSubNoteReactionsViewer, showSubNoteFooter: $showSubNoteFooter, vibrateNote: $vibrateNote, vibrateNotification: $vibrateNotification, showTimelineTabBarOnBottom: $showTimelineTabBarOnBottom, noteFooterScale: $noteFooterScale, enableInfiniteScroll: $enableInfiniteScroll, keepScreenOn: $keepScreenOn, enableHorizontalSwipe: $enableHorizontalSwipe, openSensitiveMediaOnDoubleTap: $openSensitiveMediaOnDoubleTap, noteTapAction: $noteTapAction, noteDoubleTapAction: $noteDoubleTapAction, noteLongPressAction: $noteLongPressAction, confirmBeforePost: $confirmBeforePost, confirmBeforeReact: $confirmBeforeReact, confirmBeforeFollow: $confirmBeforeFollow, themeMode: $themeMode, lightThemeId: $lightThemeId, darkThemeId: $darkThemeId, emojiPickerKeepOpen: $emojiPickerKeepOpen)';
return 'GeneralSettings(locale: $locale, collapseRenotes: $collapseRenotes, sensitive: $sensitive, highlightSensitiveMedia: $highlightSensitiveMedia, animatedMfm: $animatedMfm, advancedMfm: $advancedMfm, showReactionsCount: $showReactionsCount, loadRawImages: $loadRawImages, emojiStyle: $emojiStyle, emojiPickerUseDialog: $emojiPickerUseDialog, emojiPickerScale: $emojiPickerScale, emojiPickerAutofocus: $emojiPickerAutofocus, squareAvatars: $squareAvatars, showAvatarDecorations: $showAvatarDecorations, showClipButtonInNoteFooter: $showClipButtonInNoteFooter, reactionsDisplayScale: $reactionsDisplayScale, limitWidthOfReaction: $limitWidthOfReaction, forceShowAds: $forceShowAds, useGroupedNotifications: $useGroupedNotifications, dataSaverMedia: $dataSaverMedia, dataSaverUrlPreview: $dataSaverUrlPreview, disableDataSaverWhenOnWifi: $disableDataSaverWhenOnWifi, showLikeButtonInNoteFooter: $showLikeButtonInNoteFooter, showTranslateButtonInNoteFooter: $showTranslateButtonInNoteFooter, fontSize: $fontSize, fontFamily: $fontFamily, showAvatarsInNote: $showAvatarsInNote, showAvatarsInSubNote: $showAvatarsInSubNote, showNoteReactionsViewer: $showNoteReactionsViewer, showNoteFooter: $showNoteFooter, showSubNoteReactionsViewer: $showSubNoteReactionsViewer, showSubNoteFooter: $showSubNoteFooter, vibrateNote: $vibrateNote, vibrateNotification: $vibrateNotification, showTimelineTabBarOnBottom: $showTimelineTabBarOnBottom, noteFooterScale: $noteFooterScale, enableInfiniteScroll: $enableInfiniteScroll, keepScreenOn: $keepScreenOn, enableHorizontalSwipe: $enableHorizontalSwipe, openSensitiveMediaOnDoubleTap: $openSensitiveMediaOnDoubleTap, noteTapAction: $noteTapAction, noteDoubleTapAction: $noteDoubleTapAction, noteLongPressAction: $noteLongPressAction, confirmBeforePost: $confirmBeforePost, confirmBeforeReact: $confirmBeforeReact, confirmBeforeFollow: $confirmBeforeFollow, themeMode: $themeMode, lightThemeId: $lightThemeId, darkThemeId: $darkThemeId, emojiPickerKeepOpen: $emojiPickerKeepOpen)';
}

@override
Expand Down Expand Up @@ -989,6 +1006,9 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
other.dataSaverMedia == dataSaverMedia) &&
(identical(other.dataSaverUrlPreview, dataSaverUrlPreview) ||
other.dataSaverUrlPreview == dataSaverUrlPreview) &&
(identical(other.disableDataSaverWhenOnWifi, disableDataSaverWhenOnWifi) ||
other.disableDataSaverWhenOnWifi ==
disableDataSaverWhenOnWifi) &&
(identical(other.showLikeButtonInNoteFooter, showLikeButtonInNoteFooter) ||
other.showLikeButtonInNoteFooter ==
showLikeButtonInNoteFooter) &&
Expand All @@ -1001,10 +1021,8 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
other.fontFamily == fontFamily) &&
(identical(other.showAvatarsInNote, showAvatarsInNote) ||
other.showAvatarsInNote == showAvatarsInNote) &&
(identical(other.showAvatarsInSubNote, showAvatarsInSubNote) ||
other.showAvatarsInSubNote == showAvatarsInSubNote) &&
(identical(other.showNoteReactionsViewer, showNoteReactionsViewer) ||
other.showNoteReactionsViewer == showNoteReactionsViewer) &&
(identical(other.showAvatarsInSubNote, showAvatarsInSubNote) || other.showAvatarsInSubNote == showAvatarsInSubNote) &&
(identical(other.showNoteReactionsViewer, showNoteReactionsViewer) || other.showNoteReactionsViewer == showNoteReactionsViewer) &&
(identical(other.showNoteFooter, showNoteFooter) || other.showNoteFooter == showNoteFooter) &&
(identical(other.showSubNoteReactionsViewer, showSubNoteReactionsViewer) || other.showSubNoteReactionsViewer == showSubNoteReactionsViewer) &&
(identical(other.showSubNoteFooter, showSubNoteFooter) || other.showSubNoteFooter == showSubNoteFooter) &&
Expand Down Expand Up @@ -1053,6 +1071,7 @@ class _$GeneralSettingsImpl implements _GeneralSettings {
useGroupedNotifications,
dataSaverMedia,
dataSaverUrlPreview,
disableDataSaverWhenOnWifi,
showLikeButtonInNoteFooter,
showTranslateButtonInNoteFooter,
fontSize,
Expand Down Expand Up @@ -1122,6 +1141,7 @@ abstract class _GeneralSettings implements GeneralSettings {
final bool useGroupedNotifications,
final bool dataSaverMedia,
final bool dataSaverUrlPreview,
final bool disableDataSaverWhenOnWifi,
final bool showLikeButtonInNoteFooter,
final bool showTranslateButtonInNoteFooter,
final double fontSize,
Expand Down Expand Up @@ -1199,6 +1219,8 @@ abstract class _GeneralSettings implements GeneralSettings {
@override
bool get dataSaverUrlPreview;
@override
bool get disableDataSaverWhenOnWifi;
@override
bool get showLikeButtonInNoteFooter;
@override
bool get showTranslateButtonInNoteFooter;
Expand Down
3 changes: 3 additions & 0 deletions lib/model/general_settings.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions lib/provider/connectivity_provider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'connectivity_provider.g.dart';

@Riverpod(keepAlive: true)
Stream<List<ConnectivityResult>> connectivity(ConnectivityRef ref) {
return Connectivity().onConnectivityChanged;
}
24 changes: 24 additions & 0 deletions lib/provider/connectivity_provider.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions lib/provider/general_settings_notifier_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ class GeneralSettingsNotifier extends _$GeneralSettingsNotifier {
await _save();
}

Future<void> setDisableDataSaverWhenOnWifi(
bool disableDataSaverWhenOnWifi,
) async {
state =
state.copyWith(disableDataSaverWhenOnWifi: disableDataSaverWhenOnWifi);
await _save();
}

Future<void> setShowLikeButtonInNoteFooter(
bool showLikeButtonInNoteFooter,
) async {
Expand Down
2 changes: 1 addition & 1 deletion lib/provider/general_settings_notifier_provider.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions lib/view/page/settings/appearance_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ class AppearancePage extends HookConsumerWidget {
.read(generalSettingsNotifierProvider.notifier)
.setDataSaverUrlPreview(value),
),
SwitchListTile(
title: Text(t.aria.disableDataSaverWhenOnWifi),
value: settings.disableDataSaverWhenOnWifi,
onChanged: (value) => ref
.read(generalSettingsNotifierProvider.notifier)
.setDisableDataSaverWhenOnWifi(value),
),
const Divider(),
SwitchListTile(
title: Text(t.misskey.forceShowAds),
Expand Down
Loading