init method
- required dynamic onUserDeleted(),
- required dynamic onPasswordUpdated(),
override
Initializes the repository.
Callback onUserDeleted
should be called when myUser is deleted.
Callback onPasswordUpdated
should be called when myUser's password
is updated.
Implementation
@override
Future<void> init({
required Function() onUserDeleted,
required Function() onPasswordUpdated,
}) async {
Log.debug('init(onUserDeleted, onPasswordUpdated)', '$runtimeType');
this.onPasswordUpdated = onPasswordUpdated;
this.onUserDeleted = onUserDeleted;
_active.then((v) => myUser.value = v?.value ?? myUser.value);
_initProfiles();
_initLocalSubscription();
_initRemoteSubscription();
if (PlatformUtils.isDesktop || await PlatformUtils.isFocused) {
_initKeepOnlineSubscription();
}
if (!PlatformUtils.isDesktop) {
_onFocusChanged = PlatformUtils.onFocusChanged.listen((focused) {
if (focused) {
if (_keepOnlineSubscription == null) {
_initKeepOnlineSubscription();
}
} else {
_keepOnlineSubscription?.cancel(immediate: true);
_keepOnlineSubscription = null;
}
});
}
}