From 3d4ddeaa4080e669b223c4832cac31ae86e5a223 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sun, 7 Apr 2024 14:37:22 +0200 Subject: [PATCH 01/20] build: Update record package --- lib/pages/chat/chat.dart | 2 +- lib/pages/chat/recording_dialog.dart | 18 ++++++--- macos/Flutter/GeneratedPluginRegistrant.swift | 4 +- pubspec.lock | 40 +++++++++++-------- pubspec.yaml | 2 +- 5 files changed, 40 insertions(+), 26 deletions(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 8b4c2b5b8..2872f9b17 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -610,7 +610,7 @@ class ChatController extends State } } - if (await Record().hasPermission() == false) return; + if (await AudioRecorder().hasPermission() == false) return; final result = await showDialog( context: context, barrierDismissible: false, diff --git a/lib/pages/chat/recording_dialog.dart b/lib/pages/chat/recording_dialog.dart index 300d5d9b0..bc92f3ff5 100644 --- a/lib/pages/chat/recording_dialog.dart +++ b/lib/pages/chat/recording_dialog.dart @@ -28,16 +28,16 @@ class RecordingDialogState extends State { bool error = false; String? _recordedPath; - final _audioRecorder = Record(); + final _audioRecorder = AudioRecorder(); final List amplitudeTimeline = []; static const int bitRate = 64000; - static const int samplingRate = 22050; + static const int samplingRate = 44100; Future startRecording() async { try { final tempDir = await getTemporaryDirectory(); - _recordedPath = + final path = _recordedPath = '${tempDir.path}/recording${DateTime.now().microsecondsSinceEpoch}.${RecordingDialog.recordingFileType}'; final result = await _audioRecorder.hasPermission(); @@ -47,9 +47,15 @@ class RecordingDialogState extends State { } await WakelockPlus.enable(); await _audioRecorder.start( - path: _recordedPath, - bitRate: bitRate, - samplingRate: samplingRate, + const RecordConfig( + bitRate: bitRate, + sampleRate: samplingRate, + numChannels: 1, + autoGain: true, + echoCancel: true, + noiseSuppress: true, + ), + path: path, ); setState(() => _duration = Duration.zero); _recorderSubscription?.cancel(); diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index ac604e584..50894732e 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -24,7 +24,7 @@ import macos_window_utils import package_info_plus import pasteboard import path_provider_foundation -import record_macos +import record_darwin import share_plus import shared_preferences_foundation import sqflite @@ -55,7 +55,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) - RecordMacosPlugin.register(with: registry.registrar(forPlugin: "RecordMacosPlugin")) + RecordPlugin.register(with: registry.registrar(forPlugin: "RecordPlugin")) SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) diff --git a/pubspec.lock b/pubspec.lock index d3c9cad78..593949699 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1618,50 +1618,58 @@ packages: dependency: "direct main" description: name: record - sha256: f703397f5a60d9b2b655b3acc94ba079b2d9a67dc0725bdb90ef2fee2441ebf7 + sha256: "113b368168c49c78902ab37c2b354dea30a0aec5bdeca434073826b6ea73eca1" url: "https://pub.dev" source: hosted - version: "4.4.4" - record_linux: + version: "5.0.5" + record_android: dependency: transitive description: - name: record_linux - sha256: "348db92c4ec1b67b1b85d791381c8c99d7c6908de141e7c9edc20dad399b15ce" + name: record_android + sha256: "0df98e05873b22b443309e289bf1eb3b5b9a60e7779134334e2073eb0763a992" url: "https://pub.dev" source: hosted - version: "0.4.1" - record_macos: + version: "1.1.0" + record_darwin: + dependency: transitive + description: + name: record_darwin + sha256: ee8cb1bb1712d7ce38140ecabe70e5c286c02f05296d66043bee865ace7eb1b9 + url: "https://pub.dev" + source: hosted + version: "1.0.1" + record_linux: dependency: transitive description: - name: record_macos - sha256: d1d0199d1395f05e218207e8cacd03eb9dc9e256ddfe2cfcbbb90e8edea06057 + name: record_linux + sha256: "7d0e70cd51635128fe9d37d89bafd6011d7cbba9af8dc323079ae60f23546aef" url: "https://pub.dev" source: hosted - version: "0.2.2" + version: "0.7.1" record_platform_interface: dependency: transitive description: name: record_platform_interface - sha256: "7a2d4ce7ac3752505157e416e4e0d666a54b1d5d8601701b7e7e5e30bec181b4" + sha256: "3a4b56e94ecd2a0b2b43eb1fa6f94c5b8484334f5d38ef43959c4bf97fb374cf" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "1.0.2" record_web: dependency: transitive description: name: record_web - sha256: "219ffb4ca59b4338117857db56d3ffadbde3169bcaf1136f5f4d4656f4a2372d" + sha256: "24847cdbcf999f7a5762170792f622ac844858766becd0f2370ec8ae22f7526e" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "1.0.5" record_windows: dependency: transitive description: name: record_windows - sha256: "42d545155a26b20d74f5107648dbb3382dbbc84dc3f1adc767040359e57a1345" + sha256: "39998b3ea7d8d28b04159d82220e6e5e32a7c357c6fb2794f5736beea272f6c3" url: "https://pub.dev" source: hosted - version: "0.7.1" + version: "1.0.2" remove_emoji: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 9f23b88e8..c13e6c175 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -76,7 +76,7 @@ dependencies: punycode: ^1.0.0 qr_code_scanner: ^1.0.1 receive_sharing_intent: 1.4.5 # Update needs more work - record: 4.4.4 # Upgrade to 5 currently breaks playing on iOS + record: ^5.0.5 scroll_to_index: ^3.0.1 share_plus: ^9.0.0 shared_preferences: ^2.2.0 # Pinned because https://github.com/flutter/flutter/issues/118401 From bf9f4764e6d15bd2bbf9e186a96dabc741655090 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 May 2024 20:50:51 +0000 Subject: [PATCH 02/20] build(deps): bump rexml from 3.2.5 to 3.2.8 in /ios Bumps [rexml](https://github.com/ruby/rexml) from 3.2.5 to 3.2.8. - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.2.5...v3.2.8) --- updated-dependencies: - dependency-name: rexml dependency-type: indirect ... Signed-off-by: dependabot[bot] --- ios/Gemfile.lock | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ios/Gemfile.lock b/ios/Gemfile.lock index b6731f0dc..aaaffc7b4 100644 --- a/ios/Gemfile.lock +++ b/ios/Gemfile.lock @@ -156,7 +156,8 @@ GEM trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.2.5) + rexml (3.2.8) + strscan (>= 3.0.9) rouge (2.0.7) ruby2_keywords (0.0.4) rubyzip (2.3.0) @@ -169,6 +170,7 @@ GEM simctl (1.6.8) CFPropertyList naturally + strscan (3.1.0) terminal-notifier (2.0.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) From fb1059b1a3cb881a3d07089fef0319815a1fda84 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Fri, 17 May 2024 17:40:08 +0200 Subject: [PATCH 03/20] build: Use core24 for snapcraft --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 86b7eb241..d2e6c9e4a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: fluffychat title: FluffyChat -base: core22 +base: core24 version: git license: AGPL-3.0 summary: The cutest messenger in the Matrix network From 06b2e6c14fafb707ccd1f75b26504e74a7c65026 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Fri, 17 May 2024 17:46:44 +0200 Subject: [PATCH 04/20] Revert "build: Use core24 for snapcraft" This reverts commit fb1059b1a3cb881a3d07089fef0319815a1fda84. --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d2e6c9e4a..86b7eb241 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: fluffychat title: FluffyChat -base: core24 +base: core22 version: git license: AGPL-3.0 summary: The cutest messenger in the Matrix network From ff54610e5b471f50f8e40ee2e9658460de19652f Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sun, 19 May 2024 07:52:18 +0200 Subject: [PATCH 05/20] refactor: Use onRoomState stream instead of room.onUpdate to not update on messages but state changes only --- lib/pages/chat/chat_view.dart | 3 ++- lib/pages/chat_access_settings/chat_access_settings_page.dart | 3 ++- lib/pages/chat_details/chat_details_view.dart | 3 ++- .../chat_encryption_settings_view.dart | 3 ++- lib/pages/invitation_selection/invitation_selection_view.dart | 3 ++- .../settings_multiple_emotes_view.dart | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/pages/chat/chat_view.dart b/lib/pages/chat/chat_view.dart index 7dd303655..ae8ac4d9e 100644 --- a/lib/pages/chat/chat_view.dart +++ b/lib/pages/chat/chat_view.dart @@ -150,7 +150,8 @@ class ChatView extends StatelessWidget { } }, child: StreamBuilder( - stream: controller.room.onUpdate.stream + stream: controller.room.client.onRoomState.stream + .where((update) => update.roomId == controller.room.id) .rateLimit(const Duration(seconds: 1)), builder: (context, snapshot) => FutureBuilder( future: controller.loadTimelineFuture, diff --git a/lib/pages/chat_access_settings/chat_access_settings_page.dart b/lib/pages/chat_access_settings/chat_access_settings_page.dart index a0e2f8701..48d2d950c 100644 --- a/lib/pages/chat_access_settings/chat_access_settings_page.dart +++ b/lib/pages/chat_access_settings/chat_access_settings_page.dart @@ -22,7 +22,8 @@ class ChatAccessSettingsPageView extends StatelessWidget { ), body: MaxWidthBody( child: StreamBuilder( - stream: room.onUpdate.stream, + stream: room.client.onRoomState.stream + .where((update) => update.roomId == controller.room.id), builder: (context, snapshot) { final canonicalAlias = room.canonicalAlias; final altAliases = room diff --git a/lib/pages/chat_details/chat_details_view.dart b/lib/pages/chat_details/chat_details_view.dart index 9ff6af332..0c263355b 100644 --- a/lib/pages/chat_details/chat_details_view.dart +++ b/lib/pages/chat_details/chat_details_view.dart @@ -36,7 +36,8 @@ class ChatDetailsView extends StatelessWidget { } return StreamBuilder( - stream: room.onUpdate.stream, + stream: room.client.onRoomState.stream + .where((update) => update.roomId == room.id), builder: (context, snapshot) { var members = room.getParticipants().toList() ..sort((b, a) => a.powerLevel.compareTo(b.powerLevel)); diff --git a/lib/pages/chat_encryption_settings/chat_encryption_settings_view.dart b/lib/pages/chat_encryption_settings/chat_encryption_settings_view.dart index f7a19f966..d1be4e7d1 100644 --- a/lib/pages/chat_encryption_settings/chat_encryption_settings_view.dart +++ b/lib/pages/chat_encryption_settings/chat_encryption_settings_view.dart @@ -82,7 +82,8 @@ class ChatEncryptionSettingsView extends StatelessWidget { ), ), StreamBuilder( - stream: room.onUpdate.stream, + stream: room.client.onRoomState.stream + .where((update) => update.roomId == controller.room.id), builder: (context, snapshot) => FutureBuilder>( future: room.getUserDeviceKeys(), diff --git a/lib/pages/invitation_selection/invitation_selection_view.dart b/lib/pages/invitation_selection/invitation_selection_view.dart index 3efde2046..92596e894 100644 --- a/lib/pages/invitation_selection/invitation_selection_view.dart +++ b/lib/pages/invitation_selection/invitation_selection_view.dart @@ -64,7 +64,8 @@ class InvitationSelectionView extends StatelessWidget { ), ), StreamBuilder( - stream: room.onUpdate.stream, + stream: room.client.onRoomState.stream + .where((update) => update.roomId == room.id), builder: (context, snapshot) { final participants = room.getParticipants().map((user) => user.id).toSet(); diff --git a/lib/pages/settings_multiple_emotes/settings_multiple_emotes_view.dart b/lib/pages/settings_multiple_emotes/settings_multiple_emotes_view.dart index 939263fd3..5b910a8ba 100644 --- a/lib/pages/settings_multiple_emotes/settings_multiple_emotes_view.dart +++ b/lib/pages/settings_multiple_emotes/settings_multiple_emotes_view.dart @@ -21,7 +21,8 @@ class MultipleEmotesSettingsView extends StatelessWidget { title: Text(L10n.of(context)!.emotePacks), ), body: StreamBuilder( - stream: room.onUpdate.stream, + stream: room.client.onRoomState.stream + .where((update) => update.roomId == room.id), builder: (context, snapshot) { final packStateEvents = room.states['im.ponies.room_emotes']; // we need to manually convert the map using Map.of, otherwise assigning null will throw a type error. From 421bd245ae96f2820382b05c356f5f37862c0b9a Mon Sep 17 00:00:00 2001 From: krille-chan Date: Mon, 20 May 2024 08:45:51 +0200 Subject: [PATCH 06/20] build: Update dependencies to flutter 3.22 but not flutter version yet --- pubspec.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index f3eea933f..2d4f5c00a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1017,10 +1017,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" io: dependency: transitive description: @@ -1090,26 +1090,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" license_checker: dependency: "direct dev" description: @@ -1218,10 +1218,10 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" mgrs_dart: dependency: transitive description: @@ -1991,26 +1991,26 @@ packages: dependency: transitive description: name: test - sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f + sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073" url: "https://pub.dev" source: hosted - version: "1.24.9" + version: "1.25.2" test_api: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" test_core: dependency: transitive description: name: test_core - sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a + sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4" url: "https://pub.dev" source: hosted - version: "0.5.9" + version: "0.6.0" timezone: dependency: transitive description: @@ -2303,10 +2303,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" wakelock_plus: dependency: "direct main" description: From 6bd9997fe5dd9fcdc5a654eab68615ef172255e8 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Mon, 20 May 2024 11:32:43 +0200 Subject: [PATCH 07/20] build: Try out store inbound group sessions performance fix --- pubspec.lock | 9 +++++---- pubspec.yaml | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 2d4f5c00a..f61631576 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1209,10 +1209,11 @@ packages: matrix: dependency: "direct main" description: - name: matrix - sha256: "8610e6d207d6b667e4fe9e769d5b479db27aa1f80570880d3f171a5d3ff49d1a" - url: "https://pub.dev" - source: hosted + path: "." + ref: "krille/store-upload-inbound-sessions-in-que" + resolved-ref: "97d544ba85fe3f832f639c9e4662734f6b0e5bd6" + url: "https://github.com/famedly/matrix-dart-sdk.git" + source: git version: "0.29.2" meta: dependency: transitive diff --git a/pubspec.yaml b/pubspec.yaml index 417517831..8426edba5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,7 +64,10 @@ dependencies: keyboard_shortcuts: ^0.1.4 latlong2: ^0.9.1 linkify: ^5.0.0 - matrix: ^0.29.2 + matrix: + git: + url: https://github.com/famedly/matrix-dart-sdk.git + ref: krille/store-upload-inbound-sessions-in-que native_imaging: ^0.1.0 package_info_plus: ^6.0.0 pasteboard: ^0.2.0 From b954362104ae749407942236bd68033b01399c45 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Mon, 20 May 2024 16:47:17 +0200 Subject: [PATCH 08/20] build: Use matrix sdk main branch --- pubspec.lock | 4 ++-- pubspec.yaml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index f61631576..642794766 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1210,8 +1210,8 @@ packages: dependency: "direct main" description: path: "." - ref: "krille/store-upload-inbound-sessions-in-que" - resolved-ref: "97d544ba85fe3f832f639c9e4662734f6b0e5bd6" + ref: HEAD + resolved-ref: fe637e1627039623bb15c59f9a152f5d906bb48e url: "https://github.com/famedly/matrix-dart-sdk.git" source: git version: "0.29.2" diff --git a/pubspec.yaml b/pubspec.yaml index 8426edba5..01fca1602 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -67,7 +67,6 @@ dependencies: matrix: git: url: https://github.com/famedly/matrix-dart-sdk.git - ref: krille/store-upload-inbound-sessions-in-que native_imaging: ^0.1.0 package_info_plus: ^6.0.0 pasteboard: ^0.2.0 From 3d7dbf7ddf799d4848133a930b9c8701b8067563 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Mon, 20 May 2024 17:25:09 +0200 Subject: [PATCH 09/20] chore: Nicer message animation --- lib/pages/chat/events/message.dart | 461 +++++++++++++++-------------- 1 file changed, 238 insertions(+), 223 deletions(-) diff --git a/lib/pages/chat/events/message.dart b/lib/pages/chat/events/message.dart index a3037fbcd..8f10d6162 100644 --- a/lib/pages/chat/events/message.dart +++ b/lib/pages/chat/events/message.dart @@ -144,255 +144,270 @@ class Message extends StatelessWidget { setState(resetAnimateIn); }); } - return AnimatedSlide( - offset: Offset(0, animateIn ? 1 : 0), + return AnimatedSize( duration: FluffyThemes.animationDuration, curve: FluffyThemes.animationCurve, - child: Stack( - children: [ - Positioned( - top: 0, - bottom: 0, - left: 0, - right: 0, - child: InkWell( - onTap: () => onSelect(event), - onLongPress: () => onSelect(event), - borderRadius: - BorderRadius.circular(AppConfig.borderRadius / 2), - child: Material( - borderRadius: - BorderRadius.circular(AppConfig.borderRadius / 2), - color: selected - ? Theme.of(context) - .colorScheme - .secondaryContainer - .withAlpha(100) - : highlightMarker - ? Theme.of(context) - .colorScheme - .tertiaryContainer - .withAlpha(100) - : Colors.transparent, - ), - ), - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: rowMainAxisAlignment, - children: [ - if (longPressSelect) - SizedBox( - height: 32, - width: Avatar.defaultSize, - child: Checkbox.adaptive( - value: selected, - shape: const CircleBorder(), - onChanged: (_) => onSelect(event), - ), - ) - else if (nextEventSameSender || ownMessage) - SizedBox( - width: Avatar.defaultSize, - child: Center( - child: SizedBox( - width: 16, - height: 16, - child: event.status == EventStatus.error - ? const Icon(Icons.error, color: Colors.red) - : event.fileSendingStatus != null - ? const CircularProgressIndicator.adaptive( - strokeWidth: 1, - ) - : null, + child: animateIn + ? const SizedBox.shrink() + : Stack( + children: [ + Positioned( + top: 0, + bottom: 0, + left: 0, + right: 0, + child: InkWell( + onTap: () => onSelect(event), + onLongPress: () => onSelect(event), + borderRadius: + BorderRadius.circular(AppConfig.borderRadius / 2), + child: Material( + borderRadius: + BorderRadius.circular(AppConfig.borderRadius / 2), + color: selected + ? Theme.of(context) + .colorScheme + .secondaryContainer + .withAlpha(100) + : highlightMarker + ? Theme.of(context) + .colorScheme + .tertiaryContainer + .withAlpha(100) + : Colors.transparent, ), ), - ) - else - FutureBuilder( - future: event.fetchSenderUser(), - builder: (context, snapshot) { - final user = - snapshot.data ?? event.senderFromMemoryOrFallback; - return Avatar( - mxContent: user.avatarUrl, - name: user.calcDisplayname(), - presenceUserId: user.stateKey, - presenceBackgroundColor: - avatarPresenceBackgroundColor, - onTap: () => onAvatarTab(event), - ); - }, ), - Expanded( - child: Column( + Row( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, + mainAxisAlignment: rowMainAxisAlignment, children: [ - if (!nextEventSameSender) - Padding( - padding: - const EdgeInsets.only(left: 8.0, bottom: 4), - child: ownMessage || event.room.isDirectChat - ? const SizedBox(height: 12) - : FutureBuilder( - future: event.fetchSenderUser(), - builder: (context, snapshot) { - final displayname = - snapshot.data?.calcDisplayname() ?? - event.senderFromMemoryOrFallback - .calcDisplayname(); - return Text( - displayname, - style: TextStyle( - fontSize: 12, - color: - (Theme.of(context).brightness == - Brightness.light - ? displayname.color - : displayname.lightColorText), - ), - ); - }, - ), + if (longPressSelect) + SizedBox( + height: 32, + width: Avatar.defaultSize, + child: Checkbox.adaptive( + value: selected, + shape: const CircleBorder(), + onChanged: (_) => onSelect(event), + ), + ) + else if (nextEventSameSender || ownMessage) + SizedBox( + width: Avatar.defaultSize, + child: Center( + child: SizedBox( + width: 16, + height: 16, + child: event.status == EventStatus.error + ? const Icon(Icons.error, color: Colors.red) + : event.fileSendingStatus != null + ? const CircularProgressIndicator + .adaptive( + strokeWidth: 1, + ) + : null, + ), + ), + ) + else + FutureBuilder( + future: event.fetchSenderUser(), + builder: (context, snapshot) { + final user = snapshot.data ?? + event.senderFromMemoryOrFallback; + return Avatar( + mxContent: user.avatarUrl, + name: user.calcDisplayname(), + presenceUserId: user.stateKey, + presenceBackgroundColor: + avatarPresenceBackgroundColor, + onTap: () => onAvatarTab(event), + ); + }, ), - Container( - alignment: alignment, - padding: const EdgeInsets.only(left: 8), - child: GestureDetector( - onLongPress: longPressSelect - ? null - : () { - HapticFeedback.heavyImpact(); - onSelect(event); - }, - child: AnimatedOpacity( - opacity: animateIn - ? 0 - : event.redacted || - event.messageType == - MessageTypes.BadEncrypted || - event.status.isSending - ? 0.5 - : 1, - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - child: Material( - color: noBubble ? Colors.transparent : color, - clipBehavior: Clip.antiAlias, - shape: RoundedRectangleBorder( - borderRadius: borderRadius, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular( - AppConfig.borderRadius, - ), - ), - padding: noBubble || noPadding - ? EdgeInsets.zero - : const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, - ), - constraints: const BoxConstraints( - maxWidth: FluffyThemes.columnWidth * 1.5, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - if (event.relationshipType == - RelationshipTypes.reply) - FutureBuilder( - future: event.getReplyEvent(timeline), - builder: - (BuildContext context, snapshot) { - final replyEvent = snapshot.hasData - ? snapshot.data! - : Event( - eventId: event - .relationshipEventId!, - content: { - 'msgtype': 'm.text', - 'body': '...', - }, - senderId: event.senderId, - type: 'm.room.message', - room: event.room, - status: EventStatus.sent, - originServerTs: - DateTime.now(), - ); - return Padding( - padding: const EdgeInsets.only( - bottom: 4.0, - ), - child: InkWell( - borderRadius: - ReplyContent.borderRadius, - onTap: () => scrollToEventId( - replyEvent.eventId, - ), - child: AbsorbPointer( - child: ReplyContent( - replyEvent, - ownMessage: ownMessage, - timeline: timeline, - ), - ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (!nextEventSameSender) + Padding( + padding: const EdgeInsets.only( + left: 8.0, bottom: 4), + child: ownMessage || event.room.isDirectChat + ? const SizedBox(height: 12) + : FutureBuilder( + future: event.fetchSenderUser(), + builder: (context, snapshot) { + final displayname = snapshot.data + ?.calcDisplayname() ?? + event.senderFromMemoryOrFallback + .calcDisplayname(); + return Text( + displayname, + style: TextStyle( + fontSize: 12, + color: (Theme.of(context) + .brightness == + Brightness.light + ? displayname.color + : displayname + .lightColorText), ), ); }, ), - MessageContent( - displayEvent, - textColor: textColor, - onInfoTab: onInfoTab, + ), + Container( + alignment: alignment, + padding: const EdgeInsets.only(left: 8), + child: GestureDetector( + onLongPress: longPressSelect + ? null + : () { + HapticFeedback.heavyImpact(); + onSelect(event); + }, + child: AnimatedOpacity( + opacity: animateIn + ? 0 + : event.redacted || + event.messageType == + MessageTypes.BadEncrypted || + event.status.isSending + ? 0.5 + : 1, + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + child: Material( + color: + noBubble ? Colors.transparent : color, + clipBehavior: Clip.antiAlias, + shape: RoundedRectangleBorder( borderRadius: borderRadius, ), - if (event.hasAggregatedEvents( - timeline, - RelationshipTypes.edit, - )) - Padding( - padding: const EdgeInsets.only( - top: 4.0, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular( + AppConfig.borderRadius, ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Icon( - Icons.edit_outlined, - color: textColor.withAlpha(164), - size: 14, + ), + padding: noBubble || noPadding + ? EdgeInsets.zero + : const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), - Text( - ' - ${displayEvent.originServerTs.localizedTimeShort(context)}', - style: TextStyle( - color: - textColor.withAlpha(164), - fontSize: 12, + constraints: const BoxConstraints( + maxWidth: + FluffyThemes.columnWidth * 1.5, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + if (event.relationshipType == + RelationshipTypes.reply) + FutureBuilder( + future: event + .getReplyEvent(timeline), + builder: (BuildContext context, + snapshot) { + final replyEvent = snapshot + .hasData + ? snapshot.data! + : Event( + eventId: event + .relationshipEventId!, + content: { + 'msgtype': 'm.text', + 'body': '...', + }, + senderId: + event.senderId, + type: + 'm.room.message', + room: event.room, + status: + EventStatus.sent, + originServerTs: + DateTime.now(), + ); + return Padding( + padding: + const EdgeInsets.only( + bottom: 4.0, + ), + child: InkWell( + borderRadius: ReplyContent + .borderRadius, + onTap: () => + scrollToEventId( + replyEvent.eventId, + ), + child: AbsorbPointer( + child: ReplyContent( + replyEvent, + ownMessage: + ownMessage, + timeline: timeline, + ), + ), + ), + ); + }, + ), + MessageContent( + displayEvent, + textColor: textColor, + onInfoTab: onInfoTab, + borderRadius: borderRadius, + ), + if (event.hasAggregatedEvents( + timeline, + RelationshipTypes.edit, + )) + Padding( + padding: const EdgeInsets.only( + top: 4.0, + ), + child: Row( + mainAxisSize: + MainAxisSize.min, + children: [ + Icon( + Icons.edit_outlined, + color: textColor + .withAlpha(164), + size: 14, + ), + Text( + ' - ${displayEvent.originServerTs.localizedTimeShort(context)}', + style: TextStyle( + color: textColor + .withAlpha(164), + fontSize: 12, + ), + ), + ], ), ), - ], - ), + ], ), - ], + ), + ), ), ), ), - ), + ], ), ), ], ), - ), - ], - ), - ], - ), + ], + ), ); }, ); From 6599d28676b8a69e38992bab19a8f94ed3a2d158 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Mon, 20 May 2024 18:05:02 +0200 Subject: [PATCH 10/20] chore: Follow up new message animation --- lib/pages/chat/events/message.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pages/chat/events/message.dart b/lib/pages/chat/events/message.dart index 8f10d6162..dd7e995d5 100644 --- a/lib/pages/chat/events/message.dart +++ b/lib/pages/chat/events/message.dart @@ -147,8 +147,10 @@ class Message extends StatelessWidget { return AnimatedSize( duration: FluffyThemes.animationDuration, curve: FluffyThemes.animationCurve, + clipBehavior: Clip.none, + alignment: ownMessage ? Alignment.bottomRight : Alignment.bottomLeft, child: animateIn - ? const SizedBox.shrink() + ? const SizedBox(height: 0, width: double.infinity) : Stack( children: [ Positioned( From f46288aead75319d96b5a84018f8846c403191d4 Mon Sep 17 00:00:00 2001 From: Krille Date: Tue, 21 May 2024 12:46:17 +0200 Subject: [PATCH 11/20] build: Update to matrix 0.29.3 --- pubspec.lock | 55 ++++++++++++++++++++++------------------------------ pubspec.yaml | 5 +---- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 642794766..bbc680457 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1017,10 +1017,10 @@ packages: dependency: "direct main" description: name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" url: "https://pub.dev" source: hosted - version: "0.19.0" + version: "0.18.1" io: dependency: transitive description: @@ -1090,26 +1090,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" url: "https://pub.dev" source: hosted - version: "10.0.4" + version: "10.0.0" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "2.0.1" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.0.1" license_checker: dependency: "direct dev" description: @@ -1209,20 +1209,19 @@ packages: matrix: dependency: "direct main" description: - path: "." - ref: HEAD - resolved-ref: fe637e1627039623bb15c59f9a152f5d906bb48e - url: "https://github.com/famedly/matrix-dart-sdk.git" - source: git - version: "0.29.2" + name: matrix + sha256: f744a1408826b7caca229740b5e87b367654e87338cf0189784e3bd46518f028 + url: "https://pub.dev" + source: hosted + version: "0.29.3" meta: dependency: transitive description: name: meta - sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.11.0" mgrs_dart: dependency: transitive description: @@ -1247,14 +1246,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.16.7" - native_imaging: - dependency: "direct main" - description: - name: native_imaging - sha256: "182ccd8e0815a8a2158500ef66c828c030f6b9e05783e41e22f33bbcfd46a3d5" - url: "https://pub.dev" - source: hosted - version: "0.1.1" nested: dependency: transitive description: @@ -1992,26 +1983,26 @@ packages: dependency: transitive description: name: test - sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073" + sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f url: "https://pub.dev" source: hosted - version: "1.25.2" + version: "1.24.9" test_api: dependency: transitive description: name: test_api - sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.6.1" test_core: dependency: transitive description: name: test_core - sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4" + sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.5.9" timezone: dependency: transitive description: @@ -2304,10 +2295,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "14.2.1" + version: "13.0.0" wakelock_plus: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 01fca1602..8226f7d79 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,10 +64,7 @@ dependencies: keyboard_shortcuts: ^0.1.4 latlong2: ^0.9.1 linkify: ^5.0.0 - matrix: - git: - url: https://github.com/famedly/matrix-dart-sdk.git - native_imaging: ^0.1.0 + matrix: ^0.29.3 package_info_plus: ^6.0.0 pasteboard: ^0.2.0 path: ^1.9.0 From 78a3ef102c778f03b4ad870f32aa508ff8d357be Mon Sep 17 00:00:00 2001 From: Krille Date: Tue, 21 May 2024 12:47:04 +0200 Subject: [PATCH 12/20] chore: Increase default network request timeout --- lib/utils/client_manager.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/utils/client_manager.dart b/lib/utils/client_manager.dart index f798e8737..e3741fd30 100644 --- a/lib/utils/client_manager.dart +++ b/lib/utils/client_manager.dart @@ -120,6 +120,7 @@ abstract class ClientManager { }, nativeImplementations: nativeImplementations, customImageResizer: PlatformInfos.isMobile ? customImageResizer : null, + defaultNetworkRequestTimeout: const Duration(minutes: 5), enableDehydratedDevices: true, ); } From efd2bcb00ad779b90435eece370d6d0448d524ed Mon Sep 17 00:00:00 2001 From: Krille Date: Tue, 21 May 2024 13:09:15 +0200 Subject: [PATCH 13/20] chore: Hotfix create missing objectbox --- pubspec.lock | 11 ++++++----- pubspec.yaml | 5 ++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index bbc680457..8f1a59d73 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1209,11 +1209,12 @@ packages: matrix: dependency: "direct main" description: - name: matrix - sha256: f744a1408826b7caca229740b5e87b367654e87338cf0189784e3bd46518f028 - url: "https://pub.dev" - source: hosted - version: "0.29.3" + path: "." + ref: "krille/create-missing-object-box" + resolved-ref: f3e631b2eb477097c8fbfa188f81e6b80ee1dc58 + url: "https://github.com/famedly/matrix-dart-sdk.git" + source: git + version: "0.29.2" meta: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 8226f7d79..673d8f7b0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,7 +64,10 @@ dependencies: keyboard_shortcuts: ^0.1.4 latlong2: ^0.9.1 linkify: ^5.0.0 - matrix: ^0.29.3 + matrix: + git: + url: https://github.com/famedly/matrix-dart-sdk.git + ref: krille/create-missing-object-box package_info_plus: ^6.0.0 pasteboard: ^0.2.0 path: ^1.9.0 From bd6b180b7ca5435be254c11555e5e827412696c7 Mon Sep 17 00:00:00 2001 From: Krille Date: Tue, 21 May 2024 13:17:17 +0200 Subject: [PATCH 14/20] chore: Re-add native_imaging --- pubspec.lock | 8 ++++++++ pubspec.yaml | 1 + 2 files changed, 9 insertions(+) diff --git a/pubspec.lock b/pubspec.lock index 8f1a59d73..27413c9a8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1247,6 +1247,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.16.7" + native_imaging: + dependency: "direct main" + description: + name: native_imaging + sha256: "182ccd8e0815a8a2158500ef66c828c030f6b9e05783e41e22f33bbcfd46a3d5" + url: "https://pub.dev" + source: hosted + version: "0.1.1" nested: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 673d8f7b0..d189b5d13 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -68,6 +68,7 @@ dependencies: git: url: https://github.com/famedly/matrix-dart-sdk.git ref: krille/create-missing-object-box + native_imaging: ^0.1.1 package_info_plus: ^6.0.0 pasteboard: ^0.2.0 path: ^1.9.0 From 8a738ad25ff31b5e2aa0a34e4c31e7f3e5fa26ee Mon Sep 17 00:00:00 2001 From: Krille Date: Tue, 21 May 2024 13:42:02 +0200 Subject: [PATCH 15/20] chore: Go back to pub.dev matrix sdk --- pubspec.lock | 11 +++++------ pubspec.yaml | 5 +---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 27413c9a8..d36768cdd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1209,12 +1209,11 @@ packages: matrix: dependency: "direct main" description: - path: "." - ref: "krille/create-missing-object-box" - resolved-ref: f3e631b2eb477097c8fbfa188f81e6b80ee1dc58 - url: "https://github.com/famedly/matrix-dart-sdk.git" - source: git - version: "0.29.2" + name: matrix + sha256: "8aa55b91cc436082a80d478810197867e95316141f339cfbaf61b6ea722d6bed" + url: "https://pub.dev" + source: hosted + version: "0.29.4" meta: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index d189b5d13..2cda05a93 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,10 +64,7 @@ dependencies: keyboard_shortcuts: ^0.1.4 latlong2: ^0.9.1 linkify: ^5.0.0 - matrix: - git: - url: https://github.com/famedly/matrix-dart-sdk.git - ref: krille/create-missing-object-box + matrix: ^0.29.4 native_imaging: ^0.1.1 package_info_plus: ^6.0.0 pasteboard: ^0.2.0 From 71ff94b622207f62287235faeee283b67003af58 Mon Sep 17 00:00:00 2001 From: Krille Date: Thu, 23 May 2024 10:53:28 +0200 Subject: [PATCH 16/20] build: Update matrix dart sdk --- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index d36768cdd..74e1f9f9a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1210,10 +1210,10 @@ packages: dependency: "direct main" description: name: matrix - sha256: "8aa55b91cc436082a80d478810197867e95316141f339cfbaf61b6ea722d6bed" + sha256: b96f16ec227138a61d148f2812c4d558b2930edbb6cd05d03b3a41c4fffd2f47 url: "https://pub.dev" source: hosted - version: "0.29.4" + version: "0.29.7" meta: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2cda05a93..705c8fe52 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,7 +64,7 @@ dependencies: keyboard_shortcuts: ^0.1.4 latlong2: ^0.9.1 linkify: ^5.0.0 - matrix: ^0.29.4 + matrix: ^0.29.7 native_imaging: ^0.1.1 package_info_plus: ^6.0.0 pasteboard: ^0.2.0 From 8ea9e26bac4fee38a1b420c3c0cfe3812bc49847 Mon Sep 17 00:00:00 2001 From: Krille Date: Thu, 23 May 2024 10:53:57 +0200 Subject: [PATCH 17/20] chore: Fix formatting --- lib/pages/chat/events/message.dart | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/pages/chat/events/message.dart b/lib/pages/chat/events/message.dart index dd7e995d5..9d2c6cb5d 100644 --- a/lib/pages/chat/events/message.dart +++ b/lib/pages/chat/events/message.dart @@ -236,7 +236,9 @@ class Message extends StatelessWidget { if (!nextEventSameSender) Padding( padding: const EdgeInsets.only( - left: 8.0, bottom: 4), + left: 8.0, + bottom: 4, + ), child: ownMessage || event.room.isDirectChat ? const SizedBox(height: 12) : FutureBuilder( @@ -315,8 +317,10 @@ class Message extends StatelessWidget { FutureBuilder( future: event .getReplyEvent(timeline), - builder: (BuildContext context, - snapshot) { + builder: ( + BuildContext context, + snapshot, + ) { final replyEvent = snapshot .hasData ? snapshot.data! From 8da714b0d27ec00f44ffe612fd3411a32794d787 Mon Sep 17 00:00:00 2001 From: Krille Date: Thu, 23 May 2024 15:50:29 +0200 Subject: [PATCH 18/20] fix: Stickers from gboard have black background --- lib/pages/chat/input_bar.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/pages/chat/input_bar.dart b/lib/pages/chat/input_bar.dart index 26a8d7e30..5cd801e04 100644 --- a/lib/pages/chat/input_bar.dart +++ b/lib/pages/chat/input_bar.dart @@ -9,7 +9,6 @@ import 'package:pasteboard/pasteboard.dart'; import 'package:slugify/slugify.dart'; import 'package:fluffychat/config/app_config.dart'; -import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart'; import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/widgets/mxc_image.dart'; import '../../widgets/avatar.dart'; @@ -465,8 +464,11 @@ class InputBar extends StatelessWidget { mimeType: content.mimeType, bytes: data, name: content.uri.split('/').last, - ).detectFileType; - room.sendFileEvent(file, shrinkImageMaxDimension: 1600); + ); + room.sendFileEvent( + file, + shrinkImageMaxDimension: 1600, + ); }, ), minLines: minLines, From 3b76219f686ad327af4ebc886b60b5aa24a2280d Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sun, 26 May 2024 08:27:43 +0200 Subject: [PATCH 19/20] chore: Follow up listen on streams --- lib/pages/chat/typing_indicators.dart | 150 ++++++++++++++------------ 1 file changed, 80 insertions(+), 70 deletions(-) diff --git a/lib/pages/chat/typing_indicators.dart b/lib/pages/chat/typing_indicators.dart index e816f465d..fe630ecd8 100644 --- a/lib/pages/chat/typing_indicators.dart +++ b/lib/pages/chat/typing_indicators.dart @@ -14,80 +14,90 @@ class TypingIndicators extends StatelessWidget { @override Widget build(BuildContext context) { - final typingUsers = controller.room.typingUsers - ..removeWhere((u) => u.stateKey == Matrix.of(context).client.userID); - const topPadding = 20.0; - const bottomPadding = 4.0; - - return Container( - width: double.infinity, - alignment: Alignment.center, - child: AnimatedContainer( - constraints: - const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5), - height: typingUsers.isEmpty ? 0 : Avatar.defaultSize + bottomPadding, - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - alignment: controller.timeline!.events.isNotEmpty && - controller.timeline!.events.first.senderId == - Matrix.of(context).client.userID - ? Alignment.topRight - : Alignment.topLeft, - clipBehavior: Clip.hardEdge, - decoration: const BoxDecoration(), - padding: const EdgeInsets.only( - left: 8.0, - bottom: bottomPadding, - ), - child: Row( - children: [ - SizedBox( - height: Avatar.defaultSize, - width: typingUsers.length < 2 - ? Avatar.defaultSize - : Avatar.defaultSize + 16, - child: Stack( - children: [ - if (typingUsers.isNotEmpty) - Avatar( - mxContent: typingUsers.first.avatarUrl, - name: typingUsers.first.calcDisplayname(), - ), - if (typingUsers.length == 2) - Padding( - padding: const EdgeInsets.only(left: 16), - child: Avatar( - mxContent: typingUsers.length == 2 - ? typingUsers.last.avatarUrl - : null, - name: typingUsers.length == 2 - ? typingUsers.last.calcDisplayname() - : '+${typingUsers.length - 1}', - ), - ), - ], - ), + return StreamBuilder( + stream: controller.room.client.onSync.stream.where( + (syncUpdate) => + syncUpdate.rooms?.join?[controller.room.id]?.ephemeral + ?.any((ephemeral) => ephemeral.type == 'm.typing') ?? + false, + ), + builder: (context, _) { + final typingUsers = controller.room.typingUsers + ..removeWhere((u) => u.stateKey == Matrix.of(context).client.userID); + const topPadding = 20.0; + const bottomPadding = 4.0; + return Container( + width: double.infinity, + alignment: Alignment.center, + child: AnimatedContainer( + constraints: + const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5), + height: + typingUsers.isEmpty ? 0 : Avatar.defaultSize + bottomPadding, + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + alignment: controller.timeline!.events.isNotEmpty && + controller.timeline!.events.first.senderId == + Matrix.of(context).client.userID + ? Alignment.topRight + : Alignment.topLeft, + clipBehavior: Clip.hardEdge, + decoration: const BoxDecoration(), + padding: const EdgeInsets.only( + left: 8.0, + bottom: bottomPadding, ), - const SizedBox(width: 8), - Padding( - padding: const EdgeInsets.only(top: topPadding), - child: Material( - color: Theme.of(context).colorScheme.surfaceVariant, - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(2), - topRight: Radius.circular(AppConfig.borderRadius), - bottomLeft: Radius.circular(AppConfig.borderRadius), - bottomRight: Radius.circular(AppConfig.borderRadius), + child: Row( + children: [ + SizedBox( + height: Avatar.defaultSize, + width: typingUsers.length < 2 + ? Avatar.defaultSize + : Avatar.defaultSize + 16, + child: Stack( + children: [ + if (typingUsers.isNotEmpty) + Avatar( + mxContent: typingUsers.first.avatarUrl, + name: typingUsers.first.calcDisplayname(), + ), + if (typingUsers.length == 2) + Padding( + padding: const EdgeInsets.only(left: 16), + child: Avatar( + mxContent: typingUsers.length == 2 + ? typingUsers.last.avatarUrl + : null, + name: typingUsers.length == 2 + ? typingUsers.last.calcDisplayname() + : '+${typingUsers.length - 1}', + ), + ), + ], + ), ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: typingUsers.isEmpty ? null : const _TypingDots(), + const SizedBox(width: 8), + Padding( + padding: const EdgeInsets.only(top: topPadding), + child: Material( + color: Theme.of(context).colorScheme.surfaceVariant, + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(2), + topRight: Radius.circular(AppConfig.borderRadius), + bottomLeft: Radius.circular(AppConfig.borderRadius), + bottomRight: Radius.circular(AppConfig.borderRadius), + ), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: typingUsers.isEmpty ? null : const _TypingDots(), + ), + ), ), - ), + ], ), - ], - ), - ), + ), + ); + }, ); } } From f7096d5dee0f3383bdfe50ea189ebe5eb10bb4b4 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sun, 26 May 2024 08:39:05 +0200 Subject: [PATCH 20/20] refactor: Delete database file on failed app start --- .../builder.dart | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart b/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart index ff6d4a8c0..1add432d2 100644 --- a/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart +++ b/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart @@ -35,6 +35,12 @@ Future flutterMatrixSdkDatabaseBuilder(Client client) async { ), ); + // Delete database file: + if (database == null && !kIsWeb) { + final dbFile = File(await _getDatabasePath(client.clientName)); + if (await dbFile.exists()) await dbFile.delete(); + } + try { // Send error notification: final l10n = lookupL10n(PlatformDispatcher.instance.locale); @@ -61,9 +67,6 @@ Future _constructDatabase(Client client) async { final cipher = await getDatabaseCipher(); - final databaseDirectory = PlatformInfos.isIOS || PlatformInfos.isMacOS - ? await getLibraryDirectory() - : await getApplicationSupportDirectory(); Directory? fileStorageLocation; try { fileStorageLocation = await getTemporaryDirectory(); @@ -73,7 +76,7 @@ Future _constructDatabase(Client client) async { ); } - final path = join(databaseDirectory.path, '${client.clientName}.sqlite'); + final path = await _getDatabasePath(client.clientName); // fix dlopen for old Android await applyWorkaroundToOpenSqlCipherOnOldAndroidVersions(); @@ -118,6 +121,14 @@ Future _constructDatabase(Client client) async { ); } +Future _getDatabasePath(String clientName) async { + final databaseDirectory = PlatformInfos.isIOS || PlatformInfos.isMacOS + ? await getLibraryDirectory() + : await getApplicationSupportDirectory(); + + return join(databaseDirectory.path, '$clientName.sqlite'); +} + Future _migrateLegacyLocation( String sqlFilePath, String clientName,