refactor: Remove old deprecations
They have been lived long enough and the next version will have breaking changes anyway.
This commit is contained in:
parent
4d6b108438
commit
bce45cbf2b
|
|
@ -108,33 +108,6 @@ class OlmManager {
|
|||
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;
|
||||
|
||||
/// 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;
|
||||
|
||||
@deprecated
|
||||
MatrixApi get api => this;
|
||||
|
||||
Encryption? encryption;
|
||||
|
||||
Set<KeyVerificationMethod> verificationMethods;
|
||||
|
|
@ -152,8 +149,6 @@ class Client extends MatrixApi {
|
|||
this.databaseDestroyer,
|
||||
this.legacyDatabaseBuilder,
|
||||
this.legacyDatabaseDestroyer,
|
||||
@Deprecated('This is now always enabled by default.')
|
||||
bool? enableE2eeRecovery,
|
||||
Set<KeyVerificationMethod>? verificationMethods,
|
||||
http.Client? httpClient,
|
||||
Set<String>? importantStateEvents,
|
||||
|
|
@ -170,7 +165,6 @@ class Client extends MatrixApi {
|
|||
Filter? syncFilter,
|
||||
this.sendTimelineEventTimeout = const Duration(minutes: 1),
|
||||
this.customImageResizer,
|
||||
@deprecated bool? debug,
|
||||
}) : syncFilter = syncFilter ??
|
||||
Filter(
|
||||
room: RoomFilter(
|
||||
|
|
@ -747,9 +741,6 @@ class Client extends MatrixApi {
|
|||
|
||||
final List<Room> _archivedRooms = [];
|
||||
|
||||
@Deprecated('Use [loadArchive()] instead.')
|
||||
Future<List<Room>> get archive => loadArchive();
|
||||
|
||||
Future<List<Room>> loadArchive() async {
|
||||
_archivedRooms.clear();
|
||||
final syncResp = await sync(
|
||||
|
|
@ -951,24 +942,6 @@ class Client extends MatrixApi {
|
|||
/// an error?
|
||||
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;
|
||||
|
||||
/// 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
|
||||
/// sessions and perform a new clean sync.
|
||||
Future<void> clearCache() async {
|
||||
|
|
|
|||
|
|
@ -39,15 +39,6 @@ abstract class RelationshipTypes {
|
|||
class Event extends MatrixEvent {
|
||||
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.
|
||||
final Room room;
|
||||
|
||||
|
|
|
|||
|
|
@ -75,15 +75,6 @@ class Room {
|
|||
|
||||
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).
|
||||
/// 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.
|
||||
|
|
@ -461,9 +452,6 @@ class Room {
|
|||
return 'Empty chat';
|
||||
}
|
||||
|
||||
@Deprecated('Use [lastEvent.body] instead')
|
||||
String get lastMessage => lastEvent?.body ?? '';
|
||||
|
||||
/// When the last message received.
|
||||
DateTime get timeCreated => lastEvent?.originServerTs ?? DateTime.now();
|
||||
|
||||
|
|
@ -564,9 +552,6 @@ class Room {
|
|||
/// in muted rooms, use [hasNewMessages].
|
||||
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
|
||||
/// data model before syncing it to make sure
|
||||
/// this works if there is no connection to the homeserver. This does **not**
|
||||
|
|
@ -617,11 +602,6 @@ class Room {
|
|||
{'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
|
||||
String? getMention(String mention) => getParticipants()
|
||||
.firstWhereOrNull((u) => u.mentionFragments.contains(mention))
|
||||
|
|
@ -634,7 +614,6 @@ class Room {
|
|||
Event? inReplyTo,
|
||||
String? editEventId,
|
||||
bool parseMarkdown = true,
|
||||
@deprecated Map<String, Map<String, String>>? emotePacks,
|
||||
bool parseCommands = true,
|
||||
String msgtype = MessageTypes.Text}) {
|
||||
if (parseCommands) {
|
||||
|
|
@ -1270,19 +1249,6 @@ class Room {
|
|||
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
|
||||
/// just want to update the whole timeline on every change, use the [onUpdate]
|
||||
/// callback. For updating only the parts that have changed, use the
|
||||
|
|
@ -1399,12 +1365,6 @@ class Room {
|
|||
(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
|
||||
/// the homeserver and returns a default [User] object while waiting.
|
||||
User getUserByMXIDSync(String mxID) {
|
||||
|
|
@ -1734,10 +1694,6 @@ class Room {
|
|||
Future<void> setTyping(bool isTyping, {int? 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,
|
||||
/// 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
|
||||
|
|
|
|||
|
|
@ -36,9 +36,6 @@ class EventUpdate {
|
|||
/// Most events belong to a room. If not, this equals to eventType.
|
||||
final String roomID;
|
||||
|
||||
@Deprecated("Use `content['type']` instead.")
|
||||
String get eventType => content['type'];
|
||||
|
||||
// The json payload of the content of this event.
|
||||
final Map<String, dynamic> content;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue