Update sdk for performance increases

This commit is contained in:
Sorunome 2020-07-02 09:30:59 +00:00 committed by Christian Pauly
parent 2ea6caca86
commit ddc328e4df
10 changed files with 23 additions and 19 deletions

View File

@ -196,7 +196,10 @@ class MatrixState extends State<Matrix> {
client = Client(widget.clientName, client = Client(widget.clientName,
debug: false, debug: false,
enableE2eeRecovery: true, enableE2eeRecovery: true,
verificationMethods: verificationMethods); verificationMethods: verificationMethods,
importantStateEvents: <String>{
'im.ponies.room_emotes', // we want emotes to work properly
});
onJitsiCallSub ??= client.onEvent.stream onJitsiCallSub ??= client.onEvent.stream
.where((e) => .where((e) =>
e.type == 'timeline' && e.type == 'timeline' &&

View File

@ -10,7 +10,7 @@ import 'package:mime_type/mime_type.dart';
extension MatrixFileExtension on MatrixFile { extension MatrixFileExtension on MatrixFile {
void open() async { void open() async {
if (kIsWeb) { if (kIsWeb) {
final fileName = path.split('/').last; final fileName = name.split('/').last;
final mimeType = mime(fileName); final mimeType = mime(fileName);
var element = html.document.createElement('a'); var element = html.document.createElement('a');
element.setAttribute( element.setAttribute(
@ -25,7 +25,7 @@ extension MatrixFileExtension on MatrixFile {
element.remove(); element.remove();
} else { } else {
var tempDir = await getTemporaryDirectory(); var tempDir = await getTemporaryDirectory();
final file = File(tempDir.path + '/' + path.split('/').last); final file = File(tempDir.path + '/' + name.split('/').last);
file.writeAsBytesSync(bytes); file.writeAsBytesSync(bytes);
await OpenFile.open(file.path); await OpenFile.open(file.path);
} }

View File

@ -190,7 +190,7 @@ class _ChatState extends State<_Chat> {
if (file == null) return; if (file == null) return;
await SimpleDialogs(context).tryRequestWithLoadingDialog( await SimpleDialogs(context).tryRequestWithLoadingDialog(
room.sendFileEvent( 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); maxHeight: 1600);
if (file == null) return; if (file == null) return;
await SimpleDialogs(context).tryRequestWithLoadingDialog( await SimpleDialogs(context).tryRequestWithLoadingDialog(
room.sendImageEvent( room.sendFileEvent(
MatrixFile(bytes: await file.bytes, path: file.path), MatrixImageFile(bytes: await file.bytes, name: file.path),
), ),
); );
} }
@ -217,8 +217,8 @@ class _ChatState extends State<_Chat> {
maxHeight: 1600); maxHeight: 1600);
if (file == null) return; if (file == null) return;
await SimpleDialogs(context).tryRequestWithLoadingDialog( await SimpleDialogs(context).tryRequestWithLoadingDialog(
room.sendImageEvent( room.sendFileEvent(
MatrixFile(bytes: file.bytes, path: file.path), MatrixImageFile(bytes: file.bytes, name: file.path),
), ),
); );
} }
@ -233,8 +233,9 @@ class _ChatState extends State<_Chat> {
if (result == null) return; if (result == null) return;
final audioFile = File(result); final audioFile = File(result);
await SimpleDialogs(context).tryRequestWithLoadingDialog( await SimpleDialogs(context).tryRequestWithLoadingDialog(
room.sendAudioEvent( room.sendFileEvent(
MatrixFile(bytes: audioFile.readAsBytesSync(), path: audioFile.path), MatrixAudioFile(
bytes: audioFile.readAsBytesSync(), name: audioFile.path),
), ),
); );
} }

View File

@ -111,7 +111,7 @@ class _ChatDetailsState extends State<ChatDetails> {
widget.room.setAvatar( widget.room.setAvatar(
MatrixFile( MatrixFile(
bytes: tempFile.bytes, bytes: tempFile.bytes,
path: tempFile.path, name: tempFile.path,
), ),
), ),
); );

View File

@ -137,7 +137,7 @@ class _ChatListState extends State<ChatList> {
'msgtype': 'chat.fluffy.shared_file', 'msgtype': 'chat.fluffy.shared_file',
'file': MatrixFile( 'file': MatrixFile(
bytes: file.readAsBytesSync(), bytes: file.readAsBytesSync(),
path: file.path, name: file.path,
), ),
}; };
} }

View File

@ -99,7 +99,7 @@ class _SettingsState extends State<Settings> {
matrix.client.setAvatar( matrix.client.setAvatar(
MatrixFile( MatrixFile(
bytes: tempFile.bytes, bytes: tempFile.bytes,
path: tempFile.path, name: tempFile.path,
), ),
), ),
); );

View File

@ -374,13 +374,13 @@ class _EmoteImagePickerState extends State<_EmoteImagePicker> {
maxWidth: 128, maxWidth: 128,
maxHeight: 128); maxHeight: 128);
if (file == null) return; if (file == null) return;
final matrixFile = MatrixFile(bytes: file.bytes, path: file.path); final matrixFile = MatrixFile(bytes: file.bytes, name: file.path);
final uploadResp = final uploadResp =
await SimpleDialogs(context).tryRequestWithLoadingDialog( await SimpleDialogs(context).tryRequestWithLoadingDialog(
Matrix.of(context) Matrix.of(context)
.client .client
.api .api
.upload(matrixFile.bytes, matrixFile.path), .upload(matrixFile.bytes, matrixFile.name),
); );
setState(() { setState(() {
widget.controller.text = uploadResp; widget.controller.text = uploadResp;

View File

@ -101,7 +101,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
await matrix.client.setAvatar( await matrix.client.setAvatar(
MatrixFile( MatrixFile(
bytes: widget.avatar.bytes, bytes: widget.avatar.bytes,
path: widget.avatar.path, name: widget.avatar.path,
), ),
); );
} catch (exception) { } catch (exception) {

View File

@ -168,8 +168,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: "28fd207f2a1c0fbba959b7ddbcd78fb8178bff67" ref: ac720df3d26985faef0b6d6a86a8013f44c5c6e3
resolved-ref: "28fd207f2a1c0fbba959b7ddbcd78fb8178bff67" resolved-ref: ac720df3d26985faef0b6d6a86a8013f44c5c6e3
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"

View File

@ -27,7 +27,7 @@ dependencies:
famedlysdk: famedlysdk:
git: git:
url: https://gitlab.com/famedly/famedlysdk.git url: https://gitlab.com/famedly/famedlysdk.git
ref: 28fd207f2a1c0fbba959b7ddbcd78fb8178bff67 ref: ac720df3d26985faef0b6d6a86a8013f44c5c6e3
localstorage: ^3.0.1+4 localstorage: ^3.0.1+4
bubble: ^1.1.9+1 bubble: ^1.1.9+1