банеры

This commit is contained in:
Jganenokk
2026-07-27 23:36:50 +07:00
parent 9e579f45cf
commit d7e6491213
11 changed files with 583 additions and 16 deletions
+1
View File
@@ -120,6 +120,7 @@ class BannersModule {
}
Future<void> markShown(InformerBanner banner) async {
if (_pinnedId == banner.id) return;
final now = DateTime.now().millisecondsSinceEpoch;
final current = stateOf(banner.id);
_showState[banner.id] = current.copyWith(
+8 -3
View File
@@ -1161,12 +1161,14 @@ class ChatsModule {
final cachedAt = DateTime.now().millisecondsSinceEpoch;
final id = chat['id'];
Map<int, CachedChat> existing = const {};
Map<String, dynamic>? existingRow;
if (preloadedExisting != null) {
existing = preloadedExisting;
} else if (id is int) {
final rows = await AppDatabase.loadChat(accountId, id);
if (rows.isNotEmpty) {
existing = {id: CachedChat.fromDbRow(rows.first)};
existingRow = rows.first;
existing = {id: CachedChat.fromDbRow(existingRow)};
}
}
final parsed = parseChatRow(
@@ -1184,11 +1186,14 @@ class ChatsModule {
return null;
}
final ex = existing[parsed.id];
if (ex != null && sameChatContent(ex, parsed)) {
final listState = !inList ? 0 : (chat['status'] == 'HIDDEN' ? 2 : 1);
final membershipUnchanged =
existingRow == null || existingRow['in_list'] == listState;
if (ex != null && sameChatContent(ex, parsed) && membershipUnchanged) {
return parsed;
}
final row = parsed.toDbRow();
row['in_list'] = !inList ? 0 : (chat['status'] == 'HIDDEN' ? 2 : 1);
row['in_list'] = listState;
await AppDatabase.saveChats([row]);
_bump();
return parsed;