From d6d064b804228e065ef58f0c7b0c7af01522f618 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 10:48:31 -0800 Subject: [PATCH 1/6] Fix Crash Bug in Android (ShareFile and Reconnect) In rare situtaitons (exacerbated by debug mode and multiple file shares in succession) ReconnectCwtchForeground events can result in negative message counts being calculated in the UI. This fix ensures that doesn't happen, but a complete fix will need to wait until #664 is implement in the backend --- lib/models/contact.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/models/contact.dart b/lib/models/contact.dart index 2dfae7f2..81b261d0 100644 --- a/lib/models/contact.dart +++ b/lib/models/contact.dart @@ -233,6 +233,7 @@ class ContactInfoState extends ChangeNotifier { return this._newMarkerMsgIndex; } + int get totalMessages => this._totalMessages; int get totalMessages => this._totalMessages; set totalMessages(int newVal) { From 1d70adb59557ec796b3da184cb355930c0a636f4 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 10:53:15 -0800 Subject: [PATCH 2/6] Formatting --- lib/models/contact.dart | 1 - lib/themes/yamltheme.dart | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/models/contact.dart b/lib/models/contact.dart index 81b261d0..2dfae7f2 100644 --- a/lib/models/contact.dart +++ b/lib/models/contact.dart @@ -233,7 +233,6 @@ class ContactInfoState extends ChangeNotifier { return this._newMarkerMsgIndex; } - int get totalMessages => this._totalMessages; int get totalMessages => this._totalMessages; set totalMessages(int newVal) { diff --git a/lib/themes/yamltheme.dart b/lib/themes/yamltheme.dart index 7af7dc9e..3171f9ca 100644 --- a/lib/themes/yamltheme.dart +++ b/lib/themes/yamltheme.dart @@ -139,6 +139,7 @@ class YmlTheme extends OpaqueThemeType { get chatImage => getImage("chatImage") ?? fallbackTheme.chatImage; + ImageProvider loadImage(String key) { File f = File(key); if (f.existsSync()) { @@ -147,5 +148,4 @@ class YmlTheme extends OpaqueThemeType { return AssetImage(key); } } - } From 856ed3ef64df59c7426338762ec0f23f5aed4bce Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 3 Jan 2024 10:18:16 -0800 Subject: [PATCH 3/6] Upgrade Cwtch, Add Per-Profile Event Log --- lib/views/peersettingsview.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/views/peersettingsview.dart b/lib/views/peersettingsview.dart index ff307427..5093333b 100644 --- a/lib/views/peersettingsview.dart +++ b/lib/views/peersettingsview.dart @@ -329,6 +329,7 @@ class _PeerSettingsViewState extends State { )) ]), ]), + Visibility( visible: EnvironmentConfig.BUILD_VER == dev_version, maintainSize: false, From cc8227d228dcea4282c1368e915e6dc78020ece0 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 3 Jan 2024 10:27:52 -0800 Subject: [PATCH 4/6] Hide Ev-Log When Not Devmode --- lib/views/peersettingsview.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/views/peersettingsview.dart b/lib/views/peersettingsview.dart index 5093333b..ff307427 100644 --- a/lib/views/peersettingsview.dart +++ b/lib/views/peersettingsview.dart @@ -329,7 +329,6 @@ class _PeerSettingsViewState extends State { )) ]), ]), - Visibility( visible: EnvironmentConfig.BUILD_VER == dev_version, maintainSize: false, From abd7fe7415350569f50ca88dc27e66c48056eaf4 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Thu, 4 Jan 2024 11:52:02 -0800 Subject: [PATCH 5/6] Improve Logic for Handelling Interrupted Downloads Move logic into FileDownloadProgress model, simplify to the lastUpdated cases which abstracts over the requested case. --- lib/models/filedownloadprogress.dart | 14 ++++++++++++-- lib/models/profile.dart | 13 ------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/lib/models/filedownloadprogress.dart b/lib/models/filedownloadprogress.dart index 52542206..6b0a1935 100644 --- a/lib/models/filedownloadprogress.dart +++ b/lib/models/filedownloadprogress.dart @@ -3,12 +3,22 @@ class FileDownloadProgress { int chunksTotal = 1; bool complete = false; bool gotManifest = false; - bool interrupted = false; + bool _interrupted = false; + + // we keep track of both an explicit interrupt flag (for when a request fails or is explicitly cancelled) + set interrupted(isInterrupted) { + this._interrupted = isInterrupted; + } + + // but we have a fuzzy get which depends on lastUpdate, if the file isn't complete, but the last update was more + // that 30 seconds ago, we consider this download as failed. + get interrupted => _interrupted || (DateTime.now().difference(lastUpdate).abs().inSeconds > 30 && !complete); + String? downloadedTo; DateTime? timeStart; DateTime? timeEnd; DateTime? requested; - DateTime lastUpdate = DateTime.now(); + DateTime lastUpdate = DateTime.fromMillisecondsSinceEpoch(0); FileDownloadProgress(this.chunksTotal, this.timeStart); diff --git a/lib/models/profile.dart b/lib/models/profile.dart index a1e62ac3..746bcad4 100644 --- a/lib/models/profile.dart +++ b/lib/models/profile.dart @@ -383,19 +383,6 @@ class ProfileInfoState extends ChangeNotifier { if (this._downloads[fileKey]!.interrupted) { return true; } - - if (this._downloads[fileKey]!.requested != null) { - if (DateTime.now().difference(this._downloads[fileKey]!.requested!) > Duration(minutes: 1)) { - this._downloads[fileKey]!.requested = null; - this._downloads[fileKey]!.interrupted = true; - return true; - } - if (DateTime.now().difference(this._downloads[fileKey]!.lastUpdate) > Duration(minutes: 1)) { - this._downloads[fileKey]!.requested = null; - this._downloads[fileKey]!.interrupted = true; - return true; - } - } } return false; } From e360a71d5946bab605082aaff2b56103f40dedc7 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Thu, 4 Jan 2024 12:15:50 -0800 Subject: [PATCH 6/6] Add chatReactionColor to Juniper Theme --- assets/themes/juniper/theme.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/assets/themes/juniper/theme.yml b/assets/themes/juniper/theme.yml index db950c97..19d7c91c 100644 --- a/assets/themes/juniper/theme.yml +++ b/assets/themes/juniper/theme.yml @@ -12,19 +12,19 @@ themes: font: 0xFFFFFF settings: 0xFFFDFF accent: 0x9E6A56 - accentAlt: 0x845A48 + accentAlt: 0x9E6A56 theme: - backgroundMainColor: background # darkGreyPurple - backgroundPaneColor: header # darkGreyPurple - topbarColor: header # darkGreyPurple - mainTextColor: font # whiteishPurple - defaultButtonColor: accent # hotPink - textfieldHintColor: mainTextColor # TODO pick - toolbarIconColor: settings # whiteishPurple - messageFromMeBackgroundColor: userBubble # mauvePurple - messageFromMeTextColor: font # whiteishPurple - messageFromOtherBackgroundColor: peerBubble # deepPurple - messageFromOtherTextColor: font # whiteishPurple + backgroundMainColor: background + backgroundPaneColor: header + topbarColor: header + mainTextColor: font + defaultButtonColor: accent + textfieldHintColor: mainTextColor + toolbarIconColor: settings + messageFromMeBackgroundColor: userBubble + messageFromMeTextColor: font + messageFromOtherBackgroundColor: peerBubble + messageFromOtherTextColor: font textfieldBackgroundColor: peerBubble textfieldBorderColor: userBubble backgroundHilightElementColor: accent @@ -45,3 +45,4 @@ themes: portraitProfileBadgeColor: accent portraitProfileBadgeTextColor: mainTextColor dropShadowColor: accentAlt + chatReactionIconColor: accentAlt \ No newline at end of file