Merge branch 'krille/remove-deprecations' into 'main'
refactor: Remove old deprecations See merge request famedly/company/frontend/famedlysdk!1017
This commit is contained in:
		
						commit
						60fb103563
					
				|  | @ -108,33 +108,6 @@ class OlmManager { | ||||||
|     return _olmAccount!.sign(s); |     return _olmAccount!.sign(s); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   /// Checks the signature of a signed json object. |  | ||||||
|   @deprecated |  | ||||||
|   bool checkJsonSignature(String key, Map<String, dynamic> signedJson, |  | ||||||
|       String userId, String deviceId) { |  | ||||||
|     if (!enabled) throw ('Encryption is disabled'); |  | ||||||
|     final Map<String, dynamic>? signatures = signedJson['signatures']; |  | ||||||
|     if (signatures == null || !signatures.containsKey(userId)) return false; |  | ||||||
|     signedJson.remove('unsigned'); |  | ||||||
|     signedJson.remove('signatures'); |  | ||||||
|     if (!signatures[userId].containsKey('ed25519:$deviceId')) return false; |  | ||||||
|     final String signature = signatures[userId]['ed25519:$deviceId']; |  | ||||||
|     final canonical = canonicalJson.encode(signedJson); |  | ||||||
|     final message = String.fromCharCodes(canonical); |  | ||||||
|     var isValid = false; |  | ||||||
|     final olmutil = olm.Utility(); |  | ||||||
|     try { |  | ||||||
|       olmutil.ed25519_verify(key, message, signature); |  | ||||||
|       isValid = true; |  | ||||||
|     } catch (e, s) { |  | ||||||
|       isValid = false; |  | ||||||
|       Logs().w('[LibOlm] Signature check failed', e, s); |  | ||||||
|     } finally { |  | ||||||
|       olmutil.free(); |  | ||||||
|     } |  | ||||||
|     return isValid; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   bool _uploadKeysLock = false; |   bool _uploadKeysLock = false; | ||||||
| 
 | 
 | ||||||
|   /// Generates new one time keys, signs everything and upload it to the server. |   /// Generates new one time keys, signs everything and upload it to the server. | ||||||
|  |  | ||||||
|  | @ -63,9 +63,6 @@ class Client extends MatrixApi { | ||||||
| 
 | 
 | ||||||
|   DatabaseApi? get database => _database; |   DatabaseApi? get database => _database; | ||||||
| 
 | 
 | ||||||
|   @deprecated |  | ||||||
|   MatrixApi get api => this; |  | ||||||
| 
 |  | ||||||
|   Encryption? encryption; |   Encryption? encryption; | ||||||
| 
 | 
 | ||||||
|   Set<KeyVerificationMethod> verificationMethods; |   Set<KeyVerificationMethod> verificationMethods; | ||||||
|  | @ -152,8 +149,6 @@ class Client extends MatrixApi { | ||||||
|     this.databaseDestroyer, |     this.databaseDestroyer, | ||||||
|     this.legacyDatabaseBuilder, |     this.legacyDatabaseBuilder, | ||||||
|     this.legacyDatabaseDestroyer, |     this.legacyDatabaseDestroyer, | ||||||
|     @Deprecated('This is now always enabled by default.') |  | ||||||
|         bool? enableE2eeRecovery, |  | ||||||
|     Set<KeyVerificationMethod>? verificationMethods, |     Set<KeyVerificationMethod>? verificationMethods, | ||||||
|     http.Client? httpClient, |     http.Client? httpClient, | ||||||
|     Set<String>? importantStateEvents, |     Set<String>? importantStateEvents, | ||||||
|  | @ -170,7 +165,6 @@ class Client extends MatrixApi { | ||||||
|     Filter? syncFilter, |     Filter? syncFilter, | ||||||
|     this.sendTimelineEventTimeout = const Duration(minutes: 1), |     this.sendTimelineEventTimeout = const Duration(minutes: 1), | ||||||
|     this.customImageResizer, |     this.customImageResizer, | ||||||
|     @deprecated bool? debug, |  | ||||||
|   })  : syncFilter = syncFilter ?? |   })  : syncFilter = syncFilter ?? | ||||||
|             Filter( |             Filter( | ||||||
|               room: RoomFilter( |               room: RoomFilter( | ||||||
|  | @ -747,9 +741,6 @@ class Client extends MatrixApi { | ||||||
| 
 | 
 | ||||||
|   final List<Room> _archivedRooms = []; |   final List<Room> _archivedRooms = []; | ||||||
| 
 | 
 | ||||||
|   @Deprecated('Use [loadArchive()] instead.') |  | ||||||
|   Future<List<Room>> get archive => loadArchive(); |  | ||||||
| 
 |  | ||||||
|   Future<List<Room>> loadArchive() async { |   Future<List<Room>> loadArchive() async { | ||||||
|     _archivedRooms.clear(); |     _archivedRooms.clear(); | ||||||
|     final syncResp = await sync( |     final syncResp = await sync( | ||||||
|  | @ -951,24 +942,6 @@ class Client extends MatrixApi { | ||||||
|   /// an error? |   /// an error? | ||||||
|   int syncErrorTimeoutSec = 3; |   int syncErrorTimeoutSec = 3; | ||||||
| 
 | 
 | ||||||
|   @Deprecated('Use init() instead') |  | ||||||
|   void connect({ |  | ||||||
|     String? newToken, |  | ||||||
|     Uri? newHomeserver, |  | ||||||
|     String? newUserID, |  | ||||||
|     String? newDeviceName, |  | ||||||
|     String? newDeviceID, |  | ||||||
|     String? newOlmAccount, |  | ||||||
|   }) => |  | ||||||
|       init( |  | ||||||
|         newToken: newToken, |  | ||||||
|         newHomeserver: newHomeserver, |  | ||||||
|         newUserID: newUserID, |  | ||||||
|         newDeviceName: newDeviceName, |  | ||||||
|         newDeviceID: newDeviceID, |  | ||||||
|         newOlmAccount: newOlmAccount, |  | ||||||
|       ); |  | ||||||
| 
 |  | ||||||
|   bool _initLock = false; |   bool _initLock = false; | ||||||
| 
 | 
 | ||||||
|   /// Fetches the corresponding Event object from a notification including a |   /// Fetches the corresponding Event object from a notification including a | ||||||
|  | @ -2431,11 +2404,6 @@ class Client extends MatrixApi { | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   @Deprecated('Use clearCache()') |  | ||||||
|   Future<void> clearLocalCachedMessages() async { |  | ||||||
|     await clearCache(); |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   /// Clear all local cached messages, room information and outbound group |   /// Clear all local cached messages, room information and outbound group | ||||||
|   /// sessions and perform a new clean sync. |   /// sessions and perform a new clean sync. | ||||||
|   Future<void> clearCache() async { |   Future<void> clearCache() async { | ||||||
|  |  | ||||||
|  | @ -39,15 +39,6 @@ abstract class RelationshipTypes { | ||||||
| class Event extends MatrixEvent { | class Event extends MatrixEvent { | ||||||
|   User get sender => room.getUserByMXIDSync(senderId); |   User get sender => room.getUserByMXIDSync(senderId); | ||||||
| 
 | 
 | ||||||
|   @Deprecated('Use [originServerTs] instead') |  | ||||||
|   DateTime get time => originServerTs; |  | ||||||
| 
 |  | ||||||
|   @Deprecated('Use [type] instead') |  | ||||||
|   String get typeKey => type; |  | ||||||
| 
 |  | ||||||
|   @Deprecated('Use [sender.calcDisplayname()] instead') |  | ||||||
|   String? get senderName => sender.calcDisplayname(); |  | ||||||
| 
 |  | ||||||
|   /// The room this event belongs to. May be null. |   /// The room this event belongs to. May be null. | ||||||
|   final Room room; |   final Room room; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -75,15 +75,6 @@ class Room { | ||||||
| 
 | 
 | ||||||
|   RoomSummary summary; |   RoomSummary summary; | ||||||
| 
 | 
 | ||||||
|   @deprecated |  | ||||||
|   List<String>? get mHeroes => summary.mHeroes; |  | ||||||
| 
 |  | ||||||
|   @deprecated |  | ||||||
|   int? get mJoinedMemberCount => summary.mJoinedMemberCount; |  | ||||||
| 
 |  | ||||||
|   @deprecated |  | ||||||
|   int? get mInvitedMemberCount => summary.mInvitedMemberCount; |  | ||||||
| 
 |  | ||||||
|   /// The room states are a key value store of the key (`type`,`state_key`) => State(event). |   /// The room states are a key value store of the key (`type`,`state_key`) => State(event). | ||||||
|   /// In a lot of cases the `state_key` might be an empty string. You **should** use the |   /// In a lot of cases the `state_key` might be an empty string. You **should** use the | ||||||
|   /// methods `getState()` and `setState()` to interact with the room states. |   /// methods `getState()` and `setState()` to interact with the room states. | ||||||
|  | @ -461,9 +452,6 @@ class Room { | ||||||
|     return 'Empty chat'; |     return 'Empty chat'; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   @Deprecated('Use [lastEvent.body] instead') |  | ||||||
|   String get lastMessage => lastEvent?.body ?? ''; |  | ||||||
| 
 |  | ||||||
|   /// When the last message received. |   /// When the last message received. | ||||||
|   DateTime get timeCreated => lastEvent?.originServerTs ?? DateTime.now(); |   DateTime get timeCreated => lastEvent?.originServerTs ?? DateTime.now(); | ||||||
| 
 | 
 | ||||||
|  | @ -564,9 +552,6 @@ class Room { | ||||||
|   /// in muted rooms, use [hasNewMessages]. |   /// in muted rooms, use [hasNewMessages]. | ||||||
|   bool get isUnread => notificationCount > 0 || markedUnread; |   bool get isUnread => notificationCount > 0 || markedUnread; | ||||||
| 
 | 
 | ||||||
|   @Deprecated('Use [markUnread] instead') |  | ||||||
|   Future<void> setUnread(bool unread) => markUnread(unread); |  | ||||||
| 
 |  | ||||||
|   /// Sets an unread flag manually for this room. This changes the local account |   /// Sets an unread flag manually for this room. This changes the local account | ||||||
|   /// data model before syncing it to make sure |   /// data model before syncing it to make sure | ||||||
|   /// this works if there is no connection to the homeserver. This does **not** |   /// this works if there is no connection to the homeserver. This does **not** | ||||||
|  | @ -617,11 +602,6 @@ class Room { | ||||||
|         {'pinned': pinnedEventIds}, |         {'pinned': pinnedEventIds}, | ||||||
|       ); |       ); | ||||||
| 
 | 
 | ||||||
|   /// return all current emote packs for this room |  | ||||||
|   @deprecated |  | ||||||
|   Map<String, Map<String, String>> get emotePacks => |  | ||||||
|       getImagePacksFlat(ImagePackUsage.emoticon); |  | ||||||
| 
 |  | ||||||
|   /// returns the resolved mxid for a mention string, or null if none found |   /// returns the resolved mxid for a mention string, or null if none found | ||||||
|   String? getMention(String mention) => getParticipants() |   String? getMention(String mention) => getParticipants() | ||||||
|       .firstWhereOrNull((u) => u.mentionFragments.contains(mention)) |       .firstWhereOrNull((u) => u.mentionFragments.contains(mention)) | ||||||
|  | @ -634,7 +614,6 @@ class Room { | ||||||
|       Event? inReplyTo, |       Event? inReplyTo, | ||||||
|       String? editEventId, |       String? editEventId, | ||||||
|       bool parseMarkdown = true, |       bool parseMarkdown = true, | ||||||
|       @deprecated Map<String, Map<String, String>>? emotePacks, |  | ||||||
|       bool parseCommands = true, |       bool parseCommands = true, | ||||||
|       String msgtype = MessageTypes.Text}) { |       String msgtype = MessageTypes.Text}) { | ||||||
|     if (parseCommands) { |     if (parseCommands) { | ||||||
|  | @ -1270,19 +1249,6 @@ class Room { | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   /// Sends *m.fully_read* and *m.read* for the given event ID. |  | ||||||
|   @Deprecated('Use sendReadMarker instead') |  | ||||||
|   Future<void> sendReadReceipt(String eventID) async { |  | ||||||
|     notificationCount = 0; |  | ||||||
|     await client.database?.resetNotificationCount(id); |  | ||||||
|     await client.setReadMarker( |  | ||||||
|       id, |  | ||||||
|       eventID, |  | ||||||
|       mRead: eventID, |  | ||||||
|     ); |  | ||||||
|     return; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   /// Creates a timeline from the store. Returns a [Timeline] object. If you |   /// Creates a timeline from the store. Returns a [Timeline] object. If you | ||||||
|   /// just want to update the whole timeline on every change, use the [onUpdate] |   /// just want to update the whole timeline on every change, use the [onUpdate] | ||||||
|   /// callback. For updating only the parts that have changed, use the |   /// callback. For updating only the parts that have changed, use the | ||||||
|  | @ -1399,12 +1365,6 @@ class Room { | ||||||
|         (summary.mJoinedMemberCount ?? 0) + (summary.mInvitedMemberCount ?? 0); |         (summary.mJoinedMemberCount ?? 0) + (summary.mInvitedMemberCount ?? 0); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   /// Returns the [User] object for the given [mxID] or requests it from |  | ||||||
|   /// the homeserver and waits for a response. |  | ||||||
|   @Deprecated('Use [requestUser] instead') |  | ||||||
|   Future<User?> getUserByMXID(String mxID) async => |  | ||||||
|       getState(EventTypes.RoomMember, mxID)?.asUser ?? await requestUser(mxID); |  | ||||||
| 
 |  | ||||||
|   /// Returns the [User] object for the given [mxID] or requests it from |   /// Returns the [User] object for the given [mxID] or requests it from | ||||||
|   /// the homeserver and returns a default [User] object while waiting. |   /// the homeserver and returns a default [User] object while waiting. | ||||||
|   User getUserByMXIDSync(String mxID) { |   User getUserByMXIDSync(String mxID) { | ||||||
|  | @ -1734,10 +1694,6 @@ class Room { | ||||||
|   Future<void> setTyping(bool isTyping, {int? timeout}) => |   Future<void> setTyping(bool isTyping, {int? timeout}) => | ||||||
|       client.setTyping(client.userID!, id, isTyping, timeout: timeout); |       client.setTyping(client.userID!, id, isTyping, timeout: timeout); | ||||||
| 
 | 
 | ||||||
|   @Deprecated('Use sendTypingNotification instead') |  | ||||||
|   Future<void> sendTypingInfo(bool isTyping, {int? timeout}) => |  | ||||||
|       setTyping(isTyping, timeout: timeout); |  | ||||||
| 
 |  | ||||||
|   /// A room may be public meaning anyone can join the room without any prior action. Alternatively, |   /// A room may be public meaning anyone can join the room without any prior action. Alternatively, | ||||||
|   /// it can be invite meaning that a user who wishes to join the room must first receive an invite |   /// it can be invite meaning that a user who wishes to join the room must first receive an invite | ||||||
|   /// to the room from someone already inside of the room. Currently, knock and private are reserved |   /// to the room from someone already inside of the room. Currently, knock and private are reserved | ||||||
|  |  | ||||||
|  | @ -36,9 +36,6 @@ class EventUpdate { | ||||||
|   /// Most events belong to a room. If not, this equals to eventType. |   /// Most events belong to a room. If not, this equals to eventType. | ||||||
|   final String roomID; |   final String roomID; | ||||||
| 
 | 
 | ||||||
|   @Deprecated("Use `content['type']` instead.") |  | ||||||
|   String get eventType => content['type']; |  | ||||||
| 
 |  | ||||||
|   // The json payload of the content of this event. |   // The json payload of the content of this event. | ||||||
|   final Map<String, dynamic> content; |   final Map<String, dynamic> content; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue