From a407a3fbea6958ec4b0e713fa65a7771565a91e7 Mon Sep 17 00:00:00 2001 From: otsmr Date: Thu, 27 Mar 2025 17:56:48 +0100 Subject: [PATCH] fix #64 --- lib/src/app.dart | 1 + lib/src/database/twonly_database.dart | 5 +++++ lib/src/providers/api_provider.dart | 2 ++ 3 files changed, 8 insertions(+) diff --git a/lib/src/app.dart b/lib/src/app.dart index 9f657b3..be49485 100644 --- a/lib/src/app.dart +++ b/lib/src/app.dart @@ -99,6 +99,7 @@ class _MyAppState extends State with WidgetsBindingObserver { if (state == AppLifecycleState.resumed) { if (wasPaused) { globalIsAppInBackground = false; + twonlyDatabase.markUpdated(); apiProvider.connect(); // _stopService(); } diff --git a/lib/src/database/twonly_database.dart b/lib/src/database/twonly_database.dart index 51ed17b..2be3c02 100644 --- a/lib/src/database/twonly_database.dart +++ b/lib/src/database/twonly_database.dart @@ -39,4 +39,9 @@ class TwonlyDatabase extends _$TwonlyDatabase { ), ); } + + void markUpdated() { + notifyUpdates({TableUpdate.onTable(messages, kind: UpdateKind.update)}); + notifyUpdates({TableUpdate.onTable(contacts, kind: UpdateKind.update)}); + } } diff --git a/lib/src/providers/api_provider.dart b/lib/src/providers/api_provider.dart index 64ff91f..c36d1ad 100644 --- a/lib/src/providers/api_provider.dart +++ b/lib/src/providers/api_provider.dart @@ -5,6 +5,7 @@ import 'dart:math'; import 'package:fixnum/fixnum.dart'; import 'package:flutter/foundation.dart'; import 'package:logging/logging.dart'; +import 'package:twonly/globals.dart'; import 'package:twonly/src/app.dart'; import 'package:twonly/src/proto/api/client_to_server.pbserver.dart'; import 'package:twonly/src/proto/api/error.pb.dart'; @@ -77,6 +78,7 @@ class ApiProvider { retransmitMediaFiles(); tryDownloadAllMediaFiles(); notifyContactsAboutProfileChange(); + twonlyDatabase.markUpdated(); } }