chore: merge api_lite and dart sdk
This commit is contained in:
parent
691190f07a
commit
cd94cf62a8
|
|
@ -28,7 +28,7 @@ import 'dart:math';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:http/testing.dart';
|
import 'package:http/testing.dart';
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
Map<String, Object?> decodeJson(dynamic data) {
|
Map<String, Object?> decodeJson(dynamic data) {
|
||||||
if (data is String) {
|
if (data is String) {
|
||||||
|
|
@ -1947,9 +1947,9 @@ class FakeMatrixApi extends MockClient {
|
||||||
'total_room_count_estimate': 115
|
'total_room_count_estimate': 115
|
||||||
},
|
},
|
||||||
'/client/v3/keys/claim': (dynamic req) {
|
'/client/v3/keys/claim': (dynamic req) {
|
||||||
final request = decodeJson(req)["one_time_keys"];
|
final request = decodeJson(req)['one_time_keys'];
|
||||||
final keys = (request is Map<String, Object?>)
|
final keys = (request is Map<String, Object?>)
|
||||||
? request["one_time_keys"] as Map<String, Object?>?
|
? request['one_time_keys'] as Map<String, Object?>?
|
||||||
: null;
|
: null;
|
||||||
return {
|
return {
|
||||||
'failures': <String, Object?>{},
|
'failures': <String, Object?>{},
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
/// Matrix SDK written in pure Dart.
|
/// Matrix SDK written in pure Dart.
|
||||||
library matrix;
|
library matrix;
|
||||||
|
|
||||||
export 'package:matrix_api_lite/matrix_api_lite.dart';
|
export 'matrix_api_lite.dart';
|
||||||
|
|
||||||
export 'src/client.dart';
|
export 'src/client.dart';
|
||||||
export 'src/database/database_api.dart';
|
export 'src/database/database_api.dart';
|
||||||
|
|
|
||||||
|
|
@ -23,46 +23,46 @@
|
||||||
|
|
||||||
library matrix_api_lite;
|
library matrix_api_lite;
|
||||||
|
|
||||||
export 'src/generated/model.dart';
|
export 'matrix_api_lite/generated/model.dart';
|
||||||
export 'src/matrix_api.dart';
|
export 'matrix_api_lite/matrix_api.dart';
|
||||||
export 'src/model/algorithm_types.dart';
|
export 'matrix_api_lite/model/algorithm_types.dart';
|
||||||
export 'src/model/auth/authentication_data.dart';
|
export 'matrix_api_lite/model/auth/authentication_data.dart';
|
||||||
export 'src/model/auth/authentication_identifier.dart';
|
export 'matrix_api_lite/model/auth/authentication_identifier.dart';
|
||||||
export 'src/model/auth/authentication_password.dart';
|
export 'matrix_api_lite/model/auth/authentication_password.dart';
|
||||||
export 'src/model/auth/authentication_phone_identifier.dart';
|
export 'matrix_api_lite/model/auth/authentication_phone_identifier.dart';
|
||||||
export 'src/model/auth/authentication_recaptcha.dart';
|
export 'matrix_api_lite/model/auth/authentication_recaptcha.dart';
|
||||||
export 'src/model/auth/authentication_third_party_identifier.dart';
|
export 'matrix_api_lite/model/auth/authentication_third_party_identifier.dart';
|
||||||
export 'src/model/auth/authentication_three_pid_creds.dart';
|
export 'matrix_api_lite/model/auth/authentication_three_pid_creds.dart';
|
||||||
export 'src/model/auth/authentication_token.dart';
|
export 'matrix_api_lite/model/auth/authentication_token.dart';
|
||||||
export 'src/model/auth/authentication_types.dart';
|
export 'matrix_api_lite/model/auth/authentication_types.dart';
|
||||||
export 'src/model/auth/authentication_user_identifier.dart';
|
export 'matrix_api_lite/model/auth/authentication_user_identifier.dart';
|
||||||
export 'src/model/basic_event.dart';
|
export 'matrix_api_lite/model/basic_event.dart';
|
||||||
export 'src/model/basic_event_with_sender.dart';
|
export 'matrix_api_lite/model/basic_event_with_sender.dart';
|
||||||
export 'src/model/basic_room_event.dart';
|
export 'matrix_api_lite/model/basic_room_event.dart';
|
||||||
export 'src/model/event_types.dart';
|
export 'matrix_api_lite/model/event_types.dart';
|
||||||
export 'src/model/events/forwarded_room_key_content.dart';
|
export 'matrix_api_lite/model/events/forwarded_room_key_content.dart';
|
||||||
export 'src/model/events/image_pack_content.dart';
|
export 'matrix_api_lite/model/events/image_pack_content.dart';
|
||||||
export 'src/model/events/olm_plaintext_payload.dart';
|
export 'matrix_api_lite/model/events/olm_plaintext_payload.dart';
|
||||||
export 'src/model/events/room_encrypted_content.dart';
|
export 'matrix_api_lite/model/events/room_encrypted_content.dart';
|
||||||
export 'src/model/events/room_encryption_content.dart';
|
export 'matrix_api_lite/model/events/room_encryption_content.dart';
|
||||||
export 'src/model/events/room_key_content.dart';
|
export 'matrix_api_lite/model/events/room_key_content.dart';
|
||||||
export 'src/model/events/room_key_request_content.dart';
|
export 'matrix_api_lite/model/events/room_key_request_content.dart';
|
||||||
export 'src/model/events/secret_storage_default_key_content.dart';
|
export 'matrix_api_lite/model/events/secret_storage_default_key_content.dart';
|
||||||
export 'src/model/events/secret_storage_key_content.dart';
|
export 'matrix_api_lite/model/events/secret_storage_key_content.dart';
|
||||||
export 'src/model/events/tombstone_content.dart';
|
export 'matrix_api_lite/model/events/tombstone_content.dart';
|
||||||
export 'src/model/matrix_connection_exception.dart';
|
export 'matrix_api_lite/model/matrix_connection_exception.dart';
|
||||||
export 'src/model/matrix_event.dart';
|
export 'matrix_api_lite/model/matrix_event.dart';
|
||||||
export 'src/model/matrix_exception.dart';
|
export 'matrix_api_lite/model/matrix_exception.dart';
|
||||||
export 'src/model/matrix_keys.dart';
|
export 'matrix_api_lite/model/matrix_keys.dart';
|
||||||
export 'src/model/message_types.dart';
|
export 'matrix_api_lite/model/message_types.dart';
|
||||||
export 'src/model/presence.dart';
|
export 'matrix_api_lite/model/presence.dart';
|
||||||
export 'src/model/presence_content.dart';
|
export 'matrix_api_lite/model/presence_content.dart';
|
||||||
export 'src/model/room_creation_types.dart';
|
export 'matrix_api_lite/model/room_creation_types.dart';
|
||||||
export 'src/model/room_summary.dart';
|
export 'matrix_api_lite/model/room_summary.dart';
|
||||||
export 'src/model/stripped_state_event.dart';
|
export 'matrix_api_lite/model/stripped_state_event.dart';
|
||||||
export 'src/model/sync_update.dart';
|
export 'matrix_api_lite/model/sync_update.dart';
|
||||||
export 'src/utils/filter_map_extension.dart';
|
export 'matrix_api_lite/utils/filter_map_extension.dart';
|
||||||
export 'src/utils/logs.dart';
|
export 'matrix_api_lite/utils/logs.dart';
|
||||||
export 'src/utils/map_copy_extension.dart';
|
export 'matrix_api_lite/utils/map_copy_extension.dart';
|
||||||
export 'src/utils/try_get_map_extension.dart';
|
export 'matrix_api_lite/utils/try_get_map_extension.dart';
|
||||||
export 'src/values.dart';
|
export 'matrix_api_lite/values.dart';
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,14 @@ import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
|
|
||||||
import '../model/auth/authentication_data.dart';
|
import 'package:matrix/matrix_api_lite/generated/fixed_model.dart';
|
||||||
import '../model/auth/authentication_identifier.dart';
|
import 'package:matrix/matrix_api_lite/generated/internal.dart';
|
||||||
import '../model/auth/authentication_types.dart';
|
import 'package:matrix/matrix_api_lite/generated/model.dart';
|
||||||
import '../model/children_state.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_data.dart';
|
||||||
import '../model/matrix_event.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_identifier.dart';
|
||||||
import '../model/matrix_keys.dart';
|
import 'package:matrix/matrix_api_lite/model/matrix_event.dart';
|
||||||
import '../model/sync_update.dart';
|
import 'package:matrix/matrix_api_lite/model/matrix_keys.dart';
|
||||||
import 'fixed_model.dart';
|
import 'package:matrix/matrix_api_lite/model/sync_update.dart';
|
||||||
import 'internal.dart';
|
|
||||||
import 'model.dart';
|
|
||||||
|
|
||||||
class Api {
|
class Api {
|
||||||
Client httpClient;
|
Client httpClient;
|
||||||
|
|
@ -446,7 +444,7 @@ class Api {
|
||||||
/// verification will happen without the client's involvement
|
/// verification will happen without the client's involvement
|
||||||
/// provided the homeserver advertises this specification version
|
/// provided the homeserver advertises this specification version
|
||||||
/// in the `/versions` response (ie: r0.5.0).
|
/// in the `/versions` response (ie: r0.5.0).
|
||||||
@deprecated
|
@Deprecated('message')
|
||||||
Future<Uri?> post3PIDs(ThreePidCredentials threePidCreds) async {
|
Future<Uri?> post3PIDs(ThreePidCredentials threePidCreds) async {
|
||||||
final requestUri = Uri(path: '_matrix/client/v3/account/3pid');
|
final requestUri = Uri(path: '_matrix/client/v3/account/3pid');
|
||||||
final request = Request('POST', baseUri!.resolveUri(requestUri));
|
final request = Request('POST', baseUri!.resolveUri(requestUri));
|
||||||
|
|
@ -1491,7 +1489,7 @@ class Api {
|
||||||
/// request to this API or from the initial sync API.
|
/// request to this API or from the initial sync API.
|
||||||
///
|
///
|
||||||
/// [timeout] The maximum time in milliseconds to wait for an event.
|
/// [timeout] The maximum time in milliseconds to wait for an event.
|
||||||
@deprecated
|
@Deprecated('message')
|
||||||
Future<GetEventsResponse> getEvents({String? from, int? timeout}) async {
|
Future<GetEventsResponse> getEvents({String? from, int? timeout}) async {
|
||||||
final requestUri = Uri(path: '_matrix/client/v3/events', queryParameters: {
|
final requestUri = Uri(path: '_matrix/client/v3/events', queryParameters: {
|
||||||
if (from != null) 'from': from,
|
if (from != null) 'from': from,
|
||||||
|
|
@ -1550,7 +1548,7 @@ class Api {
|
||||||
/// or the [/rooms/{roomId}/context/{eventId](https://spec.matrix.org/unstable/client-server-api/#get_matrixclientv3roomsroomidcontexteventid) API.
|
/// or the [/rooms/{roomId}/context/{eventId](https://spec.matrix.org/unstable/client-server-api/#get_matrixclientv3roomsroomidcontexteventid) API.
|
||||||
///
|
///
|
||||||
/// [eventId] The event ID to get.
|
/// [eventId] The event ID to get.
|
||||||
@deprecated
|
@Deprecated('message')
|
||||||
Future<MatrixEvent> getOneEvent(String eventId) async {
|
Future<MatrixEvent> getOneEvent(String eventId) async {
|
||||||
final requestUri =
|
final requestUri =
|
||||||
Uri(path: '_matrix/client/v3/events/${Uri.encodeComponent(eventId)}');
|
Uri(path: '_matrix/client/v3/events/${Uri.encodeComponent(eventId)}');
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import 'fixed_model.dart';
|
import 'package:matrix/matrix_api_lite/generated/fixed_model.dart';
|
||||||
|
|
||||||
void ignore(Object? input) {}
|
void ignore(Object? input) {}
|
||||||
FileResponse ignoreFile(dynamic input) {
|
FileResponse ignoreFile(dynamic input) {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,8 @@
|
||||||
import 'package:enhanced_enum/enhanced_enum.dart';
|
import 'package:enhanced_enum/enhanced_enum.dart';
|
||||||
|
|
||||||
import '../model/auth/authentication_data.dart';
|
import 'package:matrix/matrix_api_lite/model/children_state.dart';
|
||||||
import '../model/auth/authentication_identifier.dart';
|
import 'package:matrix/matrix_api_lite/model/matrix_event.dart';
|
||||||
import '../model/auth/authentication_types.dart';
|
import 'package:matrix/matrix_api_lite/model/matrix_keys.dart';
|
||||||
import '../model/children_state.dart';
|
|
||||||
import '../model/matrix_event.dart';
|
|
||||||
import '../model/matrix_keys.dart';
|
|
||||||
import '../model/sync_update.dart';
|
|
||||||
import 'internal.dart';
|
|
||||||
|
|
||||||
part 'model.g.dart';
|
part 'model.g.dart';
|
||||||
|
|
||||||
|
|
@ -237,6 +232,7 @@ class SpaceRoomsChunk implements PublicRoomsChunk, ChildRoomsChunk {
|
||||||
childrenState = (json['children_state'] as List)
|
childrenState = (json['children_state'] as List)
|
||||||
.map((v) => ChildrenState.fromJson(v as Map<String, Object?>))
|
.map((v) => ChildrenState.fromJson(v as Map<String, Object?>))
|
||||||
.toList();
|
.toList();
|
||||||
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
final avatarUrl = this.avatarUrl;
|
final avatarUrl = this.avatarUrl;
|
||||||
final canonicalAlias = this.canonicalAlias;
|
final canonicalAlias = this.canonicalAlias;
|
||||||
|
|
@ -260,42 +256,53 @@ class SpaceRoomsChunk implements PublicRoomsChunk, ChildRoomsChunk {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The URL for the room's avatar, if one is set.
|
/// The URL for the room's avatar, if one is set.
|
||||||
|
@override
|
||||||
Uri? avatarUrl;
|
Uri? avatarUrl;
|
||||||
|
|
||||||
/// The canonical alias of the room, if any.
|
/// The canonical alias of the room, if any.
|
||||||
|
@override
|
||||||
String? canonicalAlias;
|
String? canonicalAlias;
|
||||||
|
|
||||||
/// Whether guest users may join the room and participate in it.
|
/// Whether guest users may join the room and participate in it.
|
||||||
/// If they can, they will be subject to ordinary power level
|
/// If they can, they will be subject to ordinary power level
|
||||||
/// rules like any other user.
|
/// rules like any other user.
|
||||||
|
@override
|
||||||
bool guestCanJoin;
|
bool guestCanJoin;
|
||||||
|
|
||||||
/// The room's join rule. When not present, the room is assumed to
|
/// The room's join rule. When not present, the room is assumed to
|
||||||
/// be `public`.
|
/// be `public`.
|
||||||
|
@override
|
||||||
String? joinRule;
|
String? joinRule;
|
||||||
|
|
||||||
/// The name of the room, if any.
|
/// The name of the room, if any.
|
||||||
|
@override
|
||||||
String? name;
|
String? name;
|
||||||
|
|
||||||
/// The number of members joined to the room.
|
/// The number of members joined to the room.
|
||||||
|
@override
|
||||||
int numJoinedMembers;
|
int numJoinedMembers;
|
||||||
|
|
||||||
/// The ID of the room.
|
/// The ID of the room.
|
||||||
|
@override
|
||||||
String roomId;
|
String roomId;
|
||||||
|
|
||||||
/// The `type` of room (from [`m.room.create`](https://spec.matrix.org/unstable/client-server-api/#mroomcreate)), if any.
|
/// The `type` of room (from [`m.room.create`](https://spec.matrix.org/unstable/client-server-api/#mroomcreate)), if any.
|
||||||
|
@override
|
||||||
String? roomType;
|
String? roomType;
|
||||||
|
|
||||||
/// The topic of the room, if any.
|
/// The topic of the room, if any.
|
||||||
|
@override
|
||||||
String? topic;
|
String? topic;
|
||||||
|
|
||||||
/// Whether the room may be viewed by guest users without joining.
|
/// Whether the room may be viewed by guest users without joining.
|
||||||
|
@override
|
||||||
bool worldReadable;
|
bool worldReadable;
|
||||||
|
|
||||||
/// The [`m.space.child`](#mspacechild) events of the space-room, represented
|
/// The [`m.space.child`](#mspacechild) events of the space-room, represented
|
||||||
/// as [Stripped State Events](#stripped-state) with an added `origin_server_ts` key.
|
/// as [Stripped State Events](#stripped-state) with an added `origin_server_ts` key.
|
||||||
///
|
///
|
||||||
/// If the room is not a space-room, this should be empty.
|
/// If the room is not a space-room, this should be empty.
|
||||||
|
@override
|
||||||
List<ChildrenState> childrenState;
|
List<ChildrenState> childrenState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1789,7 +1796,7 @@ class PusherData {
|
||||||
url = ((v) => v != null ? Uri.parse(v as String) : null)(json['url']),
|
url = ((v) => v != null ? Uri.parse(v as String) : null)(json['url']),
|
||||||
additionalProperties = Map.fromEntries(json.entries
|
additionalProperties = Map.fromEntries(json.entries
|
||||||
.where((e) => !['format', 'url'].contains(e.key))
|
.where((e) => !['format', 'url'].contains(e.key))
|
||||||
.map((e) => MapEntry(e.key, e.value as Object?)));
|
.map((e) => MapEntry(e.key, e.value)));
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
final format = this.format;
|
final format = this.format;
|
||||||
final url = this.url;
|
final url = this.url;
|
||||||
|
|
@ -1861,6 +1868,7 @@ class Pusher implements PusherId {
|
||||||
lang = json['lang'] as String,
|
lang = json['lang'] as String,
|
||||||
profileTag =
|
profileTag =
|
||||||
((v) => v != null ? v as String : null)(json['profile_tag']);
|
((v) => v != null ? v as String : null)(json['profile_tag']);
|
||||||
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
final profileTag = this.profileTag;
|
final profileTag = this.profileTag;
|
||||||
return {
|
return {
|
||||||
|
|
@ -1877,11 +1885,13 @@ class Pusher implements PusherId {
|
||||||
|
|
||||||
/// This is a reverse-DNS style identifier for the application.
|
/// This is a reverse-DNS style identifier for the application.
|
||||||
/// Max length, 64 chars.
|
/// Max length, 64 chars.
|
||||||
|
@override
|
||||||
String appId;
|
String appId;
|
||||||
|
|
||||||
/// This is a unique identifier for this pusher. See `/set` for
|
/// This is a unique identifier for this pusher. See `/set` for
|
||||||
/// more detail.
|
/// more detail.
|
||||||
/// Max length, 512 bytes.
|
/// Max length, 512 bytes.
|
||||||
|
@override
|
||||||
String pushkey;
|
String pushkey;
|
||||||
|
|
||||||
/// A string that will allow the user to identify what application
|
/// A string that will allow the user to identify what application
|
||||||
|
|
@ -2845,6 +2855,7 @@ class SearchFilter implements EventFilter, RoomEventFilter {
|
||||||
: null)(json['rooms']),
|
: null)(json['rooms']),
|
||||||
unreadThreadNotifications = ((v) =>
|
unreadThreadNotifications = ((v) =>
|
||||||
v != null ? v as bool : null)(json['unread_thread_notifications']);
|
v != null ? v as bool : null)(json['unread_thread_notifications']);
|
||||||
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
final limit = this.limit;
|
final limit = this.limit;
|
||||||
final notSenders = this.notSenders;
|
final notSenders = this.notSenders;
|
||||||
|
|
@ -2875,21 +2886,27 @@ class SearchFilter implements EventFilter, RoomEventFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The maximum number of events to return.
|
/// The maximum number of events to return.
|
||||||
|
@override
|
||||||
int? limit;
|
int? limit;
|
||||||
|
|
||||||
/// A list of sender IDs to exclude. If this list is absent then no senders are excluded. A matching sender will be excluded even if it is listed in the `'senders'` filter.
|
/// A list of sender IDs to exclude. If this list is absent then no senders are excluded. A matching sender will be excluded even if it is listed in the `'senders'` filter.
|
||||||
|
@override
|
||||||
List<String>? notSenders;
|
List<String>? notSenders;
|
||||||
|
|
||||||
/// A list of event types to exclude. If this list is absent then no event types are excluded. A matching type will be excluded even if it is listed in the `'types'` filter. A '*' can be used as a wildcard to match any sequence of characters.
|
/// A list of event types to exclude. If this list is absent then no event types are excluded. A matching type will be excluded even if it is listed in the `'types'` filter. A '*' can be used as a wildcard to match any sequence of characters.
|
||||||
|
@override
|
||||||
List<String>? notTypes;
|
List<String>? notTypes;
|
||||||
|
|
||||||
/// A list of senders IDs to include. If this list is absent then all senders are included.
|
/// A list of senders IDs to include. If this list is absent then all senders are included.
|
||||||
|
@override
|
||||||
List<String>? senders;
|
List<String>? senders;
|
||||||
|
|
||||||
/// A list of event types to include. If this list is absent then all event types are included. A `'*'` can be used as a wildcard to match any sequence of characters.
|
/// A list of event types to include. If this list is absent then all event types are included. A `'*'` can be used as a wildcard to match any sequence of characters.
|
||||||
|
@override
|
||||||
List<String>? types;
|
List<String>? types;
|
||||||
|
|
||||||
/// If `true`, includes only events with a `url` key in their content. If `false`, excludes those events. If omitted, `url` key is not considered for filtering.
|
/// If `true`, includes only events with a `url` key in their content. If `false`, excludes those events. If omitted, `url` key is not considered for filtering.
|
||||||
|
@override
|
||||||
bool? containsUrl;
|
bool? containsUrl;
|
||||||
|
|
||||||
/// If `true`, sends all membership events for all events, even if they have already
|
/// If `true`, sends all membership events for all events, even if they have already
|
||||||
|
|
@ -2897,21 +2914,26 @@ class SearchFilter implements EventFilter, RoomEventFilter {
|
||||||
/// apply unless `lazy_load_members` is `true`. See
|
/// apply unless `lazy_load_members` is `true`. See
|
||||||
/// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
|
/// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
|
||||||
/// for more information. Defaults to `false`.
|
/// for more information. Defaults to `false`.
|
||||||
|
@override
|
||||||
bool? includeRedundantMembers;
|
bool? includeRedundantMembers;
|
||||||
|
|
||||||
/// If `true`, enables lazy-loading of membership events. See
|
/// If `true`, enables lazy-loading of membership events. See
|
||||||
/// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
|
/// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
|
||||||
/// for more information. Defaults to `false`.
|
/// for more information. Defaults to `false`.
|
||||||
|
@override
|
||||||
bool? lazyLoadMembers;
|
bool? lazyLoadMembers;
|
||||||
|
|
||||||
/// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the `'rooms'` filter.
|
/// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the `'rooms'` filter.
|
||||||
|
@override
|
||||||
List<String>? notRooms;
|
List<String>? notRooms;
|
||||||
|
|
||||||
/// A list of room IDs to include. If this list is absent then all rooms are included.
|
/// A list of room IDs to include. If this list is absent then all rooms are included.
|
||||||
|
@override
|
||||||
List<String>? rooms;
|
List<String>? rooms;
|
||||||
|
|
||||||
/// If `true`, enables per-[thread](https://spec.matrix.org/unstable/client-server-api/#threading) notification
|
/// If `true`, enables per-[thread](https://spec.matrix.org/unstable/client-server-api/#threading) notification
|
||||||
/// counts. Only applies to the `/sync` endpoint. Defaults to `false`.
|
/// counts. Only applies to the `/sync` endpoint. Defaults to `false`.
|
||||||
|
@override
|
||||||
bool? unreadThreadNotifications;
|
bool? unreadThreadNotifications;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3630,6 +3652,7 @@ class StateFilter implements EventFilter, RoomEventFilter {
|
||||||
: null)(json['rooms']),
|
: null)(json['rooms']),
|
||||||
unreadThreadNotifications = ((v) =>
|
unreadThreadNotifications = ((v) =>
|
||||||
v != null ? v as bool : null)(json['unread_thread_notifications']);
|
v != null ? v as bool : null)(json['unread_thread_notifications']);
|
||||||
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
final limit = this.limit;
|
final limit = this.limit;
|
||||||
final notSenders = this.notSenders;
|
final notSenders = this.notSenders;
|
||||||
|
|
@ -3660,21 +3683,27 @@ class StateFilter implements EventFilter, RoomEventFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The maximum number of events to return.
|
/// The maximum number of events to return.
|
||||||
|
@override
|
||||||
int? limit;
|
int? limit;
|
||||||
|
|
||||||
/// A list of sender IDs to exclude. If this list is absent then no senders are excluded. A matching sender will be excluded even if it is listed in the `'senders'` filter.
|
/// A list of sender IDs to exclude. If this list is absent then no senders are excluded. A matching sender will be excluded even if it is listed in the `'senders'` filter.
|
||||||
|
@override
|
||||||
List<String>? notSenders;
|
List<String>? notSenders;
|
||||||
|
|
||||||
/// A list of event types to exclude. If this list is absent then no event types are excluded. A matching type will be excluded even if it is listed in the `'types'` filter. A '*' can be used as a wildcard to match any sequence of characters.
|
/// A list of event types to exclude. If this list is absent then no event types are excluded. A matching type will be excluded even if it is listed in the `'types'` filter. A '*' can be used as a wildcard to match any sequence of characters.
|
||||||
|
@override
|
||||||
List<String>? notTypes;
|
List<String>? notTypes;
|
||||||
|
|
||||||
/// A list of senders IDs to include. If this list is absent then all senders are included.
|
/// A list of senders IDs to include. If this list is absent then all senders are included.
|
||||||
|
@override
|
||||||
List<String>? senders;
|
List<String>? senders;
|
||||||
|
|
||||||
/// A list of event types to include. If this list is absent then all event types are included. A `'*'` can be used as a wildcard to match any sequence of characters.
|
/// A list of event types to include. If this list is absent then all event types are included. A `'*'` can be used as a wildcard to match any sequence of characters.
|
||||||
|
@override
|
||||||
List<String>? types;
|
List<String>? types;
|
||||||
|
|
||||||
/// If `true`, includes only events with a `url` key in their content. If `false`, excludes those events. If omitted, `url` key is not considered for filtering.
|
/// If `true`, includes only events with a `url` key in their content. If `false`, excludes those events. If omitted, `url` key is not considered for filtering.
|
||||||
|
@override
|
||||||
bool? containsUrl;
|
bool? containsUrl;
|
||||||
|
|
||||||
/// If `true`, sends all membership events for all events, even if they have already
|
/// If `true`, sends all membership events for all events, even if they have already
|
||||||
|
|
@ -3682,21 +3711,26 @@ class StateFilter implements EventFilter, RoomEventFilter {
|
||||||
/// apply unless `lazy_load_members` is `true`. See
|
/// apply unless `lazy_load_members` is `true`. See
|
||||||
/// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
|
/// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
|
||||||
/// for more information. Defaults to `false`.
|
/// for more information. Defaults to `false`.
|
||||||
|
@override
|
||||||
bool? includeRedundantMembers;
|
bool? includeRedundantMembers;
|
||||||
|
|
||||||
/// If `true`, enables lazy-loading of membership events. See
|
/// If `true`, enables lazy-loading of membership events. See
|
||||||
/// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
|
/// [Lazy-loading room members](https://spec.matrix.org/unstable/client-server-api/#lazy-loading-room-members)
|
||||||
/// for more information. Defaults to `false`.
|
/// for more information. Defaults to `false`.
|
||||||
|
@override
|
||||||
bool? lazyLoadMembers;
|
bool? lazyLoadMembers;
|
||||||
|
|
||||||
/// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the `'rooms'` filter.
|
/// A list of room IDs to exclude. If this list is absent then no rooms are excluded. A matching room will be excluded even if it is listed in the `'rooms'` filter.
|
||||||
|
@override
|
||||||
List<String>? notRooms;
|
List<String>? notRooms;
|
||||||
|
|
||||||
/// A list of room IDs to include. If this list is absent then all rooms are included.
|
/// A list of room IDs to include. If this list is absent then all rooms are included.
|
||||||
|
@override
|
||||||
List<String>? rooms;
|
List<String>? rooms;
|
||||||
|
|
||||||
/// If `true`, enables per-[thread](https://spec.matrix.org/unstable/client-server-api/#threading) notification
|
/// If `true`, enables per-[thread](https://spec.matrix.org/unstable/client-server-api/#threading) notification
|
||||||
/// counts. Only applies to the `/sync` endpoint. Defaults to `false`.
|
/// counts. Only applies to the `/sync` endpoint. Defaults to `false`.
|
||||||
|
@override
|
||||||
bool? unreadThreadNotifications;
|
bool? unreadThreadNotifications;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3886,7 +3920,7 @@ class Tag {
|
||||||
((v) => v != null ? (v as num).toDouble() : null)(json['order']),
|
((v) => v != null ? (v as num).toDouble() : null)(json['order']),
|
||||||
additionalProperties = Map.fromEntries(json.entries
|
additionalProperties = Map.fromEntries(json.entries
|
||||||
.where((e) => !['order'].contains(e.key))
|
.where((e) => !['order'].contains(e.key))
|
||||||
.map((e) => MapEntry(e.key, e.value as Object?)));
|
.map((e) => MapEntry(e.key, e.value)));
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
final order = this.order;
|
final order = this.order;
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,10 @@ import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import '../matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
import 'generated/api.dart';
|
import 'package:matrix/matrix_api_lite/generated/api.dart';
|
||||||
|
|
||||||
|
// ignore: constant_identifier_names
|
||||||
enum RequestType { GET, POST, PUT, DELETE }
|
enum RequestType { GET, POST, PUT, DELETE }
|
||||||
|
|
||||||
class MatrixApi extends Api {
|
class MatrixApi extends Api {
|
||||||
|
|
@ -58,11 +59,8 @@ class MatrixApi extends Api {
|
||||||
MatrixApi({
|
MatrixApi({
|
||||||
Uri? homeserver,
|
Uri? homeserver,
|
||||||
String? accessToken,
|
String? accessToken,
|
||||||
http.Client? httpClient,
|
super.httpClient,
|
||||||
}) : super(
|
}) : super(baseUri: homeserver, bearerToken: accessToken);
|
||||||
httpClient: httpClient,
|
|
||||||
baseUri: homeserver,
|
|
||||||
bearerToken: accessToken);
|
|
||||||
|
|
||||||
/// Used for all Matrix json requests using the [c2s API](https://matrix.org/docs/spec/client_server/r0.6.0.html).
|
/// Used for all Matrix json requests using the [c2s API](https://matrix.org/docs/spec/client_server/r0.6.0.html).
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'authentication_phone_identifier.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_phone_identifier.dart';
|
||||||
import 'authentication_third_party_identifier.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_third_party_identifier.dart';
|
||||||
import 'authentication_types.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_types.dart';
|
||||||
import 'authentication_user_identifier.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_user_identifier.dart';
|
||||||
|
|
||||||
class AuthenticationIdentifier {
|
class AuthenticationIdentifier {
|
||||||
String type;
|
String type;
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'authentication_data.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_data.dart';
|
||||||
import 'authentication_identifier.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_identifier.dart';
|
||||||
import 'authentication_types.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_types.dart';
|
||||||
import 'authentication_user_identifier.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_user_identifier.dart';
|
||||||
|
|
||||||
class AuthenticationPassword extends AuthenticationData {
|
class AuthenticationPassword extends AuthenticationData {
|
||||||
String password;
|
String password;
|
||||||
|
|
@ -34,17 +34,16 @@ class AuthenticationPassword extends AuthenticationData {
|
||||||
AuthenticationIdentifier identifier;
|
AuthenticationIdentifier identifier;
|
||||||
|
|
||||||
AuthenticationPassword(
|
AuthenticationPassword(
|
||||||
{String? session, required this.password, required this.identifier})
|
{super.session, required this.password, required this.identifier})
|
||||||
: super(
|
: super(
|
||||||
type: AuthenticationTypes.password,
|
type: AuthenticationTypes.password,
|
||||||
session: session,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
AuthenticationPassword.fromJson(Map<String, Object?> json)
|
AuthenticationPassword.fromJson(super.json)
|
||||||
: password = json['password'] as String,
|
: password = json['password'] as String,
|
||||||
identifier = AuthenticationIdentifier.subFromJson(
|
identifier = AuthenticationIdentifier.subFromJson(
|
||||||
json['identifier'] as Map<String, Object?>),
|
json['identifier'] as Map<String, Object?>),
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'authentication_identifier.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_identifier.dart';
|
||||||
import 'authentication_types.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_types.dart';
|
||||||
|
|
||||||
class AuthenticationPhoneIdentifier extends AuthenticationIdentifier {
|
class AuthenticationPhoneIdentifier extends AuthenticationIdentifier {
|
||||||
String country;
|
String country;
|
||||||
|
|
@ -31,10 +31,10 @@ class AuthenticationPhoneIdentifier extends AuthenticationIdentifier {
|
||||||
AuthenticationPhoneIdentifier({required this.country, required this.phone})
|
AuthenticationPhoneIdentifier({required this.country, required this.phone})
|
||||||
: super(type: AuthenticationIdentifierTypes.phone);
|
: super(type: AuthenticationIdentifierTypes.phone);
|
||||||
|
|
||||||
AuthenticationPhoneIdentifier.fromJson(Map<String, Object?> json)
|
AuthenticationPhoneIdentifier.fromJson(super.json)
|
||||||
: country = json['country'] as String,
|
: country = json['country'] as String,
|
||||||
phone = json['phone'] as String,
|
phone = json['phone'] as String,
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'authentication_data.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_data.dart';
|
||||||
import 'authentication_types.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_types.dart';
|
||||||
|
|
||||||
class AuthenticationRecaptcha extends AuthenticationData {
|
class AuthenticationRecaptcha extends AuthenticationData {
|
||||||
String response;
|
String response;
|
||||||
|
|
@ -33,9 +33,9 @@ class AuthenticationRecaptcha extends AuthenticationData {
|
||||||
session: session,
|
session: session,
|
||||||
);
|
);
|
||||||
|
|
||||||
AuthenticationRecaptcha.fromJson(Map<String, Object?> json)
|
AuthenticationRecaptcha.fromJson(super.json)
|
||||||
: response = json['response'] as String,
|
: response = json['response'] as String,
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'authentication_identifier.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_identifier.dart';
|
||||||
import 'authentication_types.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_types.dart';
|
||||||
|
|
||||||
class AuthenticationThirdPartyIdentifier extends AuthenticationIdentifier {
|
class AuthenticationThirdPartyIdentifier extends AuthenticationIdentifier {
|
||||||
String medium;
|
String medium;
|
||||||
|
|
@ -32,10 +32,10 @@ class AuthenticationThirdPartyIdentifier extends AuthenticationIdentifier {
|
||||||
{required this.medium, required this.address})
|
{required this.medium, required this.address})
|
||||||
: super(type: AuthenticationIdentifierTypes.thirdParty);
|
: super(type: AuthenticationIdentifierTypes.thirdParty);
|
||||||
|
|
||||||
AuthenticationThirdPartyIdentifier.fromJson(Map<String, Object?> json)
|
AuthenticationThirdPartyIdentifier.fromJson(super.json)
|
||||||
: medium = json['medium'] as String,
|
: medium = json['medium'] as String,
|
||||||
address = json['address'] as String,
|
address = json['address'] as String,
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'authentication_data.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_data.dart';
|
||||||
|
|
||||||
/// For email based identity:
|
/// For email based identity:
|
||||||
/// https://matrix.org/docs/spec/client_server/r0.6.1#email-based-identity-homeserver
|
/// https://matrix.org/docs/spec/client_server/r0.6.1#email-based-identity-homeserver
|
||||||
|
|
@ -31,11 +31,7 @@ class AuthenticationThreePidCreds extends AuthenticationData {
|
||||||
late ThreepidCreds threepidCreds;
|
late ThreepidCreds threepidCreds;
|
||||||
|
|
||||||
AuthenticationThreePidCreds(
|
AuthenticationThreePidCreds(
|
||||||
{String? session, required String type, required this.threepidCreds})
|
{super.session, required String super.type, required this.threepidCreds});
|
||||||
: super(
|
|
||||||
type: type,
|
|
||||||
session: session,
|
|
||||||
);
|
|
||||||
|
|
||||||
AuthenticationThreePidCreds.fromJson(Map<String, Object?> json)
|
AuthenticationThreePidCreds.fromJson(Map<String, Object?> json)
|
||||||
: super.fromJson(json) {
|
: super.fromJson(json) {
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'authentication_data.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_data.dart';
|
||||||
import 'authentication_types.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_types.dart';
|
||||||
|
|
||||||
class AuthenticationToken extends AuthenticationData {
|
class AuthenticationToken extends AuthenticationData {
|
||||||
String token;
|
String token;
|
||||||
|
|
@ -30,16 +30,15 @@ class AuthenticationToken extends AuthenticationData {
|
||||||
/// removed in the unstable version of the spec
|
/// removed in the unstable version of the spec
|
||||||
String? txnId;
|
String? txnId;
|
||||||
|
|
||||||
AuthenticationToken({String? session, required this.token, this.txnId})
|
AuthenticationToken({super.session, required this.token, this.txnId})
|
||||||
: super(
|
: super(
|
||||||
type: AuthenticationTypes.token,
|
type: AuthenticationTypes.token,
|
||||||
session: session,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
AuthenticationToken.fromJson(Map<String, Object?> json)
|
AuthenticationToken.fromJson(super.json)
|
||||||
: token = json['token'] as String,
|
: token = json['token'] as String,
|
||||||
txnId = json['txn_id'] as String?,
|
txnId = json['txn_id'] as String?,
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'authentication_identifier.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_identifier.dart';
|
||||||
import 'authentication_types.dart';
|
import 'package:matrix/matrix_api_lite/model/auth/authentication_types.dart';
|
||||||
|
|
||||||
class AuthenticationUserIdentifier extends AuthenticationIdentifier {
|
class AuthenticationUserIdentifier extends AuthenticationIdentifier {
|
||||||
String user;
|
String user;
|
||||||
|
|
@ -30,9 +30,9 @@ class AuthenticationUserIdentifier extends AuthenticationIdentifier {
|
||||||
AuthenticationUserIdentifier({required this.user})
|
AuthenticationUserIdentifier({required this.user})
|
||||||
: super(type: AuthenticationIdentifierTypes.userId);
|
: super(type: AuthenticationIdentifierTypes.userId);
|
||||||
|
|
||||||
AuthenticationUserIdentifier.fromJson(Map<String, Object?> json)
|
AuthenticationUserIdentifier.fromJson(super.json)
|
||||||
: user = json['user'] as String,
|
: user = json['user'] as String,
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../utils/map_copy_extension.dart';
|
import 'package:matrix/matrix_api_lite/utils/map_copy_extension.dart';
|
||||||
|
|
||||||
class BasicEvent {
|
class BasicEvent {
|
||||||
String type;
|
String type;
|
||||||
|
|
|
||||||
|
|
@ -21,20 +21,17 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'basic_event.dart';
|
import 'package:matrix/matrix_api_lite/model/basic_event.dart';
|
||||||
|
|
||||||
class BasicEventWithSender extends BasicEvent {
|
class BasicEventWithSender extends BasicEvent {
|
||||||
String senderId;
|
String senderId;
|
||||||
|
|
||||||
BasicEventWithSender(
|
BasicEventWithSender(
|
||||||
{required String type,
|
{required super.type, required super.content, required this.senderId});
|
||||||
required Map<String, Object?> content,
|
|
||||||
required this.senderId})
|
|
||||||
: super(type: type, content: content);
|
|
||||||
|
|
||||||
BasicEventWithSender.fromJson(Map<String, Object?> json)
|
BasicEventWithSender.fromJson(super.json)
|
||||||
: senderId = json['sender'] as String,
|
: senderId = json['sender'] as String,
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -21,23 +21,20 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'basic_event.dart';
|
import 'package:matrix/matrix_api_lite/model/basic_event.dart';
|
||||||
|
|
||||||
class BasicRoomEvent extends BasicEvent {
|
class BasicRoomEvent extends BasicEvent {
|
||||||
String? roomId;
|
String? roomId;
|
||||||
|
|
||||||
BasicRoomEvent({
|
BasicRoomEvent({
|
||||||
this.roomId,
|
this.roomId,
|
||||||
required Map<String, Object?> content,
|
required super.content,
|
||||||
required String type,
|
required super.type,
|
||||||
}) : super(
|
});
|
||||||
content: content,
|
|
||||||
type: type,
|
|
||||||
);
|
|
||||||
|
|
||||||
BasicRoomEvent.fromJson(Map<String, Object?> json)
|
BasicRoomEvent.fromJson(super.json)
|
||||||
: roomId = json['room_id'] as String?,
|
: roomId = json['room_id'] as String?,
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -21,27 +21,23 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'stripped_state_event.dart';
|
import 'package:matrix/matrix_api_lite/model/stripped_state_event.dart';
|
||||||
|
|
||||||
class ChildrenState extends StrippedStateEvent {
|
class ChildrenState extends StrippedStateEvent {
|
||||||
DateTime originServerTs;
|
DateTime originServerTs;
|
||||||
|
|
||||||
ChildrenState({
|
ChildrenState({
|
||||||
required String type,
|
required super.type,
|
||||||
required Map<String, Object?> content,
|
required super.content,
|
||||||
required String senderId,
|
required super.senderId,
|
||||||
required String stateKey,
|
required String super.stateKey,
|
||||||
required this.originServerTs,
|
required this.originServerTs,
|
||||||
}) : super(
|
});
|
||||||
type: type,
|
|
||||||
content: content,
|
|
||||||
senderId: senderId,
|
|
||||||
stateKey: stateKey);
|
|
||||||
|
|
||||||
ChildrenState.fromJson(Map<String, Object?> json)
|
ChildrenState.fromJson(super.json)
|
||||||
: originServerTs = DateTime.fromMillisecondsSinceEpoch(
|
: originServerTs = DateTime.fromMillisecondsSinceEpoch(
|
||||||
json['origin_server_ts'] as int),
|
json['origin_server_ts'] as int),
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../../utils/try_get_map_extension.dart';
|
import 'package:matrix/matrix_api_lite/model/basic_event.dart';
|
||||||
import '../basic_event.dart';
|
import 'package:matrix/matrix_api_lite/model/events/room_key_content.dart';
|
||||||
import 'room_key_content.dart';
|
import 'package:matrix/matrix_api_lite/utils/try_get_map_extension.dart';
|
||||||
|
|
||||||
extension ForwardedRoomKeyContentBasicEventExtension on BasicEvent {
|
extension ForwardedRoomKeyContentBasicEventExtension on BasicEvent {
|
||||||
ForwardedRoomKeyContent get parsedForwardedRoomKeyContent =>
|
ForwardedRoomKeyContent get parsedForwardedRoomKeyContent =>
|
||||||
|
|
@ -35,14 +35,14 @@ class ForwardedRoomKeyContent extends RoomKeyContent {
|
||||||
String senderClaimedEd25519Key;
|
String senderClaimedEd25519Key;
|
||||||
List<String> forwardingCurve25519KeyChain;
|
List<String> forwardingCurve25519KeyChain;
|
||||||
|
|
||||||
ForwardedRoomKeyContent.fromJson(Map<String, Object?> json)
|
ForwardedRoomKeyContent.fromJson(super.json)
|
||||||
: senderKey = json.tryGet('sender_key', TryGet.required) ?? '',
|
: senderKey = json.tryGet('sender_key', TryGet.required) ?? '',
|
||||||
senderClaimedEd25519Key =
|
senderClaimedEd25519Key =
|
||||||
json.tryGet('sender_claimed_ed25519_key', TryGet.required) ?? '',
|
json.tryGet('sender_claimed_ed25519_key', TryGet.required) ?? '',
|
||||||
forwardingCurve25519KeyChain = json.tryGetList(
|
forwardingCurve25519KeyChain = json.tryGetList(
|
||||||
'forwarding_curve25519_key_chain', TryGet.required) ??
|
'forwarding_curve25519_key_chain', TryGet.required) ??
|
||||||
[],
|
[],
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../../utils/filter_map_extension.dart';
|
import 'package:matrix/matrix_api_lite/model/basic_event.dart';
|
||||||
import '../../utils/try_get_map_extension.dart';
|
import 'package:matrix/matrix_api_lite/utils/filter_map_extension.dart';
|
||||||
import '../basic_event.dart';
|
import 'package:matrix/matrix_api_lite/utils/try_get_map_extension.dart';
|
||||||
|
|
||||||
extension ImagePackContentBasicEventExtension on BasicEvent {
|
extension ImagePackContentBasicEventExtension on BasicEvent {
|
||||||
ImagePackContent get parsedImagePackContent =>
|
ImagePackContent get parsedImagePackContent =>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../../utils/try_get_map_extension.dart';
|
import 'package:matrix/matrix_api_lite/utils/try_get_map_extension.dart';
|
||||||
|
|
||||||
class OlmPlaintextPayload {
|
class OlmPlaintextPayload {
|
||||||
String? type;
|
String? type;
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/src/utils/logs.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
import '../../utils/filter_map_extension.dart';
|
|
||||||
import '../../utils/try_get_map_extension.dart';
|
|
||||||
import '../basic_event.dart';
|
|
||||||
|
|
||||||
extension RoomEncryptedContentBasicEventExtension on BasicEvent {
|
extension RoomEncryptedContentBasicEventExtension on BasicEvent {
|
||||||
RoomEncryptedContent get parsedRoomEncryptedContent =>
|
RoomEncryptedContent get parsedRoomEncryptedContent =>
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../../utils/try_get_map_extension.dart';
|
import 'package:matrix/matrix_api_lite/model/basic_event.dart';
|
||||||
import '../basic_event.dart';
|
import 'package:matrix/matrix_api_lite/utils/try_get_map_extension.dart';
|
||||||
|
|
||||||
extension RoomEncryptionContentBasicEventExtension on BasicEvent {
|
extension RoomEncryptionContentBasicEventExtension on BasicEvent {
|
||||||
RoomEncryptionContent get parsedRoomEncryptionContent =>
|
RoomEncryptionContent get parsedRoomEncryptionContent =>
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../../utils/try_get_map_extension.dart';
|
import 'package:matrix/matrix_api_lite/model/basic_event.dart';
|
||||||
import '../basic_event.dart';
|
import 'package:matrix/matrix_api_lite/utils/try_get_map_extension.dart';
|
||||||
|
|
||||||
extension RoomKeyContentBasicEventExtension on BasicEvent {
|
extension RoomKeyContentBasicEventExtension on BasicEvent {
|
||||||
RoomKeyContent get parsedRoomKeyContent => RoomKeyContent.fromJson(content);
|
RoomKeyContent get parsedRoomKeyContent => RoomKeyContent.fromJson(content);
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../../utils/try_get_map_extension.dart';
|
import 'package:matrix/matrix_api_lite/model/basic_event.dart';
|
||||||
import '../basic_event.dart';
|
import 'package:matrix/matrix_api_lite/utils/try_get_map_extension.dart';
|
||||||
|
|
||||||
extension RoomKeyRequestContentBasicEventExtension on BasicEvent {
|
extension RoomKeyRequestContentBasicEventExtension on BasicEvent {
|
||||||
RoomKeyRequestContent get parsedRoomKeyRequestContent =>
|
RoomKeyRequestContent get parsedRoomKeyRequestContent =>
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../../utils/try_get_map_extension.dart';
|
import 'package:matrix/matrix_api_lite/model/basic_event.dart';
|
||||||
import '../basic_event.dart';
|
import 'package:matrix/matrix_api_lite/utils/try_get_map_extension.dart';
|
||||||
|
|
||||||
extension SecretStorageDefaultKeyContentBasicEventExtension on BasicEvent {
|
extension SecretStorageDefaultKeyContentBasicEventExtension on BasicEvent {
|
||||||
SecretStorageDefaultKeyContent get parsedSecretStorageDefaultKeyContent =>
|
SecretStorageDefaultKeyContent get parsedSecretStorageDefaultKeyContent =>
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../../utils/try_get_map_extension.dart';
|
import 'package:matrix/matrix_api_lite/model/basic_event.dart';
|
||||||
import '../basic_event.dart';
|
import 'package:matrix/matrix_api_lite/utils/try_get_map_extension.dart';
|
||||||
|
|
||||||
extension SecretStorageKeyContentBasicEventExtension on BasicEvent {
|
extension SecretStorageKeyContentBasicEventExtension on BasicEvent {
|
||||||
SecretStorageKeyContent get parsedSecretStorageKeyContent =>
|
SecretStorageKeyContent get parsedSecretStorageKeyContent =>
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../../utils/try_get_map_extension.dart';
|
import 'package:matrix/matrix_api_lite/model/basic_event.dart';
|
||||||
import '../basic_event.dart';
|
import 'package:matrix/matrix_api_lite/utils/try_get_map_extension.dart';
|
||||||
|
|
||||||
extension TombstoneContentBasicEventExtension on BasicEvent {
|
extension TombstoneContentBasicEventExtension on BasicEvent {
|
||||||
TombstoneContent get parsedTombstoneContent =>
|
TombstoneContent get parsedTombstoneContent =>
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../utils/map_copy_extension.dart';
|
import 'package:matrix/matrix_api_lite/model/stripped_state_event.dart';
|
||||||
import 'stripped_state_event.dart';
|
import 'package:matrix/matrix_api_lite/utils/map_copy_extension.dart';
|
||||||
|
|
||||||
class MatrixEvent extends StrippedStateEvent {
|
class MatrixEvent extends StrippedStateEvent {
|
||||||
String eventId;
|
String eventId;
|
||||||
|
|
@ -33,23 +33,19 @@ class MatrixEvent extends StrippedStateEvent {
|
||||||
String? redacts;
|
String? redacts;
|
||||||
|
|
||||||
MatrixEvent({
|
MatrixEvent({
|
||||||
required String type,
|
required super.type,
|
||||||
required Map<String, Object?> content,
|
required super.content,
|
||||||
required String senderId,
|
required super.senderId,
|
||||||
String? stateKey,
|
super.stateKey,
|
||||||
required this.eventId,
|
required this.eventId,
|
||||||
this.roomId,
|
this.roomId,
|
||||||
required this.originServerTs,
|
required this.originServerTs,
|
||||||
this.unsigned,
|
this.unsigned,
|
||||||
this.prevContent,
|
this.prevContent,
|
||||||
this.redacts,
|
this.redacts,
|
||||||
}) : super(
|
});
|
||||||
type: type,
|
|
||||||
content: content,
|
|
||||||
senderId: senderId,
|
|
||||||
stateKey: stateKey);
|
|
||||||
|
|
||||||
MatrixEvent.fromJson(Map<String, Object?> json)
|
MatrixEvent.fromJson(super.json)
|
||||||
: eventId = json['event_id'] as String,
|
: eventId = json['event_id'] as String,
|
||||||
roomId = json['room_id'] as String?,
|
roomId = json['room_id'] as String?,
|
||||||
originServerTs = DateTime.fromMillisecondsSinceEpoch(
|
originServerTs = DateTime.fromMillisecondsSinceEpoch(
|
||||||
|
|
@ -57,7 +53,7 @@ class MatrixEvent extends StrippedStateEvent {
|
||||||
unsigned = (json['unsigned'] as Map<String, Object?>?)?.copy(),
|
unsigned = (json['unsigned'] as Map<String, Object?>?)?.copy(),
|
||||||
prevContent = (json['prev_content'] as Map<String, Object?>?)?.copy(),
|
prevContent = (json['prev_content'] as Map<String, Object?>?)?.copy(),
|
||||||
redacts = json['redacts'] as String?,
|
redacts = json['redacts'] as String?,
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
@ -25,7 +27,7 @@ import 'dart:convert';
|
||||||
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
enum MatrixError {
|
enum MatrixError {
|
||||||
M_UNKNOWN,
|
M_UNKNOWN,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
abstract class MatrixSignableKey {
|
abstract class MatrixSignableKey {
|
||||||
String userId;
|
String userId;
|
||||||
|
|
@ -94,9 +94,9 @@ class MatrixCrossSigningKey extends MatrixSignableKey {
|
||||||
String? get identifier => keys.values.first;
|
String? get identifier => keys.values.first;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MatrixCrossSigningKey.fromJson(Map<String, Object?> json)
|
MatrixCrossSigningKey.fromJson(super.json)
|
||||||
: usage = json.tryGetList<String>('usage') ?? [],
|
: usage = json.tryGetList<String>('usage') ?? [],
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
@ -126,10 +126,10 @@ class MatrixDeviceKeys extends MatrixSignableKey {
|
||||||
String? get identifier => deviceId;
|
String? get identifier => deviceId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MatrixDeviceKeys.fromJson(Map<String, Object?> json)
|
MatrixDeviceKeys.fromJson(super.json)
|
||||||
: algorithms = json.tryGetList<String>('algorithms') ?? [],
|
: algorithms = json.tryGetList<String>('algorithms') ?? [],
|
||||||
deviceId = json['device_id'] as String,
|
deviceId = json['device_id'] as String,
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
|
||||||
/* MIT License
|
/* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,14 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'basic_event_with_sender.dart';
|
import 'package:matrix/matrix_api_lite/model/basic_event_with_sender.dart';
|
||||||
import 'presence_content.dart';
|
import 'package:matrix/matrix_api_lite/model/presence_content.dart';
|
||||||
|
|
||||||
class Presence extends BasicEventWithSender {
|
class Presence extends BasicEventWithSender {
|
||||||
PresenceContent presence;
|
PresenceContent presence;
|
||||||
|
|
||||||
Presence.fromJson(Map<String, Object?> json)
|
Presence.fromJson(super.json)
|
||||||
: presence =
|
: presence =
|
||||||
PresenceContent.fromJson(json['content'] as Map<String, Object?>),
|
PresenceContent.fromJson(json['content'] as Map<String, Object?>),
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
class PresenceContent {
|
class PresenceContent {
|
||||||
PresenceType presence;
|
PresenceType presence;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
class RoomKeysSingleKey {
|
class RoomKeysSingleKey {
|
||||||
int firstMessageIndex;
|
int firstMessageIndex;
|
||||||
|
|
|
||||||
|
|
@ -21,21 +21,20 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
class StrippedStateEvent extends BasicEventWithSender {
|
class StrippedStateEvent extends BasicEventWithSender {
|
||||||
String? stateKey;
|
String? stateKey;
|
||||||
|
|
||||||
StrippedStateEvent(
|
StrippedStateEvent(
|
||||||
{required String type,
|
{required super.type,
|
||||||
required Map<String, Object?> content,
|
required super.content,
|
||||||
required String senderId,
|
required super.senderId,
|
||||||
this.stateKey})
|
this.stateKey});
|
||||||
: super(type: type, content: content, senderId: senderId);
|
|
||||||
|
|
||||||
StrippedStateEvent.fromJson(Map<String, Object?> json)
|
StrippedStateEvent.fromJson(super.json)
|
||||||
: stateKey = json.tryGet<String>('state_key'),
|
: stateKey = json.tryGet<String>('state_key'),
|
||||||
super.fromJson(json);
|
super.fromJson();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object?> toJson() {
|
Map<String, Object?> toJson() {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
class SyncUpdate {
|
class SyncUpdate {
|
||||||
String nextBatch;
|
String nextBatch;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'print_logs_native.dart' if (dart.library.html) 'print_logs_web.dart';
|
import 'package:matrix/matrix_api_lite/utils/print_logs_native.dart'
|
||||||
|
if (dart.library.html) 'print_logs_web.dart';
|
||||||
|
|
||||||
enum Level {
|
enum Level {
|
||||||
wtf,
|
wtf,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
extension PrintLogs on LogEvent {
|
extension PrintLogs on LogEvent {
|
||||||
void printOut() {
|
void printOut() {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import 'dart:html';
|
import 'dart:html';
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
extension PrintLogs on LogEvent {
|
extension PrintLogs on LogEvent {
|
||||||
void printOut() {
|
void printOut() {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
|
|
||||||
import 'logs.dart';
|
import 'package:matrix/matrix_api_lite/utils/logs.dart';
|
||||||
|
|
||||||
abstract class TryGet {
|
abstract class TryGet {
|
||||||
void call(String key, Type expected, Type actual);
|
void call(String key, Type expected, Type actual);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class TagType {
|
||||||
static final lowPriority = 'm.lowpriority';
|
static final lowPriority = 'm.lowpriority';
|
||||||
static final serverNotice = 'm.server_notice';
|
static final serverNotice = 'm.server_notice';
|
||||||
|
|
||||||
static bool isValid(String tag) => tag.startsWith('m.')
|
static bool isValid(String tag) =>
|
||||||
? [favourite, lowPriority, serverNotice].contains(tag)
|
!tag.startsWith('m.') ||
|
||||||
: true;
|
[favourite, lowPriority, serverNotice].contains(tag);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
import 'package:matrix/msc_extensions/msc_3814_dehydrated_devices/model/dehydrated_device.dart';
|
import 'package:matrix/msc_extensions/msc_3814_dehydrated_devices/model/dehydrated_device.dart';
|
||||||
import 'package:matrix/msc_extensions/msc_3814_dehydrated_devices/model/dehydrated_device_events.dart';
|
import 'package:matrix/msc_extensions/msc_3814_dehydrated_devices/model/dehydrated_device_events.dart';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
class DehydratedDevice {
|
class DehydratedDevice {
|
||||||
String deviceId;
|
String deviceId;
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,9 @@ import 'package:matrix/src/database/zone_transaction_mixin.dart';
|
||||||
class BoxCollection with ZoneTransactionMixin {
|
class BoxCollection with ZoneTransactionMixin {
|
||||||
final Database _db;
|
final Database _db;
|
||||||
final Set<String> boxNames;
|
final Set<String> boxNames;
|
||||||
final String _name;
|
final String name;
|
||||||
final IdbFactory _idbFactory;
|
|
||||||
|
|
||||||
BoxCollection(this._db, this.boxNames, this._name, this._idbFactory);
|
BoxCollection(this._db, this.boxNames, this.name);
|
||||||
|
|
||||||
static Future<BoxCollection> open(
|
static Future<BoxCollection> open(
|
||||||
String name,
|
String name,
|
||||||
|
|
@ -29,7 +28,7 @@ class BoxCollection with ZoneTransactionMixin {
|
||||||
db.createObjectStore(name, autoIncrement: true);
|
db.createObjectStore(name, autoIncrement: true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return BoxCollection(db, boxNames, name, idbFactory);
|
return BoxCollection(db, boxNames, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Box<V> openBox<V>(String name) {
|
Box<V> openBox<V>(String name) {
|
||||||
|
|
@ -81,7 +80,8 @@ class BoxCollection with ZoneTransactionMixin {
|
||||||
return _db.close();
|
return _db.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> delete() => _idbFactory.deleteDatabase(_name);
|
static Future<void> delete(String path, [IdbFactory? factory]) =>
|
||||||
|
(factory ?? window.indexedDB!).deleteDatabase(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Box<V> {
|
class Box<V> {
|
||||||
|
|
|
||||||
|
|
@ -1594,5 +1594,8 @@ class MatrixSdkDatabase extends DatabaseApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> delete() => _collection.delete();
|
Future<void> delete() => BoxCollection.delete(
|
||||||
|
name,
|
||||||
|
sqfliteFactory ?? idbFactory,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ import 'package:matrix/src/database/zone_transaction_mixin.dart';
|
||||||
class BoxCollection with ZoneTransactionMixin {
|
class BoxCollection with ZoneTransactionMixin {
|
||||||
final Database _db;
|
final Database _db;
|
||||||
final Set<String> boxNames;
|
final Set<String> boxNames;
|
||||||
final DatabaseFactory? _factory;
|
final String name;
|
||||||
|
|
||||||
BoxCollection(this._db, this.boxNames, this._factory);
|
BoxCollection(this._db, this.boxNames, this.name);
|
||||||
|
|
||||||
static Future<BoxCollection> open(
|
static Future<BoxCollection> open(
|
||||||
String name,
|
String name,
|
||||||
|
|
@ -32,7 +32,7 @@ class BoxCollection with ZoneTransactionMixin {
|
||||||
batch.execute('CREATE INDEX IF NOT EXISTS k_index ON $name (k)');
|
batch.execute('CREATE INDEX IF NOT EXISTS k_index ON $name (k)');
|
||||||
}
|
}
|
||||||
await batch.commit(noResult: true);
|
await batch.commit(noResult: true);
|
||||||
return BoxCollection(sqfliteDatabase, boxNames, sqfliteFactory);
|
return BoxCollection(sqfliteDatabase, boxNames, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Box<V> openBox<V>(String name) {
|
Box<V> openBox<V>(String name) {
|
||||||
|
|
@ -67,8 +67,8 @@ class BoxCollection with ZoneTransactionMixin {
|
||||||
|
|
||||||
Future<void> close() => _db.close();
|
Future<void> close() => _db.close();
|
||||||
|
|
||||||
Future<void> delete() =>
|
static Future<void> delete(String path, [DatabaseFactory? factory]) =>
|
||||||
(_factory ?? databaseFactory).deleteDatabase(_db.path);
|
(factory ?? databaseFactory).deleteDatabase(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Box<V> {
|
class Box<V> {
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
|
||||||
import 'package:slugify/slugify.dart';
|
import 'package:slugify/slugify.dart';
|
||||||
|
|
||||||
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
import 'package:matrix/src/room.dart';
|
import 'package:matrix/src/room.dart';
|
||||||
|
|
||||||
extension ImagePackRoomExtension on Room {
|
extension ImagePackRoomExtension on Room {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
mixin EventType {
|
mixin EventType {
|
||||||
static const String markedUnread = 'com.famedly.marked_unread';
|
static const String markedUnread = 'com.famedly.marked_unread';
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
import 'package:matrix/src/event.dart';
|
import 'package:matrix/src/event.dart';
|
||||||
|
|
||||||
class SpaceChild {
|
class SpaceChild {
|
||||||
|
|
|
||||||
|
|
@ -525,7 +525,7 @@ class CallSession {
|
||||||
Logs().v('[VOIP] Call invite has expired. Hanging up.');
|
Logs().v('[VOIP] Call invite has expired. Hanging up.');
|
||||||
hangupParty = CallParty.kRemote; // effectively
|
hangupParty = CallParty.kRemote; // effectively
|
||||||
fireCallEvent(CallEvent.kHangup);
|
fireCallEvent(CallEvent.kHangup);
|
||||||
hangup(CallErrorCode.InviteTimeout);
|
hangup(reason: CallErrorCode.InviteTimeout);
|
||||||
}
|
}
|
||||||
ringingTimer?.cancel();
|
ringingTimer?.cancel();
|
||||||
ringingTimer = null;
|
ringingTimer = null;
|
||||||
|
|
@ -550,7 +550,7 @@ class CallSession {
|
||||||
successor = newCall;
|
successor = newCall;
|
||||||
onCallReplaced.add(newCall);
|
onCallReplaced.add(newCall);
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
hangup(CallErrorCode.Replaced, true);
|
hangup(reason: CallErrorCode.Replaced);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> sendAnswer(RTCSessionDescription answer) async {
|
Future<void> sendAnswer(RTCSessionDescription answer) async {
|
||||||
|
|
@ -1164,7 +1164,7 @@ class CallSession {
|
||||||
if (state != CallState.kRinging && state != CallState.kFledgling) {
|
if (state != CallState.kRinging && state != CallState.kFledgling) {
|
||||||
Logs().e(
|
Logs().e(
|
||||||
'[VOIP] Call must be in \'ringing|fledgling\' state to reject! (current state was: ${state.toString()}) Calling hangup instead');
|
'[VOIP] Call must be in \'ringing|fledgling\' state to reject! (current state was: ${state.toString()}) Calling hangup instead');
|
||||||
await hangup(reason, shouldEmit);
|
await hangup(reason: reason, shouldEmit: shouldEmit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Logs().d('[VOIP] Rejecting call: $callId');
|
Logs().d('[VOIP] Rejecting call: $callId');
|
||||||
|
|
@ -1174,7 +1174,7 @@ class CallSession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> hangup([String? reason, bool shouldEmit = true]) async {
|
Future<void> hangup({String? reason, bool shouldEmit = true}) async {
|
||||||
await terminate(
|
await terminate(
|
||||||
CallParty.kLocal, reason ?? CallErrorCode.UserHangup, shouldEmit);
|
CallParty.kLocal, reason ?? CallErrorCode.UserHangup, shouldEmit);
|
||||||
|
|
||||||
|
|
@ -1303,8 +1303,9 @@ class CallSession {
|
||||||
capabilities: callCapabilities,
|
capabilities: callCapabilities,
|
||||||
metadata: metadata);
|
metadata: metadata);
|
||||||
// just incase we ended the call but already sent the invite
|
// just incase we ended the call but already sent the invite
|
||||||
|
// raraley happens during glares
|
||||||
if (state == CallState.kEnded) {
|
if (state == CallState.kEnded) {
|
||||||
await hangup(CallErrorCode.Replaced, false);
|
await hangup(reason: CallErrorCode.Replaced);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
inviteOrAnswerSent = true;
|
inviteOrAnswerSent = true;
|
||||||
|
|
@ -1318,7 +1319,7 @@ class CallSession {
|
||||||
|
|
||||||
inviteTimer = Timer(CallTimeouts.callInviteLifetime, () {
|
inviteTimer = Timer(CallTimeouts.callInviteLifetime, () {
|
||||||
if (state == CallState.kInviteSent) {
|
if (state == CallState.kInviteSent) {
|
||||||
hangup(CallErrorCode.InviteTimeout);
|
hangup(reason: CallErrorCode.InviteTimeout);
|
||||||
}
|
}
|
||||||
inviteTimer?.cancel();
|
inviteTimer?.cancel();
|
||||||
inviteTimer = null;
|
inviteTimer = null;
|
||||||
|
|
@ -1404,7 +1405,7 @@ class CallSession {
|
||||||
await updateMuteStatus();
|
await updateMuteStatus();
|
||||||
missedCall = false;
|
missedCall = false;
|
||||||
} else if (state == RTCIceConnectionState.RTCIceConnectionStateFailed) {
|
} else if (state == RTCIceConnectionState.RTCIceConnectionStateFailed) {
|
||||||
await hangup(CallErrorCode.IceFailed, false);
|
await hangup(reason: CallErrorCode.IceFailed);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -1614,7 +1615,7 @@ class CallSession {
|
||||||
'Failed to send candidates on attempt $candidateSendTries Giving up on this call.');
|
'Failed to send candidates on attempt $candidateSendTries Giving up on this call.');
|
||||||
lastError =
|
lastError =
|
||||||
CallError(CallErrorCode.SignallingFailed, 'Signalling failed', e);
|
CallError(CallErrorCode.SignallingFailed, 'Signalling failed', e);
|
||||||
await hangup(CallErrorCode.SignallingFailed, true);
|
await hangup(reason: CallErrorCode.SignallingFailed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1655,7 +1656,7 @@ class CallSession {
|
||||||
fireCallEvent(CallEvent.kError);
|
fireCallEvent(CallEvent.kError);
|
||||||
lastError = CallError(
|
lastError = CallError(
|
||||||
CallErrorCode.LocalOfferFailed, 'Failed to get local offer!', err);
|
CallErrorCode.LocalOfferFailed, 'Failed to get local offer!', err);
|
||||||
await terminate(CallParty.kLocal, CallErrorCode.LocalOfferFailed, false);
|
await terminate(CallParty.kLocal, CallErrorCode.LocalOfferFailed, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getUserMediaFailed(dynamic err) async {
|
Future<void> _getUserMediaFailed(dynamic err) async {
|
||||||
|
|
@ -1666,7 +1667,7 @@ class CallSession {
|
||||||
CallErrorCode.NoUserMedia,
|
CallErrorCode.NoUserMedia,
|
||||||
'Couldn\'t start capturing media! Is your microphone set up and does this app have permission?',
|
'Couldn\'t start capturing media! Is your microphone set up and does this app have permission?',
|
||||||
err);
|
err);
|
||||||
await terminate(CallParty.kLocal, CallErrorCode.NoUserMedia, false);
|
await terminate(CallParty.kLocal, CallErrorCode.NoUserMedia, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1029,7 +1029,9 @@ class GroupCall {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (call.state != CallState.kEnded) {
|
if (call.state != CallState.kEnded) {
|
||||||
await call.hangup(hangupReason, false);
|
// no need to emit individual handleCallEnded on group calls
|
||||||
|
// also prevents a loop of hangup and onCallHangupNotifierForGroupCalls
|
||||||
|
await call.hangup(reason: hangupReason, shouldEmit: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
final usermediaStream = getUserMediaStreamByUserId(opponentMemberId);
|
final usermediaStream = getUserMediaStreamByUserId(opponentMemberId);
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,7 @@ class VoIP {
|
||||||
(confId == null || confId != currentGroupCID)) {
|
(confId == null || confId != currentGroupCID)) {
|
||||||
Logs().v(
|
Logs().v(
|
||||||
'[VOIP] onCallInvite: Unable to handle new calls, maybe user is busy.');
|
'[VOIP] onCallInvite: Unable to handle new calls, maybe user is busy.');
|
||||||
|
// no need to emit here because handleNewCall was never triggered yet
|
||||||
await newCall.reject(reason: CallErrorCode.UserBusy, shouldEmit: false);
|
await newCall.reject(reason: CallErrorCode.UserBusy, shouldEmit: false);
|
||||||
await delegate.handleMissedCall(newCall);
|
await delegate.handleMissedCall(newCall);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ dependencies:
|
||||||
canonical_json: ^1.1.0
|
canonical_json: ^1.1.0
|
||||||
collection: ^1.15.0
|
collection: ^1.15.0
|
||||||
crypto: ^3.0.0
|
crypto: ^3.0.0
|
||||||
|
enhanced_enum: ^0.2.4
|
||||||
ffi: ^2.0.0
|
ffi: ^2.0.0
|
||||||
hive: ^2.2.3
|
hive: ^2.2.3
|
||||||
html: ^0.15.0
|
html: ^0.15.0
|
||||||
|
|
@ -23,7 +24,6 @@ dependencies:
|
||||||
image: ^4.0.15
|
image: ^4.0.15
|
||||||
js: ^0.6.3
|
js: ^0.6.3
|
||||||
markdown: ^7.1.1
|
markdown: ^7.1.1
|
||||||
matrix_api_lite: ^1.7.0
|
|
||||||
mime: ^1.0.0
|
mime: ^1.0.0
|
||||||
olm: ^2.0.2
|
olm: ^2.0.2
|
||||||
random_string: ^2.3.1
|
random_string: ^2.3.1
|
||||||
|
|
@ -35,7 +35,9 @@ dependencies:
|
||||||
webrtc_interface: ^1.0.13
|
webrtc_interface: ^1.0.13
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
build_runner: ^2.4.8
|
||||||
coverage: ">=0.15.0 <2.0.0"
|
coverage: ">=0.15.0 <2.0.0"
|
||||||
|
enhanced_enum_generator: ^0.2.4
|
||||||
file: ">=6.1.1 <8.0.0"
|
file: ">=6.1.1 <8.0.0"
|
||||||
import_sorter: ^4.6.0
|
import_sorter: ^4.6.0
|
||||||
lints: ^3.0.0
|
lints: ^3.0.0
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,9 @@ void main() {
|
||||||
const Set<String> boxNames = {'cats', 'dogs'};
|
const Set<String> boxNames = {'cats', 'dogs'};
|
||||||
const data = {'name': 'Fluffy', 'age': 2};
|
const data = {'name': 'Fluffy', 'age': 2};
|
||||||
const data2 = {'name': 'Loki', 'age': 4};
|
const data2 = {'name': 'Loki', 'age': 4};
|
||||||
|
late Database db;
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
final db = await databaseFactoryFfi.openDatabase(':memory:');
|
db = await databaseFactoryFfi.openDatabase(':memory:');
|
||||||
collection = await BoxCollection.open(
|
collection = await BoxCollection.open(
|
||||||
'testbox',
|
'testbox',
|
||||||
boxNames,
|
boxNames,
|
||||||
|
|
@ -91,7 +92,7 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Box.delete', () async {
|
test('Box.delete', () async {
|
||||||
await collection.delete();
|
await BoxCollection.delete(db.path, databaseFactoryFfi);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,10 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'package:matrix_api_lite/matrix_api_lite.dart';
|
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
import 'package:matrix/matrix_api_lite.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('Try-get-map-extension', () {
|
group('Try-get-map-extension', () {
|
||||||
test('it should work', () {
|
test('it should work', () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue