Add removing of forgotten rooms

This commit is contained in:
Christian Pauly 2019-06-12 13:22:16 +02:00
parent 9bd377c4be
commit b3bb4e6531
2 changed files with 6 additions and 0 deletions

View file

@ -233,6 +233,7 @@ class Room {
/// Call the Matrix API to forget this room if you already left it. /// Call the Matrix API to forget this room if you already left it.
Future<dynamic> forget() async { Future<dynamic> forget() async {
client.store.forgetRoom(id);
dynamic res = await client.connection dynamic res = await client.connection
.jsonRequest(type: "POST", action: "/client/r0/rooms/${id}/forget"); .jsonRequest(type: "POST", action: "/client/r0/rooms/${id}/forget");
if (res is ErrorResponse) client.connection.onError.add(res); if (res is ErrorResponse) client.connection.onError.add(res);

View file

@ -576,6 +576,11 @@ class Store {
return directChats; return directChats;
} }
Future<void> forgetRoom(String roomID) async {
await db.rawDelete("DELETE FROM Rooms WHERE id=?", [roomID]);
return;
}
/// The database sheme for the Client class. /// The database sheme for the Client class.
static final String ClientsScheme = 'CREATE TABLE IF NOT EXISTS Clients(' + static final String ClientsScheme = 'CREATE TABLE IF NOT EXISTS Clients(' +
'client TEXT PRIMARY KEY, ' + 'client TEXT PRIMARY KEY, ' +