From c447e15949c01bd1e201e5b258cd8115b20a8e52 Mon Sep 17 00:00:00 2001 From: Krille Date: Tue, 14 May 2024 15:06:18 +0200 Subject: [PATCH 1/6] build: Update matrix dart sdk to 0.29.2 --- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index d3c9cad78..9809a7070 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1210,10 +1210,10 @@ packages: dependency: "direct main" description: name: matrix - sha256: b9aa3c1bdb1ca16c2365bb3681f861eeeb86acd0ea2df9c9ba453fdbcb564076 + sha256: "8610e6d207d6b667e4fe9e769d5b479db27aa1f80570880d3f171a5d3ff49d1a" url: "https://pub.dev" source: hosted - version: "0.29.1" + version: "0.29.2" meta: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 9f23b88e8..5b5bac073 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.1 + matrix: ^0.29.2 native_imaging: ^0.1.0 package_info_plus: ^6.0.0 pasteboard: ^0.2.0 From 8a64bdd82dedf1a2ea885524223d1b31673f07eb Mon Sep 17 00:00:00 2001 From: Krille Date: Wed, 15 May 2024 08:20:43 +0200 Subject: [PATCH 2/6] refactor: Remove unnecessary FutureBuilder --- lib/pages/chat/events/message_content.dart | 40 +++++------- lib/pages/chat/events/state_message.dart | 25 +++----- lib/pages/chat/pinned_events.dart | 43 +++++-------- lib/pages/chat/reply_display.dart | 24 +++---- lib/pages/chat_list/chat_list_item.dart | 73 +++++++++------------- 5 files changed, 76 insertions(+), 129 deletions(-) diff --git a/lib/pages/chat/events/message_content.dart b/lib/pages/chat/events/message_content.dart index 24c768f2d..5aeb650a4 100644 --- a/lib/pages/chat/events/message_content.dart +++ b/lib/pages/chat/events/message_content.dart @@ -251,34 +251,24 @@ class MessageContent extends StatelessWidget { final bigEmotes = event.onlyEmotes && event.numberEmotes > 0 && event.numberEmotes <= 10; - return FutureBuilder( - future: event.calcLocalizedBody( + return Linkify( + text: event.calcLocalizedBodyFallback( MatrixLocals(L10n.of(context)!), hideReply: true, ), - builder: (context, snapshot) { - return Linkify( - text: snapshot.data ?? - event.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), - hideReply: true, - ), - style: TextStyle( - color: textColor, - fontSize: bigEmotes ? fontSize * 3 : fontSize, - decoration: - event.redacted ? TextDecoration.lineThrough : null, - ), - options: const LinkifyOptions(humanize: false), - linkStyle: TextStyle( - color: textColor.withAlpha(150), - fontSize: bigEmotes ? fontSize * 3 : fontSize, - decoration: TextDecoration.underline, - decorationColor: textColor.withAlpha(150), - ), - onOpen: (url) => UrlLauncher(context, url.url).launchUrl(), - ); - }, + style: TextStyle( + color: textColor, + fontSize: bigEmotes ? fontSize * 3 : fontSize, + decoration: event.redacted ? TextDecoration.lineThrough : null, + ), + options: const LinkifyOptions(humanize: false), + linkStyle: TextStyle( + color: textColor.withAlpha(150), + fontSize: bigEmotes ? fontSize * 3 : fontSize, + decoration: TextDecoration.underline, + decorationColor: textColor.withAlpha(150), + ), + onOpen: (url) => UrlLauncher(context, url.url).launchUrl(), ); } case EventTypes.CallInvite: diff --git a/lib/pages/chat/events/state_message.dart b/lib/pages/chat/events/state_message.dart index 861247b95..79ab9a617 100644 --- a/lib/pages/chat/events/state_message.dart +++ b/lib/pages/chat/events/state_message.dart @@ -21,22 +21,15 @@ class StateMessage extends StatelessWidget { color: Theme.of(context).colorScheme.background, borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2), ), - child: FutureBuilder( - future: event.calcLocalizedBody(MatrixLocals(L10n.of(context)!)), - builder: (context, snapshot) { - return Text( - snapshot.data ?? - event.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), - ), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 12 * AppConfig.fontSizeFactor, - decoration: - event.redacted ? TextDecoration.lineThrough : null, - ), - ); - }, + child: Text( + event.calcLocalizedBodyFallback( + MatrixLocals(L10n.of(context)!), + ), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12 * AppConfig.fontSizeFactor, + decoration: event.redacted ? TextDecoration.lineThrough : null, + ), ), ), ), diff --git a/lib/pages/chat/pinned_events.dart b/lib/pages/chat/pinned_events.dart index be4ea73ed..0940a786f 100644 --- a/lib/pages/chat/pinned_events.dart +++ b/lib/pages/chat/pinned_events.dart @@ -63,33 +63,24 @@ class PinnedEvents extends StatelessWidget { future: controller.room.getEventById(pinnedEventIds.last), builder: (context, snapshot) { final event = snapshot.data; - return FutureBuilder( - future: event?.calcLocalizedBody( - MatrixLocals(L10n.of(context)!), - withSenderNamePrefix: true, - hideReply: true, - ), - builder: (context, snapshot) => ChatAppBarListTile( - title: snapshot.data ?? - event?.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), - withSenderNamePrefix: true, - hideReply: true, - ) ?? - L10n.of(context)!.loadingPleaseWait, - leading: IconButton( - splashRadius: 20, - iconSize: 20, - color: Theme.of(context).colorScheme.onSurfaceVariant, - icon: const Icon(Icons.push_pin), - tooltip: L10n.of(context)!.unpin, - onPressed: - controller.room.canSendEvent(EventTypes.RoomPinnedEvents) - ? () => controller.unpinEvent(event!.eventId) - : null, - ), - onTap: () => _displayPinnedEventsDialog(context), + return ChatAppBarListTile( + title: event?.calcLocalizedBodyFallback( + MatrixLocals(L10n.of(context)!), + withSenderNamePrefix: true, + hideReply: true, + ) ?? + L10n.of(context)!.loadingPleaseWait, + leading: IconButton( + splashRadius: 20, + iconSize: 20, + color: Theme.of(context).colorScheme.onSurfaceVariant, + icon: const Icon(Icons.push_pin), + tooltip: L10n.of(context)!.unpin, + onPressed: controller.room.canSendEvent(EventTypes.RoomPinnedEvents) + ? () => controller.unpinEvent(event!.eventId) + : null, ), + onTap: () => _displayPinnedEventsDialog(context), ); }, ); diff --git a/lib/pages/chat/reply_display.dart b/lib/pages/chat/reply_display.dart index 67bf47c52..03acd269e 100644 --- a/lib/pages/chat/reply_display.dart +++ b/lib/pages/chat/reply_display.dart @@ -66,27 +66,17 @@ class _EditContent extends StatelessWidget { color: Theme.of(context).colorScheme.primary, ), Container(width: 15.0), - FutureBuilder( - future: event.calcLocalizedBody( + Text( + event.calcLocalizedBodyFallback( MatrixLocals(L10n.of(context)!), withSenderNamePrefix: false, hideReply: true, ), - builder: (context, snapshot) { - return Text( - snapshot.data ?? - event.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), - withSenderNamePrefix: false, - hideReply: true, - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: TextStyle( - color: Theme.of(context).textTheme.bodyMedium!.color, - ), - ); - }, + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + color: Theme.of(context).textTheme.bodyMedium!.color, + ), ), ], ); diff --git a/lib/pages/chat_list/chat_list_item.dart b/lib/pages/chat_list/chat_list_item.dart index 024acc294..4b2573a6f 100644 --- a/lib/pages/chat_list/chat_list_item.dart +++ b/lib/pages/chat_list/chat_list_item.dart @@ -226,51 +226,34 @@ class ChatListItem extends StatelessWidget { maxLines: 1, softWrap: false, ) - : FutureBuilder( - future: room.lastEvent?.calcLocalizedBody( - MatrixLocals(L10n.of(context)!), - hideReply: true, - hideEdit: true, - plaintextBody: true, - removeMarkdown: true, - withSenderNamePrefix: !isDirectChat || - directChatMatrixId != - room.lastEvent?.senderId, - ) ?? - Future.value(L10n.of(context)!.emptyChat), - builder: (context, snapshot) { - return Text( - room.membership == Membership.invite - ? isDirectChat - ? L10n.of(context)!.invitePrivateChat - : L10n.of(context)!.inviteGroupChat - : snapshot.data ?? - room.lastEvent - ?.calcLocalizedBodyFallback( - MatrixLocals(L10n.of(context)!), - hideReply: true, - hideEdit: true, - plaintextBody: true, - removeMarkdown: true, - withSenderNamePrefix: !isDirectChat || - directChatMatrixId != - room.lastEvent?.senderId, - ) ?? - L10n.of(context)!.emptyChat, - softWrap: false, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontWeight: unread || room.hasNewMessages - ? FontWeight.bold - : null, - color: theme.colorScheme.onSurfaceVariant, - decoration: room.lastEvent?.redacted == true - ? TextDecoration.lineThrough - : null, - ), - ); - }, + : Text( + room.membership == Membership.invite + ? isDirectChat + ? L10n.of(context)!.invitePrivateChat + : L10n.of(context)!.inviteGroupChat + : room.lastEvent?.calcLocalizedBodyFallback( + MatrixLocals(L10n.of(context)!), + hideReply: true, + hideEdit: true, + plaintextBody: true, + removeMarkdown: true, + withSenderNamePrefix: !isDirectChat || + directChatMatrixId != + room.lastEvent?.senderId, + ) ?? + L10n.of(context)!.emptyChat, + softWrap: false, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: unread || room.hasNewMessages + ? FontWeight.bold + : null, + color: theme.colorScheme.onSurfaceVariant, + decoration: room.lastEvent?.redacted == true + ? TextDecoration.lineThrough + : null, + ), ), ), const SizedBox(width: 8), From 62fcea5b0b762e9647e2877bb462e0da38892625 Mon Sep 17 00:00:00 2001 From: Krille Date: Wed, 15 May 2024 11:59:19 +0200 Subject: [PATCH 3/6] chore: Set a maxsize for textfields --- lib/pages/chat/input_bar.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/pages/chat/input_bar.dart b/lib/pages/chat/input_bar.dart index 35578a6fe..26a8d7e30 100644 --- a/lib/pages/chat/input_bar.dart +++ b/lib/pages/chat/input_bar.dart @@ -474,6 +474,9 @@ class InputBar extends StatelessWidget { keyboardType: keyboardType!, textInputAction: textInputAction, autofocus: autofocus!, + inputFormatters: [ + LengthLimitingTextInputFormatter((maxPDUSize / 3).floor()), + ], onSubmitted: (text) { // fix for library for now // it sets the types for the callback incorrectly 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 4/6] 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 5/6] 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 6/6] 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