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