ensureRemoteDialog method
- ChatId chatId
Ensures the provided Chat is remotely accessible.
Implementation
Future<RxChatImpl?> ensureRemoteDialog(ChatId chatId) async {
Log.debug('ensureRemoteDialog($chatId)', '$runtimeType');
if (chatId.isLocal) {
if (chatId.isLocalWith(me)) {
return await ensureRemoteMonolog();
}
try {
final ChatData chat = _chat(
await _graphQlProvider.createDialogChat(chatId.userId),
);
return _putEntry(chat);
} on CreateDialogException catch (e) {
switch (e.code) {
case CreateDialogChatErrorCode.artemisUnknown:
case CreateDialogChatErrorCode.blocked:
rethrow;
case CreateDialogChatErrorCode.unknownUser:
return null;
case CreateDialogChatErrorCode.useMonolog:
// No-op, should be retrieved via [get] below.
break;
}
}
}
return await get(chatId);
}