Merge branch 'matrixfile-refactor-uint8list' into 'master'
[MatrixFile] Use Uint8List instead of List<int> See merge request famedly/famedlysdk!227
This commit is contained in:
commit
73841bd2f6
|
@ -1,6 +1,9 @@
|
||||||
/// Workaround until [File] in dart:io and dart:html is unified
|
/// Workaround until [File] in dart:io and dart:html is unified
|
||||||
|
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
class MatrixFile {
|
class MatrixFile {
|
||||||
List<int> bytes;
|
Uint8List bytes;
|
||||||
String path;
|
String path;
|
||||||
|
|
||||||
MatrixFile({this.bytes, String path}) : this.path = path.toLowerCase();
|
MatrixFile({this.bytes, String path}) : this.path = path.toLowerCase();
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:famedlysdk/famedlysdk.dart';
|
import 'package:famedlysdk/famedlysdk.dart';
|
||||||
import 'package:famedlysdk/src/account_data.dart';
|
import 'package:famedlysdk/src/account_data.dart';
|
||||||
|
@ -433,7 +434,7 @@ void main() {
|
||||||
|
|
||||||
test('setAvatar', () async {
|
test('setAvatar', () async {
|
||||||
final MatrixFile testFile =
|
final MatrixFile testFile =
|
||||||
MatrixFile(bytes: [], path: "fake/path/file.jpeg");
|
MatrixFile(bytes: Uint8List(0), path: "fake/path/file.jpeg");
|
||||||
await matrix.setAvatar(testFile);
|
await matrix.setAvatar(testFile);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@ import 'package:test/test.dart';
|
||||||
|
|
||||||
import 'fake_matrix_api.dart';
|
import 'fake_matrix_api.dart';
|
||||||
|
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Client matrix;
|
Client matrix;
|
||||||
Room room;
|
Room room;
|
||||||
|
@ -322,7 +324,7 @@ void main() {
|
||||||
|
|
||||||
test('setAvatar', () async {
|
test('setAvatar', () async {
|
||||||
final MatrixFile testFile =
|
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);
|
final dynamic resp = await room.setAvatar(testFile);
|
||||||
expect(resp, "YUwRidLecu:example.com");
|
expect(resp, "YUwRidLecu:example.com");
|
||||||
});
|
});
|
||||||
|
@ -350,7 +352,7 @@ void main() {
|
||||||
|
|
||||||
test('sendFileEvent', () async {
|
test('sendFileEvent', () async {
|
||||||
final MatrixFile testFile =
|
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,
|
final dynamic resp = await room.sendFileEvent(testFile,
|
||||||
msgType: "m.file", txid: "testtxid");
|
msgType: "m.file", txid: "testtxid");
|
||||||
expect(resp, "42");
|
expect(resp, "42");
|
||||||
|
|
Loading…
Reference in a new issue