feat: Regulate when thumbnails are animated as per MSC2705

This commit is contained in:
Sorunome 2020-12-29 10:43:32 +01:00
parent 92684da3c3
commit f5e11c2a21
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
6 changed files with 14 additions and 8 deletions

View File

@ -30,6 +30,7 @@ class ContentBanner extends StatelessWidget {
width: bannerSize, width: bannerSize,
height: bannerSize, height: bannerSize,
method: ThumbnailMethod.scale, method: ThumbnailMethod.scale,
animated: true,
); );
return Container( return Container(
height: 300, height: 300,

View File

@ -60,6 +60,7 @@ class HtmlMessage extends StatelessWidget {
width: (width ?? 800) * ratio, width: (width ?? 800) * ratio,
height: (height ?? 800) * ratio, height: (height ?? 800) * ratio,
method: ThumbnailMethod.scale, method: ThumbnailMethod.scale,
animated: true,
); );
}, },
setCodeLanguage: (String key, String value) async { setCodeLanguage: (String key, String value) async {

View File

@ -81,8 +81,9 @@ class _ImageBubbleState extends State<ImageBubble> {
@override @override
void initState() { void initState() {
thumbnailUrl = widget.event.getAttachmentUrl(getThumbnail: true); thumbnailUrl =
attachmentUrl = widget.event.getAttachmentUrl(); widget.event.getAttachmentUrl(getThumbnail: true, animated: true);
attachmentUrl = widget.event.getAttachmentUrl(animated: true);
if (thumbnailUrl == null) { if (thumbnailUrl == null) {
_requestFile(getThumbnail: true); _requestFile(getThumbnail: true);
} }
@ -196,9 +197,11 @@ class _ImageBubbleState extends State<ImageBubble> {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() { setState(() {
thumbnailUrl = widget.event.getAttachmentUrl( thumbnailUrl = widget.event.getAttachmentUrl(
getThumbnail: true, useThumbnailMxcUrl: true); getThumbnail: true,
attachmentUrl = useThumbnailMxcUrl: true,
widget.event.getAttachmentUrl(useThumbnailMxcUrl: true); animated: true);
attachmentUrl = widget.event
.getAttachmentUrl(useThumbnailMxcUrl: true, animated: true);
}); });
}); });
} }

View File

@ -147,6 +147,7 @@ class InputBar extends StatelessWidget {
width: size * ratio, width: size * ratio,
height: size * ratio, height: size * ratio,
method: ThumbnailMethod.scale, method: ThumbnailMethod.scale,
animated: true,
); );
return Container( return Container(
padding: EdgeInsets.all(4.0), padding: EdgeInsets.all(4.0),

View File

@ -1084,7 +1084,7 @@ class _ChatState extends State<_Chat> {
Timer(Duration(seconds: 2), () { Timer(Duration(seconds: 2), () {
typingCoolDown = null; typingCoolDown = null;
currentlyTyping = false; currentlyTyping = false;
room.sendTypingInfo(false); room.sendTypingNotification(false);
}); });
typingTimeout ??= typingTimeout ??=
Timer(Duration(seconds: 30), () { Timer(Duration(seconds: 30), () {
@ -1093,7 +1093,7 @@ class _ChatState extends State<_Chat> {
}); });
if (!currentlyTyping) { if (!currentlyTyping) {
currentlyTyping = true; currentlyTyping = true;
room.sendTypingInfo(true, room.sendTypingNotification(true,
timeout: Duration(seconds: 30) timeout: Duration(seconds: 30)
.inMilliseconds); .inMilliseconds);
} }

View File

@ -202,7 +202,7 @@ packages:
description: description:
path: "." path: "."
ref: main ref: main
resolved-ref: bce0c1d4856030e31338ea96218e9d8f11645dfb resolved-ref: "03b9c6e2eec31c9645a0c7354fe90f8b1906efa8"
url: "https://gitlab.com/famedly/famedlysdk.git" url: "https://gitlab.com/famedly/famedlysdk.git"
source: git source: git
version: "0.0.1" version: "0.0.1"