forgetRoom method

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

Implementation

@override
Future<void> forgetRoom(String roomId) => transaction(() 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 roomStateBoxKeys = await _roomStateBox.getAllKeys();
      for (final key in roomStateBoxKeys) {
        final multiKey = TupleKey.fromString(key);
        if (multiKey.parts.first != roomId) continue;
        await _roomStateBox.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);
    });