diff --git a/lib/famedlysdk.dart b/lib/famedlysdk.dart
index 145ffd5..453fc38 100644
--- a/lib/famedlysdk.dart
+++ b/lib/famedlysdk.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
library famedlysdk;
@@ -33,4 +33,4 @@ export 'package:famedlysdk/src/Connection.dart';
export 'package:famedlysdk/src/Event.dart';
export 'package:famedlysdk/src/Room.dart';
export 'package:famedlysdk/src/Store.dart';
-export 'package:famedlysdk/src/User.dart';
\ No newline at end of file
+export 'package:famedlysdk/src/User.dart';
diff --git a/lib/src/Client.dart b/lib/src/Client.dart
index 3ae68cb..c83fad2 100644
--- a/lib/src/Client.dart
+++ b/lib/src/Client.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'dart:async';
diff --git a/lib/src/Connection.dart b/lib/src/Connection.dart
index 77d3c25..ede7d86 100644
--- a/lib/src/Connection.dart
+++ b/lib/src/Connection.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'dart:async';
diff --git a/lib/src/Event.dart b/lib/src/Event.dart
index 373d342..37851ae 100644
--- a/lib/src/Event.dart
+++ b/lib/src/Event.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'dart:convert';
@@ -29,7 +29,6 @@ import './Room.dart';
/// A single Matrix event, e.g. a message in a chat.
class Event {
-
/// The Matrix ID for this event in the format '$localpart:server.abc'.
final String id;
@@ -56,9 +55,12 @@ class Event {
int status;
/// The json payload of the content. The content highly depends on the type.
- final Map content;
+ final Map content;
- Event(this.id, this.sender, this.time,{
+ Event(
+ this.id,
+ this.sender,
+ this.time, {
this.room,
this.stateKey,
this.status = 2,
@@ -73,7 +75,7 @@ class Event {
String get formattedText => content["formatted_body"] ?? "";
/// Use this to get the body.
- String getBody () {
+ String getBody() {
if (text != "") return text;
if (formattedText != "") return formattedText;
return "*** Unable to parse Content ***";
@@ -82,36 +84,52 @@ class Event {
/// Get the real type.
EventTypes get type {
switch (environment) {
- case "m.room.avatar": return EventTypes.RoomAvatar;
- case "m.room.name": return EventTypes.RoomName;
- case "m.room.topic": return EventTypes.RoomTopic;
- case "m.room.Aliases": return EventTypes.RoomAliases;
- case "m.room.canonical_alias": return EventTypes.RoomCanonicalAlias;
- case "m.room.create": return EventTypes.RoomCreate;
- case "m.room.join_rules": return EventTypes.RoomJoinRules;
- case "m.room.member": return EventTypes.RoomMember;
- case "m.room.power_levels": return EventTypes.RoomPowerLevels;
+ case "m.room.avatar":
+ return EventTypes.RoomAvatar;
+ case "m.room.name":
+ return EventTypes.RoomName;
+ case "m.room.topic":
+ return EventTypes.RoomTopic;
+ case "m.room.Aliases":
+ return EventTypes.RoomAliases;
+ case "m.room.canonical_alias":
+ return EventTypes.RoomCanonicalAlias;
+ case "m.room.create":
+ return EventTypes.RoomCreate;
+ case "m.room.join_rules":
+ return EventTypes.RoomJoinRules;
+ case "m.room.member":
+ return EventTypes.RoomMember;
+ case "m.room.power_levels":
+ return EventTypes.RoomPowerLevels;
case "m.room.message":
- switch(content["msgtype"] ?? "m.text") {
- case "m.text": return EventTypes.Text;
- case "m.notice": return EventTypes.Notice;
- case "m.emote": return EventTypes.Emote;
- case "m.image": return EventTypes.Image;
- case "m.video": return EventTypes.Video;
- case "m.audio": return EventTypes.Audio;
- case "m.file": return EventTypes.File;
- case "m.location": return EventTypes.Location;
+ switch (content["msgtype"] ?? "m.text") {
+ case "m.text":
+ return EventTypes.Text;
+ case "m.notice":
+ return EventTypes.Notice;
+ case "m.emote":
+ return EventTypes.Emote;
+ case "m.image":
+ return EventTypes.Image;
+ case "m.video":
+ return EventTypes.Video;
+ case "m.audio":
+ return EventTypes.Audio;
+ case "m.file":
+ return EventTypes.File;
+ case "m.location":
+ return EventTypes.Location;
}
}
-
}
/// Generate a new Event object from a json string, mostly a table row.
static Event fromJson(Map jsonObj, Room room) {
- Map content;
+ Map content;
try {
content = json.decode(jsonObj["content_json"]);
- } catch(e) {
+ } catch (e) {
print("jsonObj decode of event content failed: ${e.toString()}");
content = {};
}
@@ -128,11 +146,10 @@ class Event {
}
@Deprecated("Use [client.store.getEventList(Room room)] instead!")
- static Future> getEventList(Client matrix, Room room) async{
+ static Future> getEventList(Client matrix, Room room) async {
List eventList = await matrix.store.getEventList(room);
return eventList;
}
-
}
enum EventTypes {
@@ -155,9 +172,9 @@ enum EventTypes {
RoomAvatar,
}
-final Map StatusTypes = {
+final Map StatusTypes = {
"ERROR": -1,
"SENDING": 0,
"SENT": 1,
"RECEIVED": 2,
-};
\ No newline at end of file
+};
diff --git a/lib/src/Room.dart b/lib/src/Room.dart
index a4ac9c8..0ff0420 100644
--- a/lib/src/Room.dart
+++ b/lib/src/Room.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'package:famedlysdk/src/Client.dart';
diff --git a/lib/src/Store.dart b/lib/src/Store.dart
index 13f244a..979294d 100644
--- a/lib/src/Store.dart
+++ b/lib/src/Store.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'dart:async';
diff --git a/lib/src/User.dart b/lib/src/User.dart
index e14c1b9..aff9122 100644
--- a/lib/src/User.dart
+++ b/lib/src/User.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'package:famedlysdk/src/responses/ErrorResponse.dart';
diff --git a/lib/src/responses/ErrorResponse.dart b/lib/src/responses/ErrorResponse.dart
index 02ff30b..ff674be 100644
--- a/lib/src/responses/ErrorResponse.dart
+++ b/lib/src/responses/ErrorResponse.dart
@@ -18,14 +18,13 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'package:http/http.dart' as http;
/// Represents a special response from the Homeserver for errors.
class ErrorResponse {
-
/// The unique identifier for this error.
String errcode;
diff --git a/lib/src/sync/EventUpdate.dart b/lib/src/sync/EventUpdate.dart
index 66307fa..41c40b0 100644
--- a/lib/src/sync/EventUpdate.dart
+++ b/lib/src/sync/EventUpdate.dart
@@ -18,13 +18,12 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
/// Represents a new event (e.g. a message in a room) or an update for an
/// already known event.
class EventUpdate {
-
/// Usually 'timeline', 'state' or whatever.
final String eventType;
diff --git a/lib/src/sync/RoomUpdate.dart b/lib/src/sync/RoomUpdate.dart
index 58573eb..1b1db37 100644
--- a/lib/src/sync/RoomUpdate.dart
+++ b/lib/src/sync/RoomUpdate.dart
@@ -18,13 +18,12 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
/// Represents a new room or an update for an
/// already known room.
class RoomUpdate {
-
/// All rooms have an idea in the format: !uniqueid:server.abc
final String id;
diff --git a/lib/src/sync/UserUpdate.dart b/lib/src/sync/UserUpdate.dart
index 89e101b..f4d36a7 100644
--- a/lib/src/sync/UserUpdate.dart
+++ b/lib/src/sync/UserUpdate.dart
@@ -18,12 +18,11 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
/// Represents a new global event like presence or account_data.
class UserUpdate {
-
/// Usually 'presence', 'account_data' or whatever.
final String eventType;
diff --git a/lib/src/utils/ChatTime.dart b/lib/src/utils/ChatTime.dart
index bc96296..5b57e81 100644
--- a/lib/src/utils/ChatTime.dart
+++ b/lib/src/utils/ChatTime.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
// TODO: localize this!
@@ -32,8 +32,7 @@ class ChatTime {
/// Insert with a timestamp [ts] which represents the milliseconds since
/// the Unix epoch.
ChatTime(num ts) {
- if (ts != null)
- dateTime = DateTime.fromMillisecondsSinceEpoch(ts);
+ if (ts != null) dateTime = DateTime.fromMillisecondsSinceEpoch(ts);
}
/// Returns a ChatTime object which represents the current time.
@@ -51,12 +50,16 @@ class ChatTime {
bool sameDay =
sameYear && now.month == dateTime.month && now.day == dateTime.day;
- bool sameWeek = sameYear && !sameDay && now.millisecondsSinceEpoch - dateTime.millisecondsSinceEpoch < 1000*60*60*24*7;
+ bool sameWeek = sameYear &&
+ !sameDay &&
+ now.millisecondsSinceEpoch - dateTime.millisecondsSinceEpoch <
+ 1000 * 60 * 60 * 24 * 7;
if (sameDay) {
return toTimeString();
} else if (sameWeek) {
- switch (dateTime.weekday) { // TODO: Needs localization
+ switch (dateTime.weekday) {
+ // TODO: Needs localization
case 1:
return "Montag";
case 2:
@@ -102,8 +105,9 @@ class ChatTime {
operator ==(dynamic other) {
if (other is ChatTime)
- return this.toTimeStamp() == other.toTimeStamp();
- else return false;
+ return this.toTimeStamp() == other.toTimeStamp();
+ else
+ return false;
}
/// Two message events can belong to the same environment. That means that they
@@ -114,7 +118,8 @@ class ChatTime {
/// Checks if two ChatTimes are close enough to belong to the same
/// environment.
bool sameEnvironment(ChatTime prevTime) {
- return toTimeStamp() - prevTime.toTimeStamp() < 1000*60*minutesBetweenEnvironments;
+ return toTimeStamp() - prevTime.toTimeStamp() <
+ 1000 * 60 * minutesBetweenEnvironments;
}
/// Returns a simple time String.
diff --git a/lib/src/utils/MxContent.dart b/lib/src/utils/MxContent.dart
index 335b962..d7a0c23 100644
--- a/lib/src/utils/MxContent.dart
+++ b/lib/src/utils/MxContent.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'package:famedlysdk/src/Client.dart';
diff --git a/test/ChatTime_test.dart b/test/ChatTime_test.dart
index a1c9e5e..cdfd512 100644
--- a/test/ChatTime_test.dart
+++ b/test/ChatTime_test.dart
@@ -18,30 +18,29 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'package:flutter_test/flutter_test.dart';
import 'package:famedlysdk/src/utils/ChatTime.dart';
void main() {
-
-
/// All Tests related to the ChatTime
group("ChatTime", () {
-
test("Comparing", () async {
- final int originServerTs = DateTime.now().millisecondsSinceEpoch - (ChatTime.minutesBetweenEnvironments-1)*1000*60;
- final int oldOriginServerTs = DateTime.now().millisecondsSinceEpoch - (ChatTime.minutesBetweenEnvironments+1)*1000*60;
+ final int originServerTs = DateTime.now().millisecondsSinceEpoch -
+ (ChatTime.minutesBetweenEnvironments - 1) * 1000 * 60;
+ final int oldOriginServerTs = DateTime.now().millisecondsSinceEpoch -
+ (ChatTime.minutesBetweenEnvironments + 1) * 1000 * 60;
final ChatTime chatTime = ChatTime(originServerTs);
final ChatTime oldChatTime = ChatTime(oldOriginServerTs);
final ChatTime nowTime = ChatTime.now();
expect(chatTime.toTimeStamp(), originServerTs);
- expect(nowTime.toTimeStamp()>chatTime.toTimeStamp(),true);
- expect(nowTime.sameEnvironment(chatTime),true);
- expect(nowTime.sameEnvironment(oldChatTime),false);
+ expect(nowTime.toTimeStamp() > chatTime.toTimeStamp(), true);
+ expect(nowTime.sameEnvironment(chatTime), true);
+ expect(nowTime.sameEnvironment(oldChatTime), false);
expect(chatTime > oldChatTime, true);
expect(chatTime < oldChatTime, false);
@@ -55,10 +54,10 @@ void main() {
final int timestamp = DateTime.now().millisecondsSinceEpoch;
final ChatTime chatTime = ChatTime(timestamp);
//expect(chatTime.toTimeString(),"05:36"); // This depends on the time and your timezone ;)
- expect(chatTime.toTimeString(),chatTime.toEventTimeString());
+ expect(chatTime.toTimeString(), chatTime.toEventTimeString());
final ChatTime oldChatTime = ChatTime(156014498475);
- expect(oldChatTime.toString(),"11.12.1974");
+ expect(oldChatTime.toString(), "11.12.1974");
});
});
}
diff --git a/test/Client_test.dart b/test/Client_test.dart
index 1ba8488..f71aa35 100644
--- a/test/Client_test.dart
+++ b/test/Client_test.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'package:famedlysdk/src/responses/PushrulesResponse.dart';
diff --git a/test/Event_test.dart b/test/Event_test.dart
index 959fd92..0eb9d7c 100644
--- a/test/Event_test.dart
+++ b/test/Event_test.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'package:flutter_test/flutter_test.dart';
diff --git a/test/FakeMatrixApi.dart b/test/FakeMatrixApi.dart
index f27b057..2b35ae8 100644
--- a/test/FakeMatrixApi.dart
+++ b/test/FakeMatrixApi.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'package:http/testing.dart';
@@ -90,193 +90,150 @@ class FakeMatrixApi extends MockClient {
]
},
"/client/r0/pushrules": (var req) => {
- "global": {
- "content": [
- {
- "actions": [
- "notify",
+ "global": {
+ "content": [
{
- "set_tweak": "sound",
- "value": "default"
- },
- {
- "set_tweak": "highlight"
+ "actions": [
+ "notify",
+ {"set_tweak": "sound", "value": "default"},
+ {"set_tweak": "highlight"}
+ ],
+ "default": true,
+ "enabled": true,
+ "pattern": "alice",
+ "rule_id": ".m.rule.contains_user_name"
}
],
- "default": true,
- "enabled": true,
- "pattern": "alice",
- "rule_id": ".m.rule.contains_user_name"
+ "override": [
+ {
+ "actions": ["dont_notify"],
+ "conditions": [],
+ "default": true,
+ "enabled": false,
+ "rule_id": ".m.rule.master"
+ },
+ {
+ "actions": ["dont_notify"],
+ "conditions": [
+ {
+ "key": "content.msgtype",
+ "kind": "event_match",
+ "pattern": "m.notice"
+ }
+ ],
+ "default": true,
+ "enabled": true,
+ "rule_id": ".m.rule.suppress_notices"
+ }
+ ],
+ "room": [],
+ "sender": [],
+ "underride": [
+ {
+ "actions": [
+ "notify",
+ {"set_tweak": "sound", "value": "ring"},
+ {"set_tweak": "highlight", "value": false}
+ ],
+ "conditions": [
+ {
+ "key": "type",
+ "kind": "event_match",
+ "pattern": "m.call.invite"
+ }
+ ],
+ "default": true,
+ "enabled": true,
+ "rule_id": ".m.rule.call"
+ },
+ {
+ "actions": [
+ "notify",
+ {"set_tweak": "sound", "value": "default"},
+ {"set_tweak": "highlight"}
+ ],
+ "conditions": [
+ {"kind": "contains_display_name"}
+ ],
+ "default": true,
+ "enabled": true,
+ "rule_id": ".m.rule.contains_display_name"
+ },
+ {
+ "actions": [
+ "notify",
+ {"set_tweak": "sound", "value": "default"},
+ {"set_tweak": "highlight", "value": false}
+ ],
+ "conditions": [
+ {"is": "2", "kind": "room_member_count"}
+ ],
+ "default": true,
+ "enabled": true,
+ "rule_id": ".m.rule.room_one_to_one"
+ },
+ {
+ "actions": [
+ "notify",
+ {"set_tweak": "sound", "value": "default"},
+ {"set_tweak": "highlight", "value": false}
+ ],
+ "conditions": [
+ {
+ "key": "type",
+ "kind": "event_match",
+ "pattern": "m.room.member"
+ },
+ {
+ "key": "content.membership",
+ "kind": "event_match",
+ "pattern": "invite"
+ },
+ {
+ "key": "state_key",
+ "kind": "event_match",
+ "pattern": "@alice:example.com"
+ }
+ ],
+ "default": true,
+ "enabled": true,
+ "rule_id": ".m.rule.invite_for_me"
+ },
+ {
+ "actions": [
+ "notify",
+ {"set_tweak": "highlight", "value": false}
+ ],
+ "conditions": [
+ {
+ "key": "type",
+ "kind": "event_match",
+ "pattern": "m.room.member"
+ }
+ ],
+ "default": true,
+ "enabled": true,
+ "rule_id": ".m.rule.member_event"
+ },
+ {
+ "actions": [
+ "notify",
+ {"set_tweak": "highlight", "value": false}
+ ],
+ "conditions": [
+ {
+ "key": "type",
+ "kind": "event_match",
+ "pattern": "m.room.message"
+ }
+ ],
+ "default": true,
+ "enabled": true,
+ "rule_id": ".m.rule.message"
+ }
+ ]
}
- ],
- "override": [
- {
- "actions": [
- "dont_notify"
- ],
- "conditions": [],
- "default": true,
- "enabled": false,
- "rule_id": ".m.rule.master"
- },
- {
- "actions": [
- "dont_notify"
- ],
- "conditions": [
- {
- "key": "content.msgtype",
- "kind": "event_match",
- "pattern": "m.notice"
- }
- ],
- "default": true,
- "enabled": true,
- "rule_id": ".m.rule.suppress_notices"
- }
- ],
- "room": [],
- "sender": [],
- "underride": [
- {
- "actions": [
- "notify",
- {
- "set_tweak": "sound",
- "value": "ring"
- },
- {
- "set_tweak": "highlight",
- "value": false
- }
- ],
- "conditions": [
- {
- "key": "type",
- "kind": "event_match",
- "pattern": "m.call.invite"
- }
- ],
- "default": true,
- "enabled": true,
- "rule_id": ".m.rule.call"
- },
- {
- "actions": [
- "notify",
- {
- "set_tweak": "sound",
- "value": "default"
- },
- {
- "set_tweak": "highlight"
- }
- ],
- "conditions": [
- {
- "kind": "contains_display_name"
- }
- ],
- "default": true,
- "enabled": true,
- "rule_id": ".m.rule.contains_display_name"
- },
- {
- "actions": [
- "notify",
- {
- "set_tweak": "sound",
- "value": "default"
- },
- {
- "set_tweak": "highlight",
- "value": false
- }
- ],
- "conditions": [
- {
- "is": "2",
- "kind": "room_member_count"
- }
- ],
- "default": true,
- "enabled": true,
- "rule_id": ".m.rule.room_one_to_one"
- },
- {
- "actions": [
- "notify",
- {
- "set_tweak": "sound",
- "value": "default"
- },
- {
- "set_tweak": "highlight",
- "value": false
- }
- ],
- "conditions": [
- {
- "key": "type",
- "kind": "event_match",
- "pattern": "m.room.member"
- },
- {
- "key": "content.membership",
- "kind": "event_match",
- "pattern": "invite"
- },
- {
- "key": "state_key",
- "kind": "event_match",
- "pattern": "@alice:example.com"
- }
- ],
- "default": true,
- "enabled": true,
- "rule_id": ".m.rule.invite_for_me"
- },
- {
- "actions": [
- "notify",
- {
- "set_tweak": "highlight",
- "value": false
- }
- ],
- "conditions": [
- {
- "key": "type",
- "kind": "event_match",
- "pattern": "m.room.member"
- }
- ],
- "default": true,
- "enabled": true,
- "rule_id": ".m.rule.member_event"
- },
- {
- "actions": [
- "notify",
- {
- "set_tweak": "highlight",
- "value": false
- }
- ],
- "conditions": [
- {
- "key": "type",
- "kind": "event_match",
- "pattern": "m.room.message"
- }
- ],
- "default": true,
- "enabled": true,
- "rule_id": ".m.rule.message"
- }
- ]
- }
- },
+ },
"/client/r0/sync": (var req) => {
"next_batch": Random().nextDouble().toString(),
"presence": {
diff --git a/test/MxContent_test.dart b/test/MxContent_test.dart
index 3b2dec4..cfdc5ca 100644
--- a/test/MxContent_test.dart
+++ b/test/MxContent_test.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'package:flutter_test/flutter_test.dart';
@@ -26,20 +26,22 @@ import 'package:famedlysdk/src/Client.dart';
import 'package:famedlysdk/src/utils/MxContent.dart';
void main() {
-
-
/// All Tests related to the MxContent
group("MxContent", () {
-
test("Formatting", () async {
Client client = Client("testclient");
client.homeserver = "https://testserver.abc";
final String mxc = "mxc://exampleserver.abc/abcdefghijklmn";
final MxContent content = MxContent(mxc);
- expect(content.getDownloadLink(client),"${client.homeserver}/_matrix/media/r0/download/exampleserver.abc/abcdefghijklmn");
- expect(content.getThumbnail(client, width: 50, height: 50),"${client.homeserver}/_matrix/media/r0/thumbnail/exampleserver.abc/abcdefghijklmn?width=50&height=50&method=crop");
- expect(content.getThumbnail(client, width: 50, height: 50, method: ThumbnailMethod.scale),"${client.homeserver}/_matrix/media/r0/thumbnail/exampleserver.abc/abcdefghijklmn?width=50&height=50&method=scale");
+ expect(content.getDownloadLink(client),
+ "${client.homeserver}/_matrix/media/r0/download/exampleserver.abc/abcdefghijklmn");
+ expect(content.getThumbnail(client, width: 50, height: 50),
+ "${client.homeserver}/_matrix/media/r0/thumbnail/exampleserver.abc/abcdefghijklmn?width=50&height=50&method=crop");
+ expect(
+ content.getThumbnail(client,
+ width: 50, height: 50, method: ThumbnailMethod.scale),
+ "${client.homeserver}/_matrix/media/r0/thumbnail/exampleserver.abc/abcdefghijklmn?width=50&height=50&method=scale");
});
});
}
diff --git a/test/Room_test.dart b/test/Room_test.dart
index 2ee4835..2b8557a 100644
--- a/test/Room_test.dart
+++ b/test/Room_test.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'package:flutter_test/flutter_test.dart';
diff --git a/test/User_test.dart b/test/User_test.dart
index 9387dd5..6991ff5 100644
--- a/test/User_test.dart
+++ b/test/User_test.dart
@@ -18,7 +18,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see .
+ * along with famedlysdk. If not, see .
*/
import 'package:flutter_test/flutter_test.dart';
@@ -28,14 +28,13 @@ void main() {
/// All Tests related to the Event
group("User", () {
test("Create from json", () async {
-
final String id = "@alice:server.abc";
final String membership = "join";
final String displayName = "Alice";
final String avatarUrl = "";
final int powerLevel = 50;
- final Map jsonObj = {
+ final Map jsonObj = {
"matrix_id": id,
"displayname": displayName,
"avatar_url": avatarUrl,
@@ -45,13 +44,12 @@ void main() {
User user = User.fromJson(jsonObj, null);
- expect(user.id,id);
- expect(user.membership,membership);
- expect(user.displayName,displayName);
- expect(user.avatarUrl.mxc,avatarUrl);
- expect(user.powerLevel,powerLevel);
- expect(user.calcDisplayname(),displayName);
-
+ expect(user.id, id);
+ expect(user.membership, membership);
+ expect(user.displayName, displayName);
+ expect(user.avatarUrl.mxc, avatarUrl);
+ expect(user.powerLevel, powerLevel);
+ expect(user.calcDisplayname(), displayName);
});
});
}