mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 16:56:19 +01:00
Deprecate pref updated events
This commit is contained in:
parent
54e8c127b9
commit
be0caa1c48
2 changed files with 6 additions and 21 deletions
|
@ -2,12 +2,9 @@ import 'dart:async';
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:event_bus/event_bus.dart';
|
||||
import 'package:kiwi/kiwi.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:nc_photos/account.dart';
|
||||
import 'package:nc_photos/entity/pref/provider/memory.dart';
|
||||
import 'package:nc_photos/event/event.dart';
|
||||
import 'package:np_codegen/np_codegen.dart';
|
||||
import 'package:np_common/type.dart';
|
||||
|
||||
|
@ -30,14 +27,8 @@ class Pref {
|
|||
}
|
||||
|
||||
Future<bool> _set<T>(PrefKey key, T value,
|
||||
Future<bool> Function(PrefKey key, T value) setFn) async {
|
||||
if (await setFn(key, value)) {
|
||||
KiwiContainer().resolve<EventBus>().fire(PrefUpdatedEvent(key, value));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Future<bool> Function(PrefKey key, T value) setFn) =>
|
||||
setFn(key, value);
|
||||
|
||||
Future<bool> _remove(PrefKey key) => provider.remove(key);
|
||||
|
||||
|
@ -69,16 +60,8 @@ class AccountPref {
|
|||
Future<JsonObj> toJson() => provider.toJson();
|
||||
|
||||
Future<bool> _set<T>(AccountPrefKey key, T value,
|
||||
Future<bool> Function(AccountPrefKey key, T value) setFn) async {
|
||||
if (await setFn(key, value)) {
|
||||
KiwiContainer()
|
||||
.resolve<EventBus>()
|
||||
.fire(AccountPrefUpdatedEvent(this, key, value));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Future<bool> Function(AccountPrefKey key, T value) setFn) =>
|
||||
setFn(key, value);
|
||||
|
||||
Future<bool> _remove(AccountPrefKey key) => provider.remove(key);
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ class AppEventListener<T> {
|
|||
final _log = Logger("event.event.AppEventListener<${T.runtimeType}>");
|
||||
}
|
||||
|
||||
@Deprecated("not fired anymore, to be removed")
|
||||
class AccountPrefUpdatedEvent {
|
||||
const AccountPrefUpdatedEvent(this.pref, this.key, this.value);
|
||||
|
||||
|
@ -116,6 +117,7 @@ class MetadataTaskStateChangedEvent {
|
|||
final MetadataTaskState state;
|
||||
}
|
||||
|
||||
@Deprecated("not fired anymore, to be removed")
|
||||
class PrefUpdatedEvent {
|
||||
PrefUpdatedEvent(this.key, this.value);
|
||||
|
||||
|
|
Loading…
Reference in a new issue