Compare commits

...

2 Commits

3 changed files with 18 additions and 18 deletions

View File

@ -264,7 +264,7 @@ class DatabaseService {
/// Loads all conversations from the database and adds them to the state and cache. /// Loads all conversations from the database and adds them to the state and cache.
Future<List<Conversation>> loadConversations() async { Future<List<Conversation>> loadConversations() async {
final conversationsRaw = await _db.query( final conversationsRaw = await _db.query(
'Conversations', conversationsTable,
orderBy: 'lastChangeTimestamp DESC', orderBy: 'lastChangeTimestamp DESC',
); );
@ -272,7 +272,7 @@ class DatabaseService {
for (final c in conversationsRaw) { for (final c in conversationsRaw) {
final jid = c['jid']! as String; final jid = c['jid']! as String;
final sharedMediaRaw = await _db.query( final sharedMediaRaw = await _db.query(
'SharedMedia', mediaTable,
where: 'conversation_jid = ?', where: 'conversation_jid = ?',
whereArgs: [jid], whereArgs: [jid],
orderBy: 'timestamp DESC', orderBy: 'timestamp DESC',
@ -306,7 +306,7 @@ class DatabaseService {
/// Load messages for [jid] from the database. /// Load messages for [jid] from the database.
Future<List<Message>> loadMessagesForJid(String jid) async { Future<List<Message>> loadMessagesForJid(String jid) async {
final rawMessages = await _db.query( final rawMessages = await _db.query(
'Messages', messagesTable,
where: 'conversationJid = ?', where: 'conversationJid = ?',
whereArgs: [jid], whereArgs: [jid],
orderBy: 'timestamp ASC', orderBy: 'timestamp ASC',
@ -317,7 +317,7 @@ class DatabaseService {
Message? quotes; Message? quotes;
if (m['quote_id'] != null) { if (m['quote_id'] != null) {
final rawQuote = (await _db.query( final rawQuote = (await _db.query(
'Messages', messagesTable,
where: 'conversationJid = ? AND id = ?', where: 'conversationJid = ? AND id = ?',
whereArgs: [jid, m['quote_id']! as int], whereArgs: [jid, m['quote_id']! as int],
)) ))
@ -345,7 +345,7 @@ class DatabaseService {
: 'conversationJid = ?'; : 'conversationJid = ?';
final args = oldestTimestamp != null ? [jid, oldestTimestamp] : [jid]; final args = oldestTimestamp != null ? [jid, oldestTimestamp] : [jid];
final rawMessages = await _db.query( final rawMessages = await _db.query(
'Messages', messagesTable,
where: query, where: query,
whereArgs: args, whereArgs: args,
orderBy: 'timestamp DESC', orderBy: 'timestamp DESC',
@ -357,7 +357,7 @@ class DatabaseService {
Message? quotes; Message? quotes;
if (m['quote_id'] != null) { if (m['quote_id'] != null) {
final rawQuote = (await _db.query( final rawQuote = (await _db.query(
'Messages', messagesTable,
where: 'conversationJid = ? AND id = ?', where: 'conversationJid = ? AND id = ?',
whereArgs: [jid, m['quote_id']! as int], whereArgs: [jid, m['quote_id']! as int],
)) ))
@ -453,7 +453,7 @@ class DatabaseService {
// TODO(Unknown): Maybe either don't do this or do this only when we need to. // TODO(Unknown): Maybe either don't do this or do this only when we need to.
final sharedMedia = (await _db.query( final sharedMedia = (await _db.query(
'SharedMedia', mediaTable,
where: 'conversation_jid = ?', where: 'conversation_jid = ?',
whereArgs: [jid], whereArgs: [jid],
orderBy: 'timestamp DESC', orderBy: 'timestamp DESC',
@ -513,7 +513,7 @@ class DatabaseService {
contactDisplayName: contactDisplayName, contactDisplayName: contactDisplayName,
); );
await _db.insert('Conversations', conversation.toDatabaseJson()); await _db.insert(conversationsTable, conversation.toDatabaseJson());
return conversation; return conversation;
} }
@ -535,7 +535,7 @@ class DatabaseService {
); );
return s.copyWith( return s.copyWith(
id: await _db.insert('SharedMedia', s.toDatabaseJson()), id: await _db.insert(mediaTable, s.toDatabaseJson()),
); );
} }
@ -634,13 +634,13 @@ class DatabaseService {
} }
return m.copyWith( return m.copyWith(
id: await _db.insert('Messages', m.toDatabaseJson()), id: await _db.insert(messagesTable, m.toDatabaseJson()),
); );
} }
Future<Message?> getMessageById(int id, String conversationJid) async { Future<Message?> getMessageById(int id, String conversationJid) async {
final messagesRaw = await _db.query( final messagesRaw = await _db.query(
'Messages', messagesTable,
where: 'id = ? AND conversationJid = ?', where: 'id = ? AND conversationJid = ?',
whereArgs: [id, conversationJid], whereArgs: [id, conversationJid],
limit: 1, limit: 1,
@ -660,7 +660,7 @@ class DatabaseService {
}) async { }) async {
final idQuery = includeOriginId ? '(sid = ? OR originId = ?)' : 'sid = ?'; final idQuery = includeOriginId ? '(sid = ? OR originId = ?)' : 'sid = ?';
final messagesRaw = await _db.query( final messagesRaw = await _db.query(
'Messages', messagesTable,
where: 'conversationJid = ? AND $idQuery', where: 'conversationJid = ? AND $idQuery',
whereArgs: whereArgs:
includeOriginId ? [conversationJid, id, id] : [conversationJid, id], includeOriginId ? [conversationJid, id, id] : [conversationJid, id],
@ -679,7 +679,7 @@ class DatabaseService {
String conversationJid, String conversationJid,
) async { ) async {
final messagesRaw = await _db.query( final messagesRaw = await _db.query(
'Messages', messagesTable,
where: 'conversationJid = ? AND originId = ?', where: 'conversationJid = ? AND originId = ?',
whereArgs: [conversationJid, id], whereArgs: [conversationJid, id],
limit: 1, limit: 1,
@ -822,7 +822,7 @@ class DatabaseService {
/// Loads roster items from the database /// Loads roster items from the database
Future<List<RosterItem>> loadRosterItems() async { Future<List<RosterItem>> loadRosterItems() async {
final items = await _db.query('RosterItems'); final items = await _db.query(rosterTable);
return items.map(RosterItem.fromDatabaseJson).toList(); return items.map(RosterItem.fromDatabaseJson).toList();
} }
@ -830,7 +830,7 @@ class DatabaseService {
/// Removes a roster item from the database and cache /// Removes a roster item from the database and cache
Future<void> removeRosterItem(int id) async { Future<void> removeRosterItem(int id) async {
await _db.delete( await _db.delete(
'RosterItems', rosterTable,
where: 'id = ?', where: 'id = ?',
whereArgs: [id], whereArgs: [id],
); );
@ -867,7 +867,7 @@ class DatabaseService {
); );
return i.copyWith( return i.copyWith(
id: await _db.insert('RosterItems', i.toDatabaseJson()), id: await _db.insert(rosterTable, i.toDatabaseJson()),
); );
} }

View File

@ -949,7 +949,7 @@ packages:
description: description:
path: "packages/moxxmpp" path: "packages/moxxmpp"
ref: HEAD ref: HEAD
resolved-ref: a8693da2629da00b35888694b8ea6570a25f135a resolved-ref: "09b8613c803ea0887043ee6df91f9731cc01ca31"
url: "https://codeberg.org/moxxy/moxxmpp.git" url: "https://codeberg.org/moxxy/moxxmpp.git"
source: git source: git
version: "0.3.2" version: "0.3.2"

View File

@ -146,7 +146,7 @@ dependency_overrides:
moxxmpp: moxxmpp:
git: git:
url: https://codeberg.org/moxxy/moxxmpp.git url: https://codeberg.org/moxxy/moxxmpp.git
rev: a8693da2629da00b35888694b8ea6570a25f135a rev: 09b8613c803ea0887043ee6df91f9731cc01ca31
path: packages/moxxmpp path: packages/moxxmpp
extra_licenses: extra_licenses: