From ddc328e4df19dcab261f7babb3c5895becae358d Mon Sep 17 00:00:00 2001 From: Sorunome Date: Thu, 2 Jul 2020 09:30:59 +0000 Subject: [PATCH] Update sdk for performance increases --- lib/components/matrix.dart | 5 ++++- lib/utils/matrix_file_extension.dart | 4 ++-- lib/views/chat.dart | 15 ++++++++------- lib/views/chat_details.dart | 2 +- lib/views/chat_list.dart | 2 +- lib/views/settings.dart | 2 +- lib/views/settings_emotes.dart | 4 ++-- lib/views/sign_up_password.dart | 2 +- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 10 files changed, 23 insertions(+), 19 deletions(-) diff --git a/lib/components/matrix.dart b/lib/components/matrix.dart index 240bcd16..aa59c82b 100644 --- a/lib/components/matrix.dart +++ b/lib/components/matrix.dart @@ -196,7 +196,10 @@ class MatrixState extends State { client = Client(widget.clientName, debug: false, enableE2eeRecovery: true, - verificationMethods: verificationMethods); + verificationMethods: verificationMethods, + importantStateEvents: { + 'im.ponies.room_emotes', // we want emotes to work properly + }); onJitsiCallSub ??= client.onEvent.stream .where((e) => e.type == 'timeline' && diff --git a/lib/utils/matrix_file_extension.dart b/lib/utils/matrix_file_extension.dart index 04cb7e40..f2c92b9b 100644 --- a/lib/utils/matrix_file_extension.dart +++ b/lib/utils/matrix_file_extension.dart @@ -10,7 +10,7 @@ import 'package:mime_type/mime_type.dart'; extension MatrixFileExtension on MatrixFile { void open() async { if (kIsWeb) { - final fileName = path.split('/').last; + final fileName = name.split('/').last; final mimeType = mime(fileName); var element = html.document.createElement('a'); element.setAttribute( @@ -25,7 +25,7 @@ extension MatrixFileExtension on MatrixFile { element.remove(); } else { var tempDir = await getTemporaryDirectory(); - final file = File(tempDir.path + '/' + path.split('/').last); + final file = File(tempDir.path + '/' + name.split('/').last); file.writeAsBytesSync(bytes); await OpenFile.open(file.path); } diff --git a/lib/views/chat.dart b/lib/views/chat.dart index d8e98170..c35a7334 100644 --- a/lib/views/chat.dart +++ b/lib/views/chat.dart @@ -190,7 +190,7 @@ class _ChatState extends State<_Chat> { if (file == null) return; await SimpleDialogs(context).tryRequestWithLoadingDialog( room.sendFileEvent( - MatrixFile(bytes: file.bytes, path: file.path), + MatrixFile(bytes: file.bytes, name: file.path), ), ); } @@ -203,8 +203,8 @@ class _ChatState extends State<_Chat> { maxHeight: 1600); if (file == null) return; await SimpleDialogs(context).tryRequestWithLoadingDialog( - room.sendImageEvent( - MatrixFile(bytes: await file.bytes, path: file.path), + room.sendFileEvent( + MatrixImageFile(bytes: await file.bytes, name: file.path), ), ); } @@ -217,8 +217,8 @@ class _ChatState extends State<_Chat> { maxHeight: 1600); if (file == null) return; await SimpleDialogs(context).tryRequestWithLoadingDialog( - room.sendImageEvent( - MatrixFile(bytes: file.bytes, path: file.path), + room.sendFileEvent( + MatrixImageFile(bytes: file.bytes, name: file.path), ), ); } @@ -233,8 +233,9 @@ class _ChatState extends State<_Chat> { if (result == null) return; final audioFile = File(result); await SimpleDialogs(context).tryRequestWithLoadingDialog( - room.sendAudioEvent( - MatrixFile(bytes: audioFile.readAsBytesSync(), path: audioFile.path), + room.sendFileEvent( + MatrixAudioFile( + bytes: audioFile.readAsBytesSync(), name: audioFile.path), ), ); } diff --git a/lib/views/chat_details.dart b/lib/views/chat_details.dart index fb184bb6..cf062e95 100644 --- a/lib/views/chat_details.dart +++ b/lib/views/chat_details.dart @@ -111,7 +111,7 @@ class _ChatDetailsState extends State { widget.room.setAvatar( MatrixFile( bytes: tempFile.bytes, - path: tempFile.path, + name: tempFile.path, ), ), ); diff --git a/lib/views/chat_list.dart b/lib/views/chat_list.dart index 2bd7dda9..ee90f9ca 100644 --- a/lib/views/chat_list.dart +++ b/lib/views/chat_list.dart @@ -137,7 +137,7 @@ class _ChatListState extends State { 'msgtype': 'chat.fluffy.shared_file', 'file': MatrixFile( bytes: file.readAsBytesSync(), - path: file.path, + name: file.path, ), }; } diff --git a/lib/views/settings.dart b/lib/views/settings.dart index 20c06a1a..af100fd4 100644 --- a/lib/views/settings.dart +++ b/lib/views/settings.dart @@ -99,7 +99,7 @@ class _SettingsState extends State { matrix.client.setAvatar( MatrixFile( bytes: tempFile.bytes, - path: tempFile.path, + name: tempFile.path, ), ), ); diff --git a/lib/views/settings_emotes.dart b/lib/views/settings_emotes.dart index e7c04821..8568385c 100644 --- a/lib/views/settings_emotes.dart +++ b/lib/views/settings_emotes.dart @@ -374,13 +374,13 @@ class _EmoteImagePickerState extends State<_EmoteImagePicker> { maxWidth: 128, maxHeight: 128); if (file == null) return; - final matrixFile = MatrixFile(bytes: file.bytes, path: file.path); + final matrixFile = MatrixFile(bytes: file.bytes, name: file.path); final uploadResp = await SimpleDialogs(context).tryRequestWithLoadingDialog( Matrix.of(context) .client .api - .upload(matrixFile.bytes, matrixFile.path), + .upload(matrixFile.bytes, matrixFile.name), ); setState(() { widget.controller.text = uploadResp; diff --git a/lib/views/sign_up_password.dart b/lib/views/sign_up_password.dart index 8cef8282..c2f9b203 100644 --- a/lib/views/sign_up_password.dart +++ b/lib/views/sign_up_password.dart @@ -101,7 +101,7 @@ class _SignUpPasswordState extends State { await matrix.client.setAvatar( MatrixFile( bytes: widget.avatar.bytes, - path: widget.avatar.path, + name: widget.avatar.path, ), ); } catch (exception) { diff --git a/pubspec.lock b/pubspec.lock index 4362c931..c7a6603b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -168,8 +168,8 @@ packages: dependency: "direct main" description: path: "." - ref: "28fd207f2a1c0fbba959b7ddbcd78fb8178bff67" - resolved-ref: "28fd207f2a1c0fbba959b7ddbcd78fb8178bff67" + ref: ac720df3d26985faef0b6d6a86a8013f44c5c6e3 + resolved-ref: ac720df3d26985faef0b6d6a86a8013f44c5c6e3 url: "https://gitlab.com/famedly/famedlysdk.git" source: git version: "0.0.1" diff --git a/pubspec.yaml b/pubspec.yaml index f9971f59..60db4c5d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -27,7 +27,7 @@ dependencies: famedlysdk: git: url: https://gitlab.com/famedly/famedlysdk.git - ref: 28fd207f2a1c0fbba959b7ddbcd78fb8178bff67 + ref: ac720df3d26985faef0b6d6a86a8013f44c5c6e3 localstorage: ^3.0.1+4 bubble: ^1.1.9+1