From 75cd6f1f233c5303b4d593690f50510168a5dcfe Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sat, 17 Oct 2020 09:29:27 +0200 Subject: [PATCH 1/9] feat: Implement linux desktop notifications --- lib/components/avatar.dart | 49 ++++++++++++++------- lib/components/content_banner.dart | 17 +++----- lib/components/image_bubble.dart | 17 +++----- lib/components/input_bar.dart | 17 +++----- lib/components/matrix.dart | 61 +++++++++++++++++++-------- lib/components/message_reactions.dart | 14 ++---- lib/views/settings_emotes.dart | 19 +++------ pubspec.lock | 4 +- pubspec.yaml | 3 +- 9 files changed, 106 insertions(+), 95 deletions(-) diff --git a/lib/components/avatar.dart b/lib/components/avatar.dart index 47ca14b..c32faa9 100644 --- a/lib/components/avatar.dart +++ b/lib/components/avatar.dart @@ -1,5 +1,4 @@ import 'package:famedlysdk/famedlysdk.dart'; -import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/string_color.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -28,31 +27,49 @@ class Avatar extends StatelessWidget { Matrix.of(context).client, width: size * MediaQuery.of(context).devicePixelRatio, height: size * MediaQuery.of(context).devicePixelRatio, - method: ThumbnailMethod.scale, ); final src = thumbnail; var fallbackLetters = '@'; if ((name?.length ?? 0) >= 2) { - fallbackLetters = name.substring(0, 2); + fallbackLetters = String.fromCharCodes(name.runes, 0, 2); } else if ((name?.length ?? 0) == 1) { fallbackLetters = name; } + final textWidget = Center( + child: Text( + fallbackLetters, + style: TextStyle( + color: Colors.white, + fontSize: 18, + ), + ), + ); final noPic = mxContent == null || mxContent.toString().isEmpty; return InkWell( onTap: onTap, - child: CircleAvatar( - radius: size / 2, - backgroundImage: !noPic - ? PlatformInfos.isBetaDesktop - ? NetworkImage(src) - : CachedNetworkImageProvider(src) - : null, - backgroundColor: noPic - ? name?.lightColor ?? Theme.of(context).secondaryHeaderColor - : Theme.of(context).secondaryHeaderColor, - child: noPic - ? Text(fallbackLetters, style: TextStyle(color: Colors.white)) - : null, + child: ClipRRect( + borderRadius: BorderRadius.circular(size / 2), + child: Container( + width: size, + height: size, + color: noPic + ? name?.lightColor ?? Theme.of(context).secondaryHeaderColor + : Theme.of(context).secondaryHeaderColor, + child: noPic + ? textWidget + : CachedNetworkImage( + imageUrl: src, + fit: BoxFit.cover, + width: size, + height: size, + placeholder: (c, s) => Stack( + children: [ + Center(child: CircularProgressIndicator(strokeWidth: 2)), + textWidget, + ], + ), + ), + ), ), ); } diff --git a/lib/components/content_banner.dart b/lib/components/content_banner.dart index 16292e0..40eefde 100644 --- a/lib/components/content_banner.dart +++ b/lib/components/content_banner.dart @@ -1,5 +1,4 @@ import 'package:famedlysdk/famedlysdk.dart'; -import 'package:fluffychat/utils/platform_infos.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; @@ -49,17 +48,11 @@ class ContentBanner extends StatelessWidget { opacity: 0.75, child: !loading ? mxContent != null - ? PlatformInfos.isBetaDesktop - ? Image.network( - src, - height: 300, - fit: BoxFit.cover, - ) - : CachedNetworkImage( - imageUrl: src, - height: 300, - fit: BoxFit.cover, - ) + ? CachedNetworkImage( + imageUrl: src, + height: 300, + fit: BoxFit.cover, + ) : Icon(defaultIcon, size: 300) : Icon(defaultIcon, size: 300), ), diff --git a/lib/components/image_bubble.dart b/lib/components/image_bubble.dart index 5d12bdd..8b23f77 100644 --- a/lib/components/image_bubble.dart +++ b/lib/components/image_bubble.dart @@ -1,6 +1,5 @@ import 'package:famedlysdk/famedlysdk.dart'; import 'package:fluffychat/utils/app_route.dart'; -import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/views/image_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; @@ -127,17 +126,11 @@ class _ImageBubbleState extends State { width: 800, height: 800, method: ThumbnailMethod.scale); - renderWidget = PlatformInfos.isBetaDesktop - ? Image.network( - src, - fit: widget.fit, - ) - : CachedNetworkImage( - imageUrl: src, - placeholder: (context, url) => - generatePlaceholderWidget(), - fit: widget.fit, - ); + renderWidget = CachedNetworkImage( + imageUrl: src, + placeholder: (context, url) => generatePlaceholderWidget(), + fit: widget.fit, + ); } else { renderWidget = generatePlaceholderWidget(); } diff --git a/lib/components/input_bar.dart b/lib/components/input_bar.dart index 90e2cc2..7fe9b07 100644 --- a/lib/components/input_bar.dart +++ b/lib/components/input_bar.dart @@ -1,4 +1,3 @@ -import 'package:fluffychat/utils/platform_infos.dart'; import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; import 'package:famedlysdk/famedlysdk.dart'; @@ -149,17 +148,11 @@ class InputBar extends StatelessWidget { child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - PlatformInfos.isBetaDesktop - ? Image.network( - url, - width: size, - height: size, - ) - : CachedNetworkImage( - imageUrl: url, - width: size, - height: size, - ), + CachedNetworkImage( + imageUrl: url, + width: size, + height: size, + ), SizedBox(width: 6), Text(suggestion['name']), Expanded( diff --git a/lib/components/matrix.dart b/lib/components/matrix.dart index 17b1fe4..f626e5e 100644 --- a/lib/components/matrix.dart +++ b/lib/components/matrix.dart @@ -13,6 +13,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:universal_html/prefer_universal/html.dart' as html; import 'package:url_launcher/url_launcher.dart'; +/*import 'package:fluffychat/views/chat.dart'; +import 'package:fluffychat/config/app_config.dart'; +import 'package:dbus/dbus.dart'; +import 'package:desktop_notifications/desktop_notifications.dart';*/ import '../main.dart'; import '../utils/app_route.dart'; @@ -179,9 +183,10 @@ class MatrixState extends State { bool webHasFocus = true; - void _showWebNotification(EventUpdate eventUpdate) async { - if (webHasFocus && activeRoomId == eventUpdate.roomID) return; - final room = client.getRoomById(eventUpdate.roomID); + void _showLocalNotification(EventUpdate eventUpdate) async { + final roomId = eventUpdate.roomID; + if (webHasFocus && activeRoomId == roomId) return; + final room = client.getRoomById(roomId); if (room.notificationCount == 0) return; final event = Event.fromJson(eventUpdate.content, room); final body = event.getLocalizedBody( @@ -189,20 +194,41 @@ class MatrixState extends State { withSenderNamePrefix: !room.isDirectChat || room.lastEvent.senderId == client.userID, ); - html.AudioElement() - ..src = 'assets/assets/sounds/notification.wav' - ..autoplay = true - ..load(); - html.Notification( - room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))), - body: body, - icon: event.sender.avatarUrl?.getThumbnail(client, - width: 64, height: 64, method: ThumbnailMethod.crop) ?? - room.avatar?.getThumbnail(client, - width: 64, height: 64, method: ThumbnailMethod.crop), - ); + final icon = event.sender.avatarUrl?.getThumbnail(client, + width: 64, height: 64, method: ThumbnailMethod.crop) ?? + room.avatar?.getThumbnail(client, + width: 64, height: 64, method: ThumbnailMethod.crop); + if (kIsWeb) { + html.AudioElement() + ..src = 'assets/assets/sounds/notification.wav' + ..autoplay = true + ..load(); + html.Notification( + room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))), + body: body, + icon: icon, + ); + } else if (Platform.isLinux) { + /*var sessionBus = DBusClient.session(); + var client = NotificationClient(sessionBus); + _linuxNotificationIds[roomId] = await client.notify( + room.getLocalizedDisplayname(MatrixLocals(L10n.of(context))), + body: body, + replacesID: _linuxNotificationIds[roomId] ?? -1, + appName: AppConfig.applicationName, + actionCallback: (_) => Navigator.of(context).pushAndRemoveUntil( + AppRoute.defaultRoute( + context, + ChatView(roomId), + ), + (r) => r.isFirst), + ); + await sessionBus.close();*/ + } } + //final Map _linuxNotificationIds = {}; + @override void initState() { store = widget.store ?? Store(); @@ -289,7 +315,8 @@ class MatrixState extends State { if (kIsWeb) { onFocusSub = html.window.onFocus.listen((_) => webHasFocus = true); onBlurSub = html.window.onBlur.listen((_) => webHasFocus = false); - + } + if (kIsWeb || Platform.isLinux) { client.onSync.stream.first.then((s) { html.Notification.requestPermission(); onNotification ??= client.onEvent.stream @@ -298,7 +325,7 @@ class MatrixState extends State { [EventTypes.Message, EventTypes.Sticker, EventTypes.Encrypted] .contains(e.eventType) && e.content['sender'] != client.userID) - .listen(_showWebNotification); + .listen(_showLocalNotification); }); } super.initState(); diff --git a/lib/components/message_reactions.dart b/lib/components/message_reactions.dart index cf09add..2619891 100644 --- a/lib/components/message_reactions.dart +++ b/lib/components/message_reactions.dart @@ -1,5 +1,4 @@ import 'package:famedlysdk/famedlysdk.dart'; -import 'package:fluffychat/utils/platform_infos.dart'; import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; @@ -93,15 +92,10 @@ class _Reaction extends StatelessWidget { content = Row( mainAxisSize: MainAxisSize.min, children: [ - PlatformInfos.isBetaDesktop - ? Image.network( - src, - height: fontSize, - ) - : CachedNetworkImage( - imageUrl: src, - height: fontSize, - ), + CachedNetworkImage( + imageUrl: src, + height: fontSize, + ), Container(width: 4), Text(count.toString(), style: TextStyle( diff --git a/lib/views/settings_emotes.dart b/lib/views/settings_emotes.dart index 5046031..d7bca13 100644 --- a/lib/views/settings_emotes.dart +++ b/lib/views/settings_emotes.dart @@ -417,19 +417,12 @@ class _EmoteImage extends StatelessWidget { height: size * devicePixelRatio, method: ThumbnailMethod.scale, ); - return PlatformInfos.isBetaDesktop - ? Image.network( - url, - fit: BoxFit.contain, - width: size, - height: size, - ) - : CachedNetworkImage( - imageUrl: url, - fit: BoxFit.contain, - width: size, - height: size, - ); + return CachedNetworkImage( + imageUrl: url, + fit: BoxFit.contain, + width: size, + height: size, + ); } } diff --git a/pubspec.lock b/pubspec.lock index 66ae763..2765e48 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -77,7 +77,7 @@ packages: name: cached_network_image url: "https://pub.dartlang.org" source: hosted - version: "2.3.2+1" + version: "2.3.3" canonical_json: dependency: transitive description: @@ -287,7 +287,7 @@ packages: name: flutter_cache_manager url: "https://pub.dartlang.org" source: hosted - version: "1.4.2" + version: "2.0.0" flutter_keyboard_visibility: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index a2047ad..922e61e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,9 +33,10 @@ dependencies: file_picker_cross: ^4.2.2 image_picker: ^0.6.7+11 url_launcher: ^5.7.2 - cached_network_image: ^2.3.2+1 + cached_network_image: ^2.3.3 firebase_messaging: ^7.0.2 flutter_local_notifications: ^1.4.3 + # desktop_notifications: ^0.0.0-dev.4 // Currently blocked by: https://github.com/canonical/desktop_notifications.dart/issues/5 matrix_link_text: ^0.1.5 path_provider: ^1.5.1 webview_flutter: ^0.3.19+9 From fc2a0c0cb767775f82c59ca6a853339371562be3 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Sat, 17 Oct 2020 10:57:05 +0200 Subject: [PATCH 2/9] chore: Update matrix_link_text --- CHANGELOG.md | 1 + pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1124e38..6d1dfed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Add ability to manage emote packs with different state keys ### Changes - Re-scale images in a separate isolate to prevent the UI from freezing +- URLs without https:// now linkify ### Fixes - Fix amoled / theme settings not always saving properly - Show device name in account information correctly diff --git a/pubspec.lock b/pubspec.lock index 2765e48..dcc9026 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -519,7 +519,7 @@ packages: name: matrix_link_text url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.2.0" meta: dependency: transitive description: @@ -1074,5 +1074,5 @@ packages: source: hosted version: "0.1.2" sdks: - dart: ">=2.10.0-110 <2.11.0" + dart: ">=2.10.0-110 <=2.11.0-161.0.dev" flutter: ">=1.20.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 922e61e..fa767dd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,7 +37,7 @@ dependencies: firebase_messaging: ^7.0.2 flutter_local_notifications: ^1.4.3 # desktop_notifications: ^0.0.0-dev.4 // Currently blocked by: https://github.com/canonical/desktop_notifications.dart/issues/5 - matrix_link_text: ^0.1.5 + matrix_link_text: ^0.2.0 path_provider: ^1.5.1 webview_flutter: ^0.3.19+9 share: ^0.6.3+5 From f9904863a882221248c19b91e3ec639a58df8017 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Sat, 17 Oct 2020 09:15:55 +0000 Subject: [PATCH 3/9] fix replying to wrong message when new message arrives during the gesture --- lib/views/chat.dart | 99 ++++++++++++++++++++++++++++----------------- pubspec.lock | 7 ++++ pubspec.yaml | 1 + 3 files changed, 70 insertions(+), 37 deletions(-) diff --git a/lib/views/chat.dart b/lib/views/chat.dart index a55c1a5..b3a3d8f 100644 --- a/lib/views/chat.dart +++ b/lib/views/chat.dart @@ -28,6 +28,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:image_picker/image_picker.dart'; import 'package:pedantic/pedantic.dart'; import 'package:scroll_to_index/scroll_to_index.dart'; +import 'package:swipe_to_action/swipe_to_action.dart'; import '../components/dialogs/send_file_dialog.dart'; import '../components/input_bar.dart'; @@ -343,9 +344,9 @@ class _ChatState extends State<_Chat> { setState(() => selectedEvents.clear()); } - void replyAction() { + void replyAction({Event replyTo}) { setState(() { - replyEvent = selectedEvents.first; + replyEvent = replyTo ?? selectedEvents.first; selectedEvents.clear(); }); inputFocus.requestFocus(); @@ -668,43 +669,67 @@ class _ChatState extends State<_Chat> { key: ValueKey(i - 1), index: i - 1, controller: _scrollController, - child: Message(filteredEvents[i - 1], - onAvatarTab: (Event event) { - sendController.text += - ' ${event.senderId}'; - }, - onSelect: (Event event) { - if (!event.redacted) { - if (selectedEvents - .contains(event)) { - setState( - () => selectedEvents - .remove(event), - ); - } else { - setState( - () => - selectedEvents.add(event), + child: Swipeable( + key: ValueKey( + filteredEvents[i - 1].eventId), + background: Container( + color: Theme.of(context) + .primaryColor + .withAlpha(100), + padding: EdgeInsets.symmetric( + horizontal: 12.0), + alignment: Alignment.centerLeft, + child: Row( + children: [ + Icon(Icons.reply), + SizedBox(width: 2.0), + Text(L10n.of(context).reply) + ], + ), + ), + direction: SwipeDirection.startToEnd, + onSwipe: (direction) { + replyAction( + replyTo: filteredEvents[i - 1]); + }, + child: Message(filteredEvents[i - 1], + onAvatarTab: (Event event) { + sendController.text += + ' ${event.senderId}'; + }, + onSelect: (Event event) { + if (!event.redacted) { + if (selectedEvents + .contains(event)) { + setState( + () => selectedEvents + .remove(event), + ); + } else { + setState( + () => selectedEvents + .add(event), + ); + } + selectedEvents.sort( + (a, b) => a.originServerTs + .compareTo( + b.originServerTs), ); } - selectedEvents.sort( - (a, b) => a.originServerTs - .compareTo( - b.originServerTs), - ); - } - }, - scrollToEventId: (String eventId) => - _scrollToEventId(eventId, - context: context), - longPressSelect: - selectedEvents.isEmpty, - selected: selectedEvents - .contains(filteredEvents[i - 1]), - timeline: timeline, - nextEvent: i >= 2 - ? filteredEvents[i - 2] - : null), + }, + scrollToEventId: (String eventId) => + _scrollToEventId(eventId, + context: context), + longPressSelect: + selectedEvents.isEmpty, + selected: selectedEvents.contains( + filteredEvents[i - 1]), + timeline: timeline, + nextEvent: i >= 2 + ? filteredEvents[i - 2] + : null), + ), ); }); }, diff --git a/pubspec.lock b/pubspec.lock index e9511b5..16da50f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -877,6 +877,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0-nullsafety.1" + swipe_to_action: + dependency: "direct main" + description: + name: swipe_to_action + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0" synchronized: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 411e6a4..4f7ed27 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -69,6 +69,7 @@ dependencies: flutter_blurhash: ^0.5.0 sentry: ">=3.0.0 <4.0.0" scroll_to_index: ^1.0.6 + swipe_to_action: ^0.1.0 dev_dependencies: flutter_test: From 6d4113658706b3e236c09042e7f90349fd32d2ef Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sat, 17 Oct 2020 09:28:33 +0000 Subject: [PATCH 4/9] feat: Implement mouse select chat list items --- lib/components/list_items/chat_list_item.dart | 17 ++++- lib/components/mouse_over_builder.dart | 28 +++++++++ lib/views/chat_list.dart | 63 +++++++++---------- pubspec.lock | 11 +++- pubspec.yaml | 1 + 5 files changed, 82 insertions(+), 38 deletions(-) create mode 100644 lib/components/mouse_over_builder.dart diff --git a/lib/components/list_items/chat_list_item.dart b/lib/components/list_items/chat_list_item.dart index 1111fe5..9b6ba7a 100644 --- a/lib/components/list_items/chat_list_item.dart +++ b/lib/components/list_items/chat_list_item.dart @@ -1,4 +1,5 @@ import 'package:bot_toast/bot_toast.dart'; +import 'package:circular_check_box/circular_check_box.dart'; import 'package:famedlysdk/famedlysdk.dart'; import 'package:fluffychat/utils/matrix_locals.dart'; import 'package:fluffychat/views/chat.dart'; @@ -13,6 +14,7 @@ import '../avatar.dart'; import '../dialogs/send_file_dialog.dart'; import '../dialogs/simple_dialogs.dart'; import '../matrix.dart'; +import '../mouse_over_builder.dart'; import '../theme_switcher.dart'; class ChatListItem extends StatelessWidget { @@ -128,7 +130,20 @@ class ChatListItem extends StatelessWidget { color: chatListItemColor(context, activeChat, selected), child: ListTile( onLongPress: onLongPress, - leading: Avatar(room.avatar, room.displayname), + leading: MouseOverBuilder( + builder: (context, hover) => + onLongPress != null && (hover || selected) + ? Container( + width: Avatar.defaultSize, + height: Avatar.defaultSize, + alignment: Alignment.center, + child: CircularCheckBox( + value: selected, + onChanged: (_) => onLongPress(), + ), + ) + : Avatar(room.avatar, room.displayname), + ), title: Row( children: [ Expanded( diff --git a/lib/components/mouse_over_builder.dart b/lib/components/mouse_over_builder.dart new file mode 100644 index 0000000..017eddc --- /dev/null +++ b/lib/components/mouse_over_builder.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; + +class MouseOverBuilder extends StatefulWidget { + final Function(BuildContext, bool) builder; + + const MouseOverBuilder({Key key, this.builder}) : super(key: key); + @override + _MouseOverBuilderState createState() => _MouseOverBuilderState(); +} + +class _MouseOverBuilderState extends State { + bool _hover = false; + + void _toggleHover(bool hover) { + if (_hover != hover) { + setState(() => _hover = hover); + } + } + + @override + Widget build(BuildContext context) { + return MouseRegion( + onEnter: (_) => _toggleHover(true), + onExit: (_) => _toggleHover(false), + child: widget.builder != null ? widget.builder(context, _hover) : null, + ); + } +} diff --git a/lib/views/chat_list.dart b/lib/views/chat_list.dart index b0aa931..d56c3d4 100644 --- a/lib/views/chat_list.dart +++ b/lib/views/chat_list.dart @@ -420,37 +420,34 @@ class _ChatListState extends State { ), ), ), - floatingActionButton: - (AdaptivePageLayout.columnMode(context) || - selectMode != SelectMode.normal) - ? null - : Column( - mainAxisSize: MainAxisSize.min, - children: [ - FloatingActionButton( - heroTag: null, - child: Icon( - Icons.edit, - color: Theme.of(context).primaryColor, - ), - elevation: 1, - backgroundColor: - Theme.of(context).secondaryHeaderColor, - onPressed: () => _setStatus(context), - ), - SizedBox(height: 16.0), - FloatingActionButton( - child: Icon(Icons.add), - backgroundColor: - Theme.of(context).primaryColor, - onPressed: () => Navigator.of(context) - .pushAndRemoveUntil( - AppRoute.defaultRoute( - context, NewPrivateChatView()), - (r) => r.isFirst), - ), - ], + floatingActionButton: AdaptivePageLayout.columnMode(context) + ? null + : Column( + mainAxisSize: MainAxisSize.min, + children: [ + FloatingActionButton( + heroTag: null, + child: Icon( + Icons.edit, + color: Theme.of(context).primaryColor, + ), + elevation: 1, + backgroundColor: + Theme.of(context).secondaryHeaderColor, + onPressed: () => _setStatus(context), ), + SizedBox(height: 16.0), + FloatingActionButton( + child: Icon(Icons.add), + backgroundColor: Theme.of(context).primaryColor, + onPressed: () => Navigator.of(context) + .pushAndRemoveUntil( + AppRoute.defaultRoute( + context, NewPrivateChatView()), + (r) => r.isFirst), + ), + ], + ), body: Column( children: [ ConnectionStatusHeader(), @@ -532,11 +529,7 @@ class _ChatListState extends State { (BuildContext context, int i) { if (i == 0) { final displayPresences = - Matrix.of(context) - .userStatuses - .isNotEmpty && - selectMode == - SelectMode.normal; + selectMode != SelectMode.share; final displayShareStatus = selectMode == SelectMode.share && diff --git a/pubspec.lock b/pubspec.lock index 40e5e14..ff9b2ab 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -99,6 +99,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0-nullsafety.1" + circular_check_box: + dependency: "direct main" + description: + name: circular_check_box + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" cli_util: dependency: transitive description: @@ -526,7 +533,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" mime: dependency: transitive description: @@ -862,7 +869,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" stream_channel: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index d71bf77..55acd68 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,6 +60,7 @@ dependencies: flutter_olm: ^1.0.1 intl: ^0.16.1 intl_translation: ^0.17.9 + circular_check_box: ^1.0.4 flutter_localizations: sdk: flutter sqflite: ^1.1.7 # Still used to obtain the database location From ef2277889e997fd05297289956d94095decc9ddd Mon Sep 17 00:00:00 2001 From: Sorunome Date: Sat, 17 Oct 2020 12:26:16 +0200 Subject: [PATCH 5/9] chore: Update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d1dfed..5d7c031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,18 @@ # Version 0.20.0 - 2020-??-?? ### Features +- Added translations: Arabic - Add ability to enable / disable emotes globally - Add ability to manage emote packs with different state keys +- Add swipe to reply - Thanks @inexcode +- Initial support for compiling to desktop +- Initial snap metadata - Thanks @RAOF_47 ### Changes - Re-scale images in a separate isolate to prevent the UI from freezing - URLs without https:// now linkify ### Fixes - Fix amoled / theme settings not always saving properly - Show device name in account information correctly +- Fix tapping on aliases / room pills not always working # Version 0.19.0 - 2020-09-21 ### Features From 719323ad66493b77ca7bb3eef802d3cc2fa18d58 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sat, 17 Oct 2020 12:31:05 +0200 Subject: [PATCH 6/9] chore: Change default linux window size --- linux/my_application.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/my_application.cc b/linux/my_application.cc index 2111adc..6620bc0 100644 --- a/linux/my_application.cc +++ b/linux/my_application.cc @@ -19,7 +19,7 @@ static void my_application_activate(GApplication* application) { gtk_header_bar_set_title(header_bar, "fluffychat"); gtk_header_bar_set_show_close_button(header_bar, TRUE); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); - gtk_window_set_default_size(window, 1280, 720); + gtk_window_set_default_size(window, 802, 520); gtk_widget_show(GTK_WIDGET(window)); g_autoptr(FlDartProject) project = fl_dart_project_new(); From e9aa285f1ab5d2fbb22df75e3d848f05f22fa568 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sat, 17 Oct 2020 12:43:32 +0200 Subject: [PATCH 7/9] fix: Minor design fixes --- lib/components/list_items/message.dart | 3 +++ lib/views/chat.dart | 22 ++++++---------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/lib/components/list_items/message.dart b/lib/components/list_items/message.dart index 3c85288..3694b3d 100644 --- a/lib/components/list_items/message.dart +++ b/lib/components/list_items/message.dart @@ -8,6 +8,7 @@ import 'package:fluffychat/utils/string_color.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; +import '../adaptive_page_layout.dart'; import '../avatar.dart'; import '../matrix.dart'; import '../message_reactions.dart'; @@ -86,6 +87,8 @@ class Message extends StatelessWidget { color: color, borderRadius: BorderRadius.circular(radius), ), + constraints: + BoxConstraints(maxWidth: AdaptivePageLayout.defaultMinWidth), child: Stack( children: [ Column( diff --git a/lib/views/chat.dart b/lib/views/chat.dart index b3a3d8f..ee4e2ee 100644 --- a/lib/views/chat.dart +++ b/lib/views/chat.dart @@ -672,26 +672,16 @@ class _ChatState extends State<_Chat> { child: Swipeable( key: ValueKey( filteredEvents[i - 1].eventId), - background: Container( - color: Theme.of(context) - .primaryColor - .withAlpha(100), + background: Padding( padding: EdgeInsets.symmetric( horizontal: 12.0), - alignment: Alignment.centerLeft, - child: Row( - children: [ - Icon(Icons.reply), - SizedBox(width: 2.0), - Text(L10n.of(context).reply) - ], + child: Center( + child: Icon(Icons.reply), ), ), - direction: SwipeDirection.startToEnd, - onSwipe: (direction) { - replyAction( - replyTo: filteredEvents[i - 1]); - }, + direction: SwipeDirection.endToStart, + onSwipe: (direction) => replyAction( + replyTo: filteredEvents[i - 1]), child: Message(filteredEvents[i - 1], onAvatarTab: (Event event) { sendController.text += From a713a2f352953f45e40d138b09a681e07508aff2 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sat, 17 Oct 2020 13:04:33 +0200 Subject: [PATCH 8/9] fix: Minor design fix --- lib/views/chat.dart | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/views/chat.dart b/lib/views/chat.dart index ee4e2ee..50509a3 100644 --- a/lib/views/chat.dart +++ b/lib/views/chat.dart @@ -560,14 +560,11 @@ class _ChatState extends State<_Chat> { body: Stack( children: [ if (Matrix.of(context).wallpaper != null) - Opacity( - opacity: 0.66, - child: Image.file( - Matrix.of(context).wallpaper, - height: double.infinity, - width: double.infinity, - fit: BoxFit.cover, - ), + Image.file( + Matrix.of(context).wallpaper, + height: double.infinity, + width: double.infinity, + fit: BoxFit.cover, ), Column( children: [ @@ -812,8 +809,7 @@ class _ChatState extends State<_Chat> { room.canSendDefaultMessages && room.membership == Membership.join ? Container( decoration: BoxDecoration( - color: - Theme.of(context).backgroundColor.withOpacity(0.8), + color: Theme.of(context).backgroundColor, ), child: Row( crossAxisAlignment: CrossAxisAlignment.end, From 882754d67c7a72a34143755bb24f27e158b70ac1 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sat, 17 Oct 2020 17:44:40 +0000 Subject: [PATCH 9/9] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 55acd68..1a9ca8f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Chat with your friends. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.19.1+46 +version: 0.20.0+47 environment: sdk: ">=2.6.0 <3.0.0"