init method
override
Initializes this repository.
Callback onMemberRemoved
should be called once an User is removed from
a Chat.
Implementation
@override
Future<void> init({
required Future<void> Function(ChatId, UserId) onMemberRemoved,
}) async {
Log.debug('init(onMemberRemoved)', '$runtimeType');
this.onMemberRemoved = onMemberRemoved;
status.value = RxStatus.loading();
// Popup shouldn't listen to recent chats remote updates, as it's happening
// inside single [Chat].
if (!WebUtils.isPopup) {
_initRemoteSubscription();
_initFavoriteSubscription();
_initRemotePagination();
_paginatedSubscription = paginated.changes.listen((e) {
switch (e.op) {
case OperationKind.added:
_subscriptions[e.key!] = e.value!.updates.listen((_) {});
break;
case OperationKind.updated:
if (e.oldKey != e.key) {
final StreamSubscription? subscription = _subscriptions[e.oldKey];
if (subscription != null) {
_subscriptions[e.key!] = subscription;
_subscriptions.remove(e.oldKey);
}
}
break;
case OperationKind.removed:
_subscriptions.remove(e.key!)?.cancel();
break;
}
});
_initLocalPagination();
}
_monologLocal.read(me).then((v) => monolog = v ?? monolog);
}