[Store] give notification idenitifier

This commit is contained in:
Marcel 2019-07-18 19:46:36 +02:00
parent 584bd92f7d
commit 0bf241c265
No known key found for this signature in database
GPG key ID: B5E03B5BF119B26C

View file

@ -55,7 +55,7 @@ class Store {
_init() async { _init() async {
var databasePath = await getDatabasesPath(); var databasePath = await getDatabasesPath();
String path = p.join(databasePath, "FluffyMatrix.db"); String path = p.join(databasePath, "FluffyMatrix.db");
_db = await openDatabase(path, version: 5, _db = await openDatabase(path, version: 7,
onCreate: (Database db, int version) async { onCreate: (Database db, int version) async {
await createTables(db); await createTables(db);
}, onUpgrade: (Database db, int oldVersion, int newVersion) async { }, onUpgrade: (Database db, int oldVersion, int newVersion) async {
@ -627,8 +627,8 @@ class Store {
return; return;
} }
Future addNotification(String roomID, String event_id) async { Future addNotification(String roomID, String event_id, int uniqueID) async {
await db.rawInsert("INSERT INTO NotificationsCache VALUES (?,?)", [roomID, event_id]); await db.rawInsert("INSERT INTO NotificationsCache VALUES (?, ?,?)", [uniqueID, roomID, event_id]);
return; return;
} }
@ -717,6 +717,7 @@ class Store {
/// The database scheme for the NotificationsCache class. /// The database scheme for the NotificationsCache class.
static final String NotificationsCache = 'CREATE TABLE IF NOT EXISTS NotificationsCache(' + static final String NotificationsCache = 'CREATE TABLE IF NOT EXISTS NotificationsCache(' +
'id int PRIMARY KEY'
'chat_id TEXT, ' + // The chat id 'chat_id TEXT, ' + // The chat id
'event_id TEXT, ' + // The matrix id of the Event 'event_id TEXT, ' + // The matrix id of the Event
'UNIQUE(event_id))'; 'UNIQUE(event_id))';