Merge branch 'soru/files' into 'master'

Update sdk for performance increases

See merge request ChristianPauly/fluffychat-flutter!99
This commit is contained in:
Christian Pauly 2020-07-02 09:30:59 +00:00
commit 2e1cca941f
10 changed files with 23 additions and 19 deletions

View file

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

View file

@ -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);
}

View file

@ -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),
),
);
}

View file

@ -111,7 +111,7 @@ class _ChatDetailsState extends State<ChatDetails> {
widget.room.setAvatar(
MatrixFile(
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',
'file': MatrixFile(
bytes: file.readAsBytesSync(),
path: file.path,
name: file.path,
),
};
}

View file

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

View file

@ -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;

View file

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

View file

@ -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"

View file

@ -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