forgetRoom method

  1. @override
Future<void> forgetRoom(
  1. String roomId
)
override

Implementation

@override
Future<void> forgetRoom(String roomId) async {
  await _timelineFragmentsBox.delete(TupleKey(roomId, '').toString());
  final eventsBoxKeys = await _eventsBox.getAllKeys();
  for (final key in eventsBoxKeys) {
    final multiKey = TupleKey.fromString(key);
    if (multiKey.parts.first != roomId) continue;
    await _eventsBox.delete(key);
  }
  final preloadRoomStateBoxKeys = await _preloadRoomStateBox.getAllKeys();
  for (final key in preloadRoomStateBoxKeys) {
    final multiKey = TupleKey.fromString(key);
    if (multiKey.parts.first != roomId) continue;
    await _preloadRoomStateBox.delete(key);
  }
  final nonPreloadRoomStateBoxKeys =
      await _nonPreloadRoomStateBox.getAllKeys();
  for (final key in nonPreloadRoomStateBoxKeys) {
    final multiKey = TupleKey.fromString(key);
    if (multiKey.parts.first != roomId) continue;
    await _nonPreloadRoomStateBox.delete(key);
  }
  final roomMembersBoxKeys = await _roomMembersBox.getAllKeys();
  for (final key in roomMembersBoxKeys) {
    final multiKey = TupleKey.fromString(key);
    if (multiKey.parts.first != roomId) continue;
    await _roomMembersBox.delete(key);
  }
  final roomAccountDataBoxKeys = await _roomAccountDataBox.getAllKeys();
  for (final key in roomAccountDataBoxKeys) {
    final multiKey = TupleKey.fromString(key);
    if (multiKey.parts.first != roomId) continue;
    await _roomAccountDataBox.delete(key);
  }
  await _roomsBox.delete(roomId);
}