Bump the RustSDK to v1.0.79; add a feature flag for the new rust side ClientBuilder::useEventCachePersistentStorage

This commit is contained in:
Stefan Ceriu
2024-12-10 17:43:16 +02:00
committed by Stefan Ceriu
parent e59a705459
commit df3e5976ce
15 changed files with 232 additions and 38 deletions
+16 -1
View File
@@ -46,7 +46,17 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
// Used to create one single UserSession across process/instances/runs
private static let serialQueue = DispatchQueue(label: "io.element.elementx.nse")
private static var userSession: NSEUserSession?
// Temporary. We need to make sure the NSE and the main app pass in the same value.
// The NSE has a tendency of staying alive for longer so use this to manually kill it
// when the feature flag doesn't match.
private static var eventCacheEnabled = false
private static var userSession: NSEUserSession? {
didSet {
eventCacheEnabled = settings.eventCacheEnabled
}
}
override func didReceive(_ request: UNNotificationRequest,
withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
@@ -94,6 +104,11 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
return discard(unreadCount: request.unreadCount)
}
}
guard Self.eventCacheEnabled == settings.eventCacheEnabled else {
MXLog.error("Found missmatch `eventCacheEnabled` feature flag missmatch, restarting the NSE.")
exit(0)
}
Task {
await run(with: credentials,
+2 -1
View File
@@ -34,7 +34,8 @@ final class NSEUserSession {
slidingSync: .restored,
sessionDelegate: clientSessionDelegate,
appHooks: appHooks,
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode)
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode,
eventCacheEnabled: appSettings.eventCacheEnabled)
.sessionPaths(dataPath: credentials.restorationToken.sessionDirectories.dataPath,
cachePath: credentials.restorationToken.sessionDirectories.cachePath)
.username(username: credentials.userID)