From f5e11c2a21ac3cce6a92b6896b8f9079040c4656 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Tue, 29 Dec 2020 10:43:32 +0100 Subject: [PATCH] feat: Regulate when thumbnails are animated as per MSC2705 --- lib/components/content_banner.dart | 1 + lib/components/html_message.dart | 1 + lib/components/image_bubble.dart | 13 ++++++++----- lib/components/input_bar.dart | 1 + lib/views/chat.dart | 4 ++-- pubspec.lock | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/components/content_banner.dart b/lib/components/content_banner.dart index 13bfca8e..7d8d81ed 100644 --- a/lib/components/content_banner.dart +++ b/lib/components/content_banner.dart @@ -30,6 +30,7 @@ class ContentBanner extends StatelessWidget { width: bannerSize, height: bannerSize, method: ThumbnailMethod.scale, + animated: true, ); return Container( height: 300, diff --git a/lib/components/html_message.dart b/lib/components/html_message.dart index 3e3864a0..bdac0a9d 100644 --- a/lib/components/html_message.dart +++ b/lib/components/html_message.dart @@ -60,6 +60,7 @@ class HtmlMessage extends StatelessWidget { width: (width ?? 800) * ratio, height: (height ?? 800) * ratio, method: ThumbnailMethod.scale, + animated: true, ); }, setCodeLanguage: (String key, String value) async { diff --git a/lib/components/image_bubble.dart b/lib/components/image_bubble.dart index fe426828..81b1f076 100644 --- a/lib/components/image_bubble.dart +++ b/lib/components/image_bubble.dart @@ -81,8 +81,9 @@ class _ImageBubbleState extends State { @override void initState() { - thumbnailUrl = widget.event.getAttachmentUrl(getThumbnail: true); - attachmentUrl = widget.event.getAttachmentUrl(); + thumbnailUrl = + widget.event.getAttachmentUrl(getThumbnail: true, animated: true); + attachmentUrl = widget.event.getAttachmentUrl(animated: true); if (thumbnailUrl == null) { _requestFile(getThumbnail: true); } @@ -196,9 +197,11 @@ class _ImageBubbleState extends State { WidgetsBinding.instance.addPostFrameCallback((_) { setState(() { thumbnailUrl = widget.event.getAttachmentUrl( - getThumbnail: true, useThumbnailMxcUrl: true); - attachmentUrl = - widget.event.getAttachmentUrl(useThumbnailMxcUrl: true); + getThumbnail: true, + useThumbnailMxcUrl: true, + animated: true); + attachmentUrl = widget.event + .getAttachmentUrl(useThumbnailMxcUrl: true, animated: true); }); }); } diff --git a/lib/components/input_bar.dart b/lib/components/input_bar.dart index e5629e63..5169c2d2 100644 --- a/lib/components/input_bar.dart +++ b/lib/components/input_bar.dart @@ -147,6 +147,7 @@ class InputBar extends StatelessWidget { width: size * ratio, height: size * ratio, method: ThumbnailMethod.scale, + animated: true, ); return Container( padding: EdgeInsets.all(4.0), diff --git a/lib/views/chat.dart b/lib/views/chat.dart index a3e712db..1f796a65 100644 --- a/lib/views/chat.dart +++ b/lib/views/chat.dart @@ -1084,7 +1084,7 @@ class _ChatState extends State<_Chat> { Timer(Duration(seconds: 2), () { typingCoolDown = null; currentlyTyping = false; - room.sendTypingInfo(false); + room.sendTypingNotification(false); }); typingTimeout ??= Timer(Duration(seconds: 30), () { @@ -1093,7 +1093,7 @@ class _ChatState extends State<_Chat> { }); if (!currentlyTyping) { currentlyTyping = true; - room.sendTypingInfo(true, + room.sendTypingNotification(true, timeout: Duration(seconds: 30) .inMilliseconds); } diff --git a/pubspec.lock b/pubspec.lock index d9aea970..e584bc62 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -202,7 +202,7 @@ packages: description: path: "." ref: main - resolved-ref: bce0c1d4856030e31338ea96218e9d8f11645dfb + resolved-ref: "03b9c6e2eec31c9645a0c7354fe90f8b1906efa8" url: "https://gitlab.com/famedly/famedlysdk.git" source: git version: "0.0.1"