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