mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 01:06:21 +01:00
84 lines
3.2 KiB
Dart
84 lines
3.2 KiB
Dart
part of '../pref_controller.dart';
|
|
|
|
extension on Pref {
|
|
int? getHomeAlbumsSort() => provider.getInt(PrefKey.homeAlbumsSort);
|
|
int getHomeAlbumsSortOr(int def) => getHomeAlbumsSort() ?? def;
|
|
Future<bool> setHomeAlbumsSort(int value) =>
|
|
provider.setInt(PrefKey.homeAlbumsSort, value);
|
|
|
|
bool? isDarkTheme() => provider.getBool(PrefKey.darkTheme);
|
|
bool isDarkThemeOr(bool def) => isDarkTheme() ?? def;
|
|
Future<bool> setDarkTheme(bool value) =>
|
|
provider.setBool(PrefKey.darkTheme, value);
|
|
|
|
bool? isFollowSystemTheme() => provider.getBool(PrefKey.followSystemTheme);
|
|
bool isFollowSystemThemeOr(bool def) => isFollowSystemTheme() ?? def;
|
|
Future<bool> setFollowSystemTheme(bool value) =>
|
|
provider.setBool(PrefKey.followSystemTheme, value);
|
|
|
|
bool? isUseBlackInDarkTheme() =>
|
|
provider.getBool(PrefKey.useBlackInDarkTheme);
|
|
bool isUseBlackInDarkThemeOr(bool def) => isUseBlackInDarkTheme() ?? def;
|
|
Future<bool> setUseBlackInDarkTheme(bool value) =>
|
|
provider.setBool(PrefKey.useBlackInDarkTheme, value);
|
|
|
|
int? getGpsMapProvider() => provider.getInt(PrefKey.gpsMapProvider);
|
|
int getGpsMapProviderOr(int def) => getGpsMapProvider() ?? def;
|
|
Future<bool> setGpsMapProvider(int value) =>
|
|
provider.setInt(PrefKey.gpsMapProvider, value);
|
|
|
|
int? getSeedColor() => provider.getInt(PrefKey.seedColor);
|
|
// int getSeedColorOr(int def) => getSeedColor() ?? def;
|
|
Future<bool> setSeedColor(int? value) {
|
|
if (value == null) {
|
|
return provider.remove(PrefKey.seedColor);
|
|
} else {
|
|
return provider.setInt(PrefKey.seedColor, value);
|
|
}
|
|
}
|
|
|
|
int? getSecondarySeedColor() => provider.getInt(PrefKey.secondarySeedColor);
|
|
// int getSecondarySeedColorOr(int def) => getSecondarySeedColor() ?? def;
|
|
Future<bool> setSecondarySeedColor(int? value) {
|
|
if (value == null) {
|
|
return provider.remove(PrefKey.secondarySeedColor);
|
|
} else {
|
|
return provider.setInt(PrefKey.secondarySeedColor, value);
|
|
}
|
|
}
|
|
|
|
int? getProtectedPageAuthType() =>
|
|
provider.getInt(PrefKey.protectedPageAuthType);
|
|
// int getProtectedPageAuthTypeOr(int def) => getProtectedPageAuthType() ?? def;
|
|
Future<bool> setProtectedPageAuthType(int? value) {
|
|
if (value == null) {
|
|
return provider.remove(PrefKey.protectedPageAuthType);
|
|
} else {
|
|
return provider.setInt(PrefKey.protectedPageAuthType, value);
|
|
}
|
|
}
|
|
|
|
String? getProtectedPageAuthPin() =>
|
|
provider.getString(PrefKey.protectedPageAuthPin);
|
|
// String getProtectedPageAuthPinOr(String def) =>
|
|
// getProtectedPageAuthPin() ?? def;
|
|
Future<bool> setProtectedPageAuthPin(String? value) {
|
|
if (value == null) {
|
|
return provider.remove(PrefKey.protectedPageAuthPin);
|
|
} else {
|
|
return provider.setString(PrefKey.protectedPageAuthPin, value);
|
|
}
|
|
}
|
|
|
|
String? getProtectedPageAuthPassword() =>
|
|
provider.getString(PrefKey.protectedPageAuthPassword);
|
|
// String getProtectedPageAuthPasswordOr(String def) =>
|
|
// getProtectedPageAuthPassword() ?? def;
|
|
Future<bool> setProtectedPageAuthPassword(String? value) {
|
|
if (value == null) {
|
|
return provider.remove(PrefKey.protectedPageAuthPassword);
|
|
} else {
|
|
return provider.setString(PrefKey.protectedPageAuthPassword, value);
|
|
}
|
|
}
|
|
}
|