ensureRemoteMonolog method

Future<RxChatImpl> ensureRemoteMonolog({
  1. ChatName? name,
  2. bool? isHidden,
})

Ensures the provided Chat-monolog is remotely accessible.

Implementation

Future<RxChatImpl> ensureRemoteMonolog({
  ChatName? name,
  bool? isHidden,
}) async {
  Log.debug('ensureRemoteMonolog($name)', '$runtimeType');

  final ChatData chatData = _chat(
    await Backoff.run(
      () async {
        return await _graphQlProvider.createMonologChat(name: name);
      },
      retryIf: (e) => e.isNetworkRelated,
      retries: 10,
    ),
  );
  final RxChatImpl chat = await _putEntry(chatData);

  if (!isClosed) {
    await _monologLocal.upsert(me, monolog = chat.id);
  }

  return chat;
}