mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 08:46:18 +01:00
Rename exif pref
This commit is contained in:
parent
2374fe83df
commit
ef67d414fd
5 changed files with 24 additions and 19 deletions
|
@ -18,8 +18,8 @@ class MetadataController {
|
|||
required this.account,
|
||||
required this.prefController,
|
||||
}) {
|
||||
_subscriptions
|
||||
.add(prefController.isEnableExifChange.listen(_onSetEnableExif));
|
||||
_subscriptions.add(
|
||||
prefController.isEnableClientExifChange.listen(_onSetEnableClientExif));
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
|
@ -44,16 +44,16 @@ class MetadataController {
|
|||
void kickstart() {
|
||||
_log.info("[kickstart] Metadata controller enabled");
|
||||
_isEnable = true;
|
||||
if (prefController.isEnableExifValue && !_hasStarted) {
|
||||
if (prefController.isEnableClientExifValue && !_hasStarted) {
|
||||
_startMetadataTask();
|
||||
}
|
||||
}
|
||||
|
||||
void _onSetEnableExif(bool value) {
|
||||
_log.info("[_onSetEnableExif]");
|
||||
void _onSetEnableClientExif(bool value) {
|
||||
_log.info("[_onSetEnableClientExif]");
|
||||
if (value) {
|
||||
if (!_isEnable) {
|
||||
_log.info("[_onSetEnableExif] Ignored as not enabled");
|
||||
_log.info("[_onSetEnableClientExif] Ignored as not enabled");
|
||||
return;
|
||||
}
|
||||
_startMetadataTask();
|
||||
|
|
|
@ -69,9 +69,9 @@ class PrefController {
|
|||
value: value,
|
||||
);
|
||||
|
||||
Future<bool> setEnableExif(bool value) => _set<bool>(
|
||||
controller: _isEnableExifController,
|
||||
setter: (pref, value) => pref.setEnableExif(value),
|
||||
Future<bool> setEnableClientExif(bool value) => _set<bool>(
|
||||
controller: _isEnableClientExifController,
|
||||
setter: (pref, value) => pref.setEnableClientExif(value),
|
||||
value: value,
|
||||
);
|
||||
|
||||
|
@ -331,8 +331,8 @@ class PrefController {
|
|||
late final _homeAlbumsSortController = BehaviorSubject.seeded(
|
||||
CollectionSort.values[pref.getHomeAlbumsSortOr(0)]);
|
||||
@npSubjectAccessor
|
||||
late final _isEnableExifController =
|
||||
BehaviorSubject.seeded(pref.isEnableExifOr(true));
|
||||
late final _isEnableClientExifController =
|
||||
BehaviorSubject.seeded(pref.isEnableClientExif() ?? true);
|
||||
@npSubjectAccessor
|
||||
late final _shouldProcessExifWifiOnlyController =
|
||||
BehaviorSubject.seeded(pref.shouldProcessExifWifiOnlyOr(true));
|
||||
|
|
|
@ -56,11 +56,13 @@ extension $PrefControllerNpSubjectAccessor on PrefController {
|
|||
Stream<CollectionSort> get homeAlbumsSortChange =>
|
||||
homeAlbumsSort.distinct().skip(1);
|
||||
CollectionSort get homeAlbumsSortValue => _homeAlbumsSortController.value;
|
||||
// _isEnableExifController
|
||||
ValueStream<bool> get isEnableExif => _isEnableExifController.stream;
|
||||
Stream<bool> get isEnableExifNew => isEnableExif.skip(1);
|
||||
Stream<bool> get isEnableExifChange => isEnableExif.distinct().skip(1);
|
||||
bool get isEnableExifValue => _isEnableExifController.value;
|
||||
// _isEnableClientExifController
|
||||
ValueStream<bool> get isEnableClientExif =>
|
||||
_isEnableClientExifController.stream;
|
||||
Stream<bool> get isEnableClientExifNew => isEnableClientExif.skip(1);
|
||||
Stream<bool> get isEnableClientExifChange =>
|
||||
isEnableClientExif.distinct().skip(1);
|
||||
bool get isEnableClientExifValue => _isEnableClientExifController.value;
|
||||
// _shouldProcessExifWifiOnlyController
|
||||
ValueStream<bool> get shouldProcessExifWifiOnly =>
|
||||
_shouldProcessExifWifiOnlyController.stream;
|
||||
|
|
|
@ -15,6 +15,9 @@ extension on Pref {
|
|||
Future<bool> setHomeAlbumsSort(int value) =>
|
||||
provider.setInt(PrefKey.homeAlbumsSort, value);
|
||||
|
||||
bool? isEnableClientExif() => isEnableExif();
|
||||
Future<bool> setEnableClientExif(bool value) => setEnableExif(value);
|
||||
|
||||
bool? isDarkTheme() => provider.getBool(PrefKey.darkTheme);
|
||||
bool isDarkThemeOr(bool def) => isDarkTheme() ?? def;
|
||||
Future<bool> setDarkTheme(bool value) =>
|
||||
|
|
|
@ -6,7 +6,7 @@ class _Bloc extends Bloc<_Event, _State>
|
|||
_Bloc({
|
||||
required this.prefController,
|
||||
}) : super(_State(
|
||||
isEnable: prefController.isEnableExifValue,
|
||||
isEnable: prefController.isEnableClientExifValue,
|
||||
isWifiOnly: prefController.shouldProcessExifWifiOnlyValue,
|
||||
)) {
|
||||
on<_Init>(_onInit);
|
||||
|
@ -22,7 +22,7 @@ class _Bloc extends Bloc<_Event, _State>
|
|||
await Future.wait([
|
||||
forEach(
|
||||
emit,
|
||||
prefController.isEnableExifChange,
|
||||
prefController.isEnableClientExifChange,
|
||||
onData: (data) => state.copyWith(isEnable: data),
|
||||
onError: (e, stackTrace) {
|
||||
_log.severe("[_onInit] Uncaught exception", e, stackTrace);
|
||||
|
@ -43,7 +43,7 @@ class _Bloc extends Bloc<_Event, _State>
|
|||
|
||||
void _onSetEnable(_SetEnable ev, Emitter<_State> emit) {
|
||||
_log.info(ev);
|
||||
prefController.setEnableExif(ev.value);
|
||||
prefController.setEnableClientExif(ev.value);
|
||||
}
|
||||
|
||||
Future<void> _onSetWifiOnly(_SetWifiOnly ev, Emitter<_State> emit) async {
|
||||
|
|
Loading…
Reference in a new issue