mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
feature: Toggle wifi requirement for downloads (#110)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
0b0cd3a557
commit
cb4b416bfc
7 changed files with 46 additions and 6 deletions
|
|
@ -1115,5 +1115,7 @@
|
||||||
"schemeSettingsExpressive": "Expressive",
|
"schemeSettingsExpressive": "Expressive",
|
||||||
"schemeSettingsContent": "Content",
|
"schemeSettingsContent": "Content",
|
||||||
"schemeSettingsRainbow": "Rainbow",
|
"schemeSettingsRainbow": "Rainbow",
|
||||||
"schemeSettingsFruitSalad": "Fruit salad"
|
"schemeSettingsFruitSalad": "Fruit salad",
|
||||||
|
"clientSettingsRequireWifiTitle": "Require Wi-Fi",
|
||||||
|
"clientSettingsRequireWifiDesc": "Only download when connected to a Wi-Fi network"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,14 @@ class ClientSettingsModel with _$ClientSettingsModel {
|
||||||
@Default(ThemeMode.system) ThemeMode themeMode,
|
@Default(ThemeMode.system) ThemeMode themeMode,
|
||||||
ColorThemes? themeColor,
|
ColorThemes? themeColor,
|
||||||
@Default(false) bool amoledBlack,
|
@Default(false) bool amoledBlack,
|
||||||
@Default(false) bool blurPlaceHolders,
|
@Default(true) bool blurPlaceHolders,
|
||||||
@Default(false) bool blurUpcomingEpisodes,
|
@Default(false) bool blurUpcomingEpisodes,
|
||||||
@LocaleConvert() Locale? selectedLocale,
|
@LocaleConvert() Locale? selectedLocale,
|
||||||
@Default(true) bool enableMediaKeys,
|
@Default(true) bool enableMediaKeys,
|
||||||
@Default(1.0) double posterSize,
|
@Default(1.0) double posterSize,
|
||||||
@Default(false) bool pinchPosterZoom,
|
@Default(false) bool pinchPosterZoom,
|
||||||
@Default(false) bool mouseDragSupport,
|
@Default(false) bool mouseDragSupport,
|
||||||
|
@Default(true) bool requireWifi,
|
||||||
@Default(DynamicSchemeVariant.tonalSpot) DynamicSchemeVariant schemeVariant,
|
@Default(DynamicSchemeVariant.tonalSpot) DynamicSchemeVariant schemeVariant,
|
||||||
int? libraryPageSize,
|
int? libraryPageSize,
|
||||||
}) = _ClientSettingsModel;
|
}) = _ClientSettingsModel;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ mixin _$ClientSettingsModel {
|
||||||
double get posterSize => throw _privateConstructorUsedError;
|
double get posterSize => throw _privateConstructorUsedError;
|
||||||
bool get pinchPosterZoom => throw _privateConstructorUsedError;
|
bool get pinchPosterZoom => throw _privateConstructorUsedError;
|
||||||
bool get mouseDragSupport => throw _privateConstructorUsedError;
|
bool get mouseDragSupport => throw _privateConstructorUsedError;
|
||||||
|
bool get requireWifi => throw _privateConstructorUsedError;
|
||||||
DynamicSchemeVariant get schemeVariant => throw _privateConstructorUsedError;
|
DynamicSchemeVariant get schemeVariant => throw _privateConstructorUsedError;
|
||||||
int? get libraryPageSize => throw _privateConstructorUsedError;
|
int? get libraryPageSize => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
|
@ -71,6 +72,7 @@ abstract class $ClientSettingsModelCopyWith<$Res> {
|
||||||
double posterSize,
|
double posterSize,
|
||||||
bool pinchPosterZoom,
|
bool pinchPosterZoom,
|
||||||
bool mouseDragSupport,
|
bool mouseDragSupport,
|
||||||
|
bool requireWifi,
|
||||||
DynamicSchemeVariant schemeVariant,
|
DynamicSchemeVariant schemeVariant,
|
||||||
int? libraryPageSize});
|
int? libraryPageSize});
|
||||||
}
|
}
|
||||||
|
|
@ -105,6 +107,7 @@ class _$ClientSettingsModelCopyWithImpl<$Res, $Val extends ClientSettingsModel>
|
||||||
Object? posterSize = null,
|
Object? posterSize = null,
|
||||||
Object? pinchPosterZoom = null,
|
Object? pinchPosterZoom = null,
|
||||||
Object? mouseDragSupport = null,
|
Object? mouseDragSupport = null,
|
||||||
|
Object? requireWifi = null,
|
||||||
Object? schemeVariant = null,
|
Object? schemeVariant = null,
|
||||||
Object? libraryPageSize = freezed,
|
Object? libraryPageSize = freezed,
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -169,6 +172,10 @@ class _$ClientSettingsModelCopyWithImpl<$Res, $Val extends ClientSettingsModel>
|
||||||
? _value.mouseDragSupport
|
? _value.mouseDragSupport
|
||||||
: mouseDragSupport // ignore: cast_nullable_to_non_nullable
|
: mouseDragSupport // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
requireWifi: null == requireWifi
|
||||||
|
? _value.requireWifi
|
||||||
|
: requireWifi // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
schemeVariant: null == schemeVariant
|
schemeVariant: null == schemeVariant
|
||||||
? _value.schemeVariant
|
? _value.schemeVariant
|
||||||
: schemeVariant // ignore: cast_nullable_to_non_nullable
|
: schemeVariant // ignore: cast_nullable_to_non_nullable
|
||||||
|
|
@ -205,6 +212,7 @@ abstract class _$$ClientSettingsModelImplCopyWith<$Res>
|
||||||
double posterSize,
|
double posterSize,
|
||||||
bool pinchPosterZoom,
|
bool pinchPosterZoom,
|
||||||
bool mouseDragSupport,
|
bool mouseDragSupport,
|
||||||
|
bool requireWifi,
|
||||||
DynamicSchemeVariant schemeVariant,
|
DynamicSchemeVariant schemeVariant,
|
||||||
int? libraryPageSize});
|
int? libraryPageSize});
|
||||||
}
|
}
|
||||||
|
|
@ -237,6 +245,7 @@ class __$$ClientSettingsModelImplCopyWithImpl<$Res>
|
||||||
Object? posterSize = null,
|
Object? posterSize = null,
|
||||||
Object? pinchPosterZoom = null,
|
Object? pinchPosterZoom = null,
|
||||||
Object? mouseDragSupport = null,
|
Object? mouseDragSupport = null,
|
||||||
|
Object? requireWifi = null,
|
||||||
Object? schemeVariant = null,
|
Object? schemeVariant = null,
|
||||||
Object? libraryPageSize = freezed,
|
Object? libraryPageSize = freezed,
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -301,6 +310,10 @@ class __$$ClientSettingsModelImplCopyWithImpl<$Res>
|
||||||
? _value.mouseDragSupport
|
? _value.mouseDragSupport
|
||||||
: mouseDragSupport // ignore: cast_nullable_to_non_nullable
|
: mouseDragSupport // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,
|
as bool,
|
||||||
|
requireWifi: null == requireWifi
|
||||||
|
? _value.requireWifi
|
||||||
|
: requireWifi // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
schemeVariant: null == schemeVariant
|
schemeVariant: null == schemeVariant
|
||||||
? _value.schemeVariant
|
? _value.schemeVariant
|
||||||
: schemeVariant // ignore: cast_nullable_to_non_nullable
|
: schemeVariant // ignore: cast_nullable_to_non_nullable
|
||||||
|
|
@ -326,13 +339,14 @@ class _$ClientSettingsModelImpl extends _ClientSettingsModel
|
||||||
this.themeMode = ThemeMode.system,
|
this.themeMode = ThemeMode.system,
|
||||||
this.themeColor,
|
this.themeColor,
|
||||||
this.amoledBlack = false,
|
this.amoledBlack = false,
|
||||||
this.blurPlaceHolders = false,
|
this.blurPlaceHolders = true,
|
||||||
this.blurUpcomingEpisodes = false,
|
this.blurUpcomingEpisodes = false,
|
||||||
@LocaleConvert() this.selectedLocale,
|
@LocaleConvert() this.selectedLocale,
|
||||||
this.enableMediaKeys = true,
|
this.enableMediaKeys = true,
|
||||||
this.posterSize = 1.0,
|
this.posterSize = 1.0,
|
||||||
this.pinchPosterZoom = false,
|
this.pinchPosterZoom = false,
|
||||||
this.mouseDragSupport = false,
|
this.mouseDragSupport = false,
|
||||||
|
this.requireWifi = true,
|
||||||
this.schemeVariant = DynamicSchemeVariant.tonalSpot,
|
this.schemeVariant = DynamicSchemeVariant.tonalSpot,
|
||||||
this.libraryPageSize})
|
this.libraryPageSize})
|
||||||
: super._();
|
: super._();
|
||||||
|
|
@ -384,13 +398,16 @@ class _$ClientSettingsModelImpl extends _ClientSettingsModel
|
||||||
final bool mouseDragSupport;
|
final bool mouseDragSupport;
|
||||||
@override
|
@override
|
||||||
@JsonKey()
|
@JsonKey()
|
||||||
|
final bool requireWifi;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
final DynamicSchemeVariant schemeVariant;
|
final DynamicSchemeVariant schemeVariant;
|
||||||
@override
|
@override
|
||||||
final int? libraryPageSize;
|
final int? libraryPageSize;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
||||||
return 'ClientSettingsModel(syncPath: $syncPath, position: $position, size: $size, timeOut: $timeOut, nextUpDateCutoff: $nextUpDateCutoff, themeMode: $themeMode, themeColor: $themeColor, amoledBlack: $amoledBlack, blurPlaceHolders: $blurPlaceHolders, blurUpcomingEpisodes: $blurUpcomingEpisodes, selectedLocale: $selectedLocale, enableMediaKeys: $enableMediaKeys, posterSize: $posterSize, pinchPosterZoom: $pinchPosterZoom, mouseDragSupport: $mouseDragSupport, schemeVariant: $schemeVariant, libraryPageSize: $libraryPageSize)';
|
return 'ClientSettingsModel(syncPath: $syncPath, position: $position, size: $size, timeOut: $timeOut, nextUpDateCutoff: $nextUpDateCutoff, themeMode: $themeMode, themeColor: $themeColor, amoledBlack: $amoledBlack, blurPlaceHolders: $blurPlaceHolders, blurUpcomingEpisodes: $blurUpcomingEpisodes, selectedLocale: $selectedLocale, enableMediaKeys: $enableMediaKeys, posterSize: $posterSize, pinchPosterZoom: $pinchPosterZoom, mouseDragSupport: $mouseDragSupport, requireWifi: $requireWifi, schemeVariant: $schemeVariant, libraryPageSize: $libraryPageSize)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -413,6 +430,7 @@ class _$ClientSettingsModelImpl extends _ClientSettingsModel
|
||||||
..add(DiagnosticsProperty('posterSize', posterSize))
|
..add(DiagnosticsProperty('posterSize', posterSize))
|
||||||
..add(DiagnosticsProperty('pinchPosterZoom', pinchPosterZoom))
|
..add(DiagnosticsProperty('pinchPosterZoom', pinchPosterZoom))
|
||||||
..add(DiagnosticsProperty('mouseDragSupport', mouseDragSupport))
|
..add(DiagnosticsProperty('mouseDragSupport', mouseDragSupport))
|
||||||
|
..add(DiagnosticsProperty('requireWifi', requireWifi))
|
||||||
..add(DiagnosticsProperty('schemeVariant', schemeVariant))
|
..add(DiagnosticsProperty('schemeVariant', schemeVariant))
|
||||||
..add(DiagnosticsProperty('libraryPageSize', libraryPageSize));
|
..add(DiagnosticsProperty('libraryPageSize', libraryPageSize));
|
||||||
}
|
}
|
||||||
|
|
@ -450,6 +468,8 @@ class _$ClientSettingsModelImpl extends _ClientSettingsModel
|
||||||
other.pinchPosterZoom == pinchPosterZoom) &&
|
other.pinchPosterZoom == pinchPosterZoom) &&
|
||||||
(identical(other.mouseDragSupport, mouseDragSupport) ||
|
(identical(other.mouseDragSupport, mouseDragSupport) ||
|
||||||
other.mouseDragSupport == mouseDragSupport) &&
|
other.mouseDragSupport == mouseDragSupport) &&
|
||||||
|
(identical(other.requireWifi, requireWifi) ||
|
||||||
|
other.requireWifi == requireWifi) &&
|
||||||
(identical(other.schemeVariant, schemeVariant) ||
|
(identical(other.schemeVariant, schemeVariant) ||
|
||||||
other.schemeVariant == schemeVariant) &&
|
other.schemeVariant == schemeVariant) &&
|
||||||
(identical(other.libraryPageSize, libraryPageSize) ||
|
(identical(other.libraryPageSize, libraryPageSize) ||
|
||||||
|
|
@ -475,6 +495,7 @@ class _$ClientSettingsModelImpl extends _ClientSettingsModel
|
||||||
posterSize,
|
posterSize,
|
||||||
pinchPosterZoom,
|
pinchPosterZoom,
|
||||||
mouseDragSupport,
|
mouseDragSupport,
|
||||||
|
requireWifi,
|
||||||
schemeVariant,
|
schemeVariant,
|
||||||
libraryPageSize);
|
libraryPageSize);
|
||||||
|
|
||||||
|
|
@ -512,6 +533,7 @@ abstract class _ClientSettingsModel extends ClientSettingsModel {
|
||||||
final double posterSize,
|
final double posterSize,
|
||||||
final bool pinchPosterZoom,
|
final bool pinchPosterZoom,
|
||||||
final bool mouseDragSupport,
|
final bool mouseDragSupport,
|
||||||
|
final bool requireWifi,
|
||||||
final DynamicSchemeVariant schemeVariant,
|
final DynamicSchemeVariant schemeVariant,
|
||||||
final int? libraryPageSize}) = _$ClientSettingsModelImpl;
|
final int? libraryPageSize}) = _$ClientSettingsModelImpl;
|
||||||
_ClientSettingsModel._() : super._();
|
_ClientSettingsModel._() : super._();
|
||||||
|
|
@ -551,6 +573,8 @@ abstract class _ClientSettingsModel extends ClientSettingsModel {
|
||||||
@override
|
@override
|
||||||
bool get mouseDragSupport;
|
bool get mouseDragSupport;
|
||||||
@override
|
@override
|
||||||
|
bool get requireWifi;
|
||||||
|
@override
|
||||||
DynamicSchemeVariant get schemeVariant;
|
DynamicSchemeVariant get schemeVariant;
|
||||||
@override
|
@override
|
||||||
int? get libraryPageSize;
|
int? get libraryPageSize;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ _$ClientSettingsModelImpl _$$ClientSettingsModelImplFromJson(
|
||||||
ThemeMode.system,
|
ThemeMode.system,
|
||||||
themeColor: $enumDecodeNullable(_$ColorThemesEnumMap, json['themeColor']),
|
themeColor: $enumDecodeNullable(_$ColorThemesEnumMap, json['themeColor']),
|
||||||
amoledBlack: json['amoledBlack'] as bool? ?? false,
|
amoledBlack: json['amoledBlack'] as bool? ?? false,
|
||||||
blurPlaceHolders: json['blurPlaceHolders'] as bool? ?? false,
|
blurPlaceHolders: json['blurPlaceHolders'] as bool? ?? true,
|
||||||
blurUpcomingEpisodes: json['blurUpcomingEpisodes'] as bool? ?? false,
|
blurUpcomingEpisodes: json['blurUpcomingEpisodes'] as bool? ?? false,
|
||||||
selectedLocale:
|
selectedLocale:
|
||||||
const LocaleConvert().fromJson(json['selectedLocale'] as String?),
|
const LocaleConvert().fromJson(json['selectedLocale'] as String?),
|
||||||
|
|
@ -34,6 +34,7 @@ _$ClientSettingsModelImpl _$$ClientSettingsModelImplFromJson(
|
||||||
posterSize: (json['posterSize'] as num?)?.toDouble() ?? 1.0,
|
posterSize: (json['posterSize'] as num?)?.toDouble() ?? 1.0,
|
||||||
pinchPosterZoom: json['pinchPosterZoom'] as bool? ?? false,
|
pinchPosterZoom: json['pinchPosterZoom'] as bool? ?? false,
|
||||||
mouseDragSupport: json['mouseDragSupport'] as bool? ?? false,
|
mouseDragSupport: json['mouseDragSupport'] as bool? ?? false,
|
||||||
|
requireWifi: json['requireWifi'] as bool? ?? true,
|
||||||
schemeVariant: $enumDecodeNullable(
|
schemeVariant: $enumDecodeNullable(
|
||||||
_$DynamicSchemeVariantEnumMap, json['schemeVariant']) ??
|
_$DynamicSchemeVariantEnumMap, json['schemeVariant']) ??
|
||||||
DynamicSchemeVariant.tonalSpot,
|
DynamicSchemeVariant.tonalSpot,
|
||||||
|
|
@ -58,6 +59,7 @@ Map<String, dynamic> _$$ClientSettingsModelImplToJson(
|
||||||
'posterSize': instance.posterSize,
|
'posterSize': instance.posterSize,
|
||||||
'pinchPosterZoom': instance.pinchPosterZoom,
|
'pinchPosterZoom': instance.pinchPosterZoom,
|
||||||
'mouseDragSupport': instance.mouseDragSupport,
|
'mouseDragSupport': instance.mouseDragSupport,
|
||||||
|
'requireWifi': instance.requireWifi,
|
||||||
'schemeVariant': _$DynamicSchemeVariantEnumMap[instance.schemeVariant]!,
|
'schemeVariant': _$DynamicSchemeVariantEnumMap[instance.schemeVariant]!,
|
||||||
'libraryPageSize': instance.libraryPageSize,
|
'libraryPageSize': instance.libraryPageSize,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -56,4 +56,6 @@ class ClientSettingsNotifier extends StateNotifier<ClientSettingsModel> {
|
||||||
|
|
||||||
void setSchemeVariant(DynamicSchemeVariant? type) =>
|
void setSchemeVariant(DynamicSchemeVariant? type) =>
|
||||||
state = state.copyWith(schemeVariant: type ?? state.schemeVariant);
|
state = state.copyWith(schemeVariant: type ?? state.schemeVariant);
|
||||||
|
|
||||||
|
void setRequireWifi(bool value) => state = state.copyWith(requireWifi: value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -462,7 +462,7 @@ class SyncNotifier extends StateNotifier<SyncSettingsModel> {
|
||||||
filename: syncItem.videoFileName,
|
filename: syncItem.videoFileName,
|
||||||
updates: Updates.statusAndProgress,
|
updates: Updates.statusAndProgress,
|
||||||
baseDirectory: BaseDirectory.root,
|
baseDirectory: BaseDirectory.root,
|
||||||
requiresWiFi: true,
|
requiresWiFi: ref.read(clientSettingsProvider.select((value) => value.requireWifi)),
|
||||||
retries: 5,
|
retries: 5,
|
||||||
allowPause: true,
|
allowPause: true,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,15 @@ class _ClientSettingsPageState extends ConsumerState<ClientSettingsPage> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
SettingsListTile(
|
||||||
|
label: Text(context.localized.clientSettingsRequireWifiTitle),
|
||||||
|
subLabel: Text(context.localized.clientSettingsRequireWifiDesc),
|
||||||
|
onTap: () => ref.read(clientSettingsProvider.notifier).setRequireWifi(!clientSettings.requireWifi),
|
||||||
|
trailing: Switch(
|
||||||
|
value: clientSettings.requireWifi,
|
||||||
|
onChanged: (value) => ref.read(clientSettingsProvider.notifier).setRequireWifi(value),
|
||||||
|
),
|
||||||
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
],
|
],
|
||||||
SettingsLabelDivider(label: context.localized.lockscreen),
|
SettingsLabelDivider(label: context.localized.lockscreen),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue