diff --git a/CHANGELOG.md b/CHANGELOG.md index 0759a8d..88f2b22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Features - Implemented ignore list - Jump to events in timeline: When tapping on a reply and when tapping a matrix.to link +- Display messages with up to 10 emotes or emoji bigger ### Fixes - Timeline randomly resorting while more history is being fetched - Automatically request history if the "load more" button is on the screen diff --git a/lib/components/html_message.dart b/lib/components/html_message.dart index c7ea8b8..df508a4 100644 --- a/lib/components/html_message.dart +++ b/lib/components/html_message.dart @@ -11,13 +11,15 @@ class HtmlMessage extends StatelessWidget { final Room room; final TextStyle defaultTextStyle; final TextStyle linkStyle; + final double emoteSize; const HtmlMessage( {this.html, this.maxLines, this.room, this.defaultTextStyle, - this.linkStyle}); + this.linkStyle, + this.emoteSize}); @override Widget build(BuildContext context) { @@ -35,6 +37,7 @@ class HtmlMessage extends StatelessWidget { return Html( data: renderHtml, defaultTextStyle: defaultTextStyle, + emoteSize: emoteSize, linkStyle: linkStyle ?? themeData.textTheme.bodyText2.copyWith( color: themeData.accentColor, diff --git a/lib/components/message_content.dart b/lib/components/message_content.dart index 3142b48..093aa02 100644 --- a/lib/components/message_content.dart +++ b/lib/components/message_content.dart @@ -49,13 +49,16 @@ class MessageContent extends StatelessWidget { if (event.messageType == MessageTypes.Emote) { html = '* $html'; } + final bigEmotes = event.onlyEmotes && event.numberEmotes <= 10; + final fontSize = DefaultTextStyle.of(context).style.fontSize; return HtmlMessage( html: html, defaultTextStyle: TextStyle( color: textColor, - fontSize: DefaultTextStyle.of(context).style.fontSize, + fontSize: bigEmotes ? fontSize * 3 : fontSize, ), room: event.room, + emoteSize: bigEmotes ? fontSize * 3 : fontSize * 1.5, ); } // else we fall through to the normal message rendering @@ -78,11 +81,13 @@ class MessageContent extends StatelessWidget { onPressed: () => launch(event.body), ); } + final bigEmotes = event.onlyEmotes && event.numberEmotes <= 10; + final fontSize = DefaultTextStyle.of(context).style.fontSize; return LinkText( text: event.getLocalizedBody(L10n.of(context), hideReply: true), textStyle: TextStyle( color: textColor, - fontSize: DefaultTextStyle.of(context).style.fontSize, + fontSize: bigEmotes ? fontSize * 3 : fontSize, decoration: event.redacted ? TextDecoration.lineThrough : null, ), onLinkTap: (url) => UrlLauncher(context, url).launchUrl(), diff --git a/pubspec.lock b/pubspec.lock index 31f79aa..8b9eb84 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -180,8 +180,8 @@ packages: dependency: "direct main" description: path: "." - ref: "864cbfa9068f5bb285336ca73ab2551204e62044" - resolved-ref: "864cbfa9068f5bb285336ca73ab2551204e62044" + ref: ba7a01ddea430a6eec2661e2f9b7714d3719c652 + resolved-ref: ba7a01ddea430a6eec2661e2f9b7714d3719c652 url: "https://gitlab.com/famedly/famedlysdk.git" source: git version: "0.0.1" @@ -306,7 +306,7 @@ packages: name: flutter_matrix_html url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" flutter_olm: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index f909154..328d286 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -27,7 +27,7 @@ dependencies: famedlysdk: git: url: https://gitlab.com/famedly/famedlysdk.git - ref: 864cbfa9068f5bb285336ca73ab2551204e62044 + ref: ba7a01ddea430a6eec2661e2f9b7714d3719c652 localstorage: ^3.0.1+4 memoryfilepicker: ^0.1.3 @@ -50,7 +50,7 @@ dependencies: open_file: ^3.0.1 mime_type: ^0.3.0 bot_toast: ^3.0.0 - flutter_matrix_html: ^0.1.4 + flutter_matrix_html: ^0.1.5 moor: ^3.3.1 sqlite3: ^0.1.4 random_string: ^2.0.1