two sync loop always enabled by default

This commit is contained in:
Mauro Romito
2023-07-25 18:00:10 +02:00
committed by Mauro
parent 7a9edc5efa
commit ed28bc5d02
8 changed files with 5 additions and 19 deletions
@@ -11,7 +11,7 @@
{ {
"identity" : "compound-ios", "identity" : "compound-ios",
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/vector-im/compound-ios", "location" : "https://github.com/vector-im/compound-ios.git",
"state" : { "state" : {
"revision" : "d9e119fbef20857eb790dd4aafbe16ff46011eca" "revision" : "d9e119fbef20857eb790dd4aafbe16ff46011eca"
} }
@@ -188,10 +188,6 @@ final class AppSettings {
@UserPreference(key: UserDefaultsKeys.pusherProfileTag, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.pusherProfileTag, storageType: .userDefaults(store))
var pusherProfileTag: String? var pusherProfileTag: String?
/// Tag describing if the app and the NSE should use the encryption sync
@UserPreference(key: SharedUserDefaultsKeys.isEncryptionSyncEnabled, defaultValue: true, storageType: .userDefaults(store))
var isEncryptionSyncEnabled
// MARK: - Other // MARK: - Other
let permalinkBaseURL: URL = "https://matrix.to" let permalinkBaseURL: URL = "https://matrix.to"
@@ -46,7 +46,6 @@ protocol DeveloperOptionsProtocol: AnyObject {
var shouldCollapseRoomStateEvents: Bool { get set } var shouldCollapseRoomStateEvents: Bool { get set }
var userSuggestionsEnabled: Bool { get set } var userSuggestionsEnabled: Bool { get set }
var readReceiptsEnabled: Bool { get set } var readReceiptsEnabled: Bool { get set }
var isEncryptionSyncEnabled: Bool { get set }
var notificationSettingsEnabled: Bool { get set } var notificationSettingsEnabled: Bool { get set }
} }
@@ -34,11 +34,6 @@ struct DeveloperOptionsScreen: View {
} }
Section("Notifications") { Section("Notifications") {
Toggle(isOn: $context.isEncryptionSyncEnabled) {
Text("Use notification encryption sync")
Text("Requires app reboot")
}
Toggle(isOn: $context.notificationSettingsEnabled) { Toggle(isOn: $context.notificationSettingsEnabled) {
Text("Show notification settings") Text("Show notification settings")
} }
@@ -406,7 +406,7 @@ class ClientProxy: ClientProxyProtocol {
do { do {
let syncService = try await client let syncService = try await client
.syncService() .syncService()
.withEncryptionSync(withCrossProcessLock: appSettings.isEncryptionSyncEnabled, .withEncryptionSync(withCrossProcessLock: true,
appIdentifier: "MainApp") appIdentifier: "MainApp")
.finish() .finish()
let roomListService = syncService.roomListService() let roomListService = syncService.roomListService()
@@ -71,7 +71,7 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
MXLog.info("\(tag) run with roomId: \(roomId), eventId: \(eventId)") MXLog.info("\(tag) run with roomId: \(roomId), eventId: \(eventId)")
do { do {
let userSession = try NSEUserSession(credentials: credentials, isEncryptionSyncEnabled: settings.isEncryptionSyncEnabled) let userSession = try NSEUserSession(credentials: credentials)
self.userSession = userSession self.userSession = userSession
guard let itemProxy = await userSession.notificationItemProxy(roomID: roomId, eventID: eventId) else { guard let itemProxy = await userSession.notificationItemProxy(roomID: roomId, eventID: eventId) else {
MXLog.info("\(tag) no notification for the event, discard") MXLog.info("\(tag) no notification for the event, discard")
-4
View File
@@ -21,8 +21,4 @@ final class NSESettings {
/// UserDefaults to be used on reads and writes. /// UserDefaults to be used on reads and writes.
private static var store: UserDefaults! = UserDefaults(suiteName: suiteName) private static var store: UserDefaults! = UserDefaults(suiteName: suiteName)
/// Tag describing if the app and the NSE should use the encryption sync
@UserPreference(key: SharedUserDefaultsKeys.isEncryptionSyncEnabled, defaultValue: true, storageType: .userDefaults(store))
var isEncryptionSyncEnabled
} }
+2 -2
View File
@@ -25,7 +25,7 @@ final class NSEUserSession {
imageCache: .onlyOnDisk, imageCache: .onlyOnDisk,
backgroundTaskService: nil) backgroundTaskService: nil)
init(credentials: KeychainCredentials, isEncryptionSyncEnabled: Bool) throws { init(credentials: KeychainCredentials) throws {
userID = credentials.userID userID = credentials.userID
baseClient = try ClientBuilder() baseClient = try ClientBuilder()
.basePath(path: URL.sessionsBaseDirectory.path) .basePath(path: URL.sessionsBaseDirectory.path)
@@ -36,7 +36,7 @@ final class NSEUserSession {
notificationClient = baseClient notificationClient = baseClient
.notificationClient() .notificationClient()
.retryDecryption(withCrossProcessLock: isEncryptionSyncEnabled) .retryDecryption(withCrossProcessLock: true)
.finish() .finish()
} }