[MatrixFile] Use Uint8List instead of List<int>

This commit is contained in:
Lukas Lihotzki 2020-02-24 17:54:43 +01:00
parent ec16fa5f28
commit 3c78f11f2c
3 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,9 @@
/// Workaround until [File] in dart:io and dart:html is unified
import 'dart:typed_data';
class MatrixFile {
List<int> bytes;
Uint8List bytes;
String path;
MatrixFile({this.bytes, String path}) : this.path = path.toLowerCase();

View File

@ -23,6 +23,7 @@
import 'dart:async';
import 'dart:convert';
import 'dart:typed_data';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:famedlysdk/src/account_data.dart';
@ -433,7 +434,7 @@ void main() {
test('setAvatar', () async {
final MatrixFile testFile =
MatrixFile(bytes: [], path: "fake/path/file.jpeg");
MatrixFile(bytes: Uint8List(0), path: "fake/path/file.jpeg");
await matrix.setAvatar(testFile);
});

View File

@ -31,6 +31,8 @@ import 'package:test/test.dart';
import 'fake_matrix_api.dart';
import 'dart:typed_data';
void main() {
Client matrix;
Room room;
@ -322,7 +324,7 @@ void main() {
test('setAvatar', () async {
final MatrixFile testFile =
MatrixFile(bytes: [], path: "fake/path/file.jpeg");
MatrixFile(bytes: Uint8List(0), path: "fake/path/file.jpeg");
final dynamic resp = await room.setAvatar(testFile);
expect(resp, "YUwRidLecu:example.com");
});
@ -350,7 +352,7 @@ void main() {
test('sendFileEvent', () async {
final MatrixFile testFile =
MatrixFile(bytes: [], path: "fake/path/file.jpeg");
MatrixFile(bytes: Uint8List(0), path: "fake/path/file.jpeg");
final dynamic resp = await room.sendFileEvent(testFile,
msgType: "m.file", txid: "testtxid");
expect(resp, "42");