mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
SDK Changes Refactor (#1312)
* internal id * notification refactor * client proxy refactor * required self * better identifier system * using the event id when required * tests fixed * tested some stuff * fixed merge conflict * improved the test wait * animation disabled * Bump Rust SDK version to 1.0.98-alpha (#1310) * code improvement * pause sync * pr suggestions * result * Apply suggestions from code review Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> * enum based debug identifier --------- Co-authored-by: aringenbach <80891108+aringenbach@users.noreply.github.com> Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
@@ -71,26 +71,9 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
|
||||
MXLog.info("\(tag) run with roomId: \(roomId), eventId: \(eventId)")
|
||||
|
||||
do {
|
||||
let userSession = try NSEUserSession(credentials: credentials)
|
||||
let userSession = try NSEUserSession(credentials: credentials, isEncryptionSyncEnabled: settings.isEncryptionSyncEnabled)
|
||||
self.userSession = userSession
|
||||
var itemProxy = await userSession.notificationItemProxy(roomID: roomId, eventID: eventId)
|
||||
if settings.isEncryptionSyncEnabled,
|
||||
itemProxy?.isEncrypted == true,
|
||||
let _ = try? userSession.startEncryptionSync() {
|
||||
// TODO: The following wait with a timeout should be handled by the SDK
|
||||
// We try to decrypt the notification for 10 seconds at most
|
||||
let date = Date()
|
||||
repeat {
|
||||
// if the sync terminated we try one last time then we break from the loop
|
||||
guard userSession.isSyncing else {
|
||||
itemProxy = await userSession.notificationItemProxy(roomID: roomId, eventID: eventId)
|
||||
break
|
||||
}
|
||||
itemProxy = await userSession.notificationItemProxy(roomID: roomId, eventID: eventId)
|
||||
} while itemProxy?.isEncrypted == true && date.timeIntervalSinceNow > -10
|
||||
}
|
||||
|
||||
guard let itemProxy else {
|
||||
guard let itemProxy = await userSession.notificationItemProxy(roomID: roomId, eventID: eventId) else {
|
||||
MXLog.info("\(tag) no notification for the event, discard")
|
||||
return discard()
|
||||
}
|
||||
@@ -146,7 +129,6 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
|
||||
private func cleanUp() {
|
||||
handler = nil
|
||||
modifiedContent = nil
|
||||
userSession?.stopEncryptionSync()
|
||||
}
|
||||
|
||||
deinit {
|
||||
|
||||
Reference in New Issue
Block a user