changeContactName method
- ChatContactId id,
- UserName name
override
Updates name
of the specified ChatContact in the authenticated
MyUser's address book.
Implementation
@override
Future<void> changeContactName(ChatContactId id, UserName name) async {
Log.debug('changeContactName($id, $name)', '$runtimeType');
final RxChatContactImpl? contact = paginated[id];
final UserName? oldName = contact?.contact.value.name;
contact?.contact.update((c) => c?.name = name);
_emit(MapChangeNotification.updated(contact?.id, contact?.id, contact));
try {
await _graphQlProvider.changeContactName(id, name);
} catch (_) {
contact?.contact.update((c) => c?.name = oldName!);
_emit(MapChangeNotification.updated(contact?.id, contact?.id, contact));
rethrow;
}
}