Remove the event cache feature flag, it's enabled by default on the SDK and we haven't had any bug reports for it.

This commit is contained in:
Stefan Ceriu
2025-04-03 15:39:49 +03:00
parent 62636d8378
commit 5500cc2335
7 changed files with 4 additions and 39 deletions
@@ -19,7 +19,6 @@ protocol CommonSettingsProtocol {
var enableOnlySignedDeviceIsolationMode: Bool { get } var enableOnlySignedDeviceIsolationMode: Bool { get }
var hideInviteAvatars: Bool { get } var hideInviteAvatars: Bool { get }
var hideTimelineMedia: Bool { get } var hideTimelineMedia: Bool { get }
var eventCacheEnabled: Bool { get }
} }
/// Store Element specific app settings. /// Store Element specific app settings.
@@ -57,7 +56,6 @@ final class AppSettings {
case fuzzyRoomListSearchEnabled case fuzzyRoomListSearchEnabled
case enableOnlySignedDeviceIsolationMode case enableOnlySignedDeviceIsolationMode
case knockingEnabled case knockingEnabled
case eventCacheEnabledV2
} }
private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier
@@ -343,9 +341,6 @@ final class AppSettings {
@UserPreference(key: UserDefaultsKeys.hideTimelineMedia, defaultValue: false, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.hideTimelineMedia, defaultValue: false, storageType: .userDefaults(store))
var hideTimelineMedia var hideTimelineMedia
@UserPreference(key: UserDefaultsKeys.eventCacheEnabledV2, defaultValue: true, storageType: .userDefaults(store))
var eventCacheEnabled
} }
extension AppSettings: CommonSettingsProtocol { } extension AppSettings: CommonSettingsProtocol { }
@@ -15,15 +15,13 @@ extension ClientBuilder {
slidingSync: ClientBuilderSlidingSync, slidingSync: ClientBuilderSlidingSync,
sessionDelegate: ClientSessionDelegate, sessionDelegate: ClientSessionDelegate,
appHooks: AppHooks, appHooks: AppHooks,
enableOnlySignedDeviceIsolationMode: Bool, enableOnlySignedDeviceIsolationMode: Bool) -> ClientBuilder {
eventCacheEnabled: Bool) -> ClientBuilder {
var builder = ClientBuilder() var builder = ClientBuilder()
.crossProcessStoreLocksHolderName(holderName: InfoPlistReader.main.bundleIdentifier) .crossProcessStoreLocksHolderName(holderName: InfoPlistReader.main.bundleIdentifier)
.enableOidcRefreshLock() .enableOidcRefreshLock()
.setSessionDelegate(sessionDelegate: sessionDelegate) .setSessionDelegate(sessionDelegate: sessionDelegate)
.userAgent(userAgent: UserAgentBuilder.makeASCIIUserAgent()) .userAgent(userAgent: UserAgentBuilder.makeASCIIUserAgent())
.requestConfig(config: .init(retryLimit: 0, timeout: 30000, maxConcurrentRequests: nil, retryTimeout: nil)) .requestConfig(config: .init(retryLimit: 0, timeout: 30000, maxConcurrentRequests: nil, retryTimeout: nil))
.useEventCachePersistentStorage(value: eventCacheEnabled)
builder = switch slidingSync { builder = switch slidingSync {
case .restored: builder case .restored: builder
@@ -44,7 +44,6 @@ protocol DeveloperOptionsProtocol: AnyObject {
var enableOnlySignedDeviceIsolationMode: Bool { get set } var enableOnlySignedDeviceIsolationMode: Bool { get set }
var elementCallBaseURLOverride: URL? { get set } var elementCallBaseURLOverride: URL? { get set }
var knockingEnabled: Bool { get set } var knockingEnabled: Bool { get set }
var eventCacheEnabled: Bool { get set }
} }
extension AppSettings: DeveloperOptionsProtocol { } extension AppSettings: DeveloperOptionsProtocol { }
@@ -30,16 +30,7 @@ struct DeveloperOptionsScreen: View {
} }
} }
} }
Section("General") {
Toggle(isOn: $context.eventCacheEnabled) {
Text("Event cache")
}
.onChange(of: context.eventCacheEnabled) {
context.send(viewAction: .clearCache)
}
}
Section("Room List") { Section("Room List") {
Toggle(isOn: $context.publicSearchEnabled) { Toggle(isOn: $context.publicSearchEnabled) {
Text("Public search") Text("Public search")
@@ -48,8 +48,7 @@ struct AuthenticationClientBuilder: AuthenticationClientBuilderProtocol {
slidingSync: .discover, slidingSync: .discover,
sessionDelegate: clientSessionDelegate, sessionDelegate: clientSessionDelegate,
appHooks: appHooks, appHooks: appHooks,
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode, enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode)
eventCacheEnabled: appSettings.eventCacheEnabled)
.sessionPaths(dataPath: sessionDirectories.dataPath, .sessionPaths(dataPath: sessionDirectories.dataPath,
cachePath: sessionDirectories.cachePath) cachePath: sessionDirectories.cachePath)
.sessionPassphrase(passphrase: passphrase) .sessionPassphrase(passphrase: passphrase)
@@ -123,8 +123,7 @@ class UserSessionStore: UserSessionStoreProtocol {
slidingSync: .restored, slidingSync: .restored,
sessionDelegate: keychainController, sessionDelegate: keychainController,
appHooks: appHooks, appHooks: appHooks,
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode, enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode)
eventCacheEnabled: appSettings.eventCacheEnabled)
.sessionPaths(dataPath: credentials.restorationToken.sessionDirectories.dataPath, .sessionPaths(dataPath: credentials.restorationToken.sessionDirectories.dataPath,
cachePath: credentials.restorationToken.sessionDirectories.cachePath) cachePath: credentials.restorationToken.sessionDirectories.cachePath)
.username(username: credentials.userID) .username(username: credentials.userID)
@@ -47,17 +47,6 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
// Used to create one single UserSession across process/instances/runs // Used to create one single UserSession across process/instances/runs
private static let serialQueue = DispatchQueue(label: "io.element.elementx.nse") private static let serialQueue = DispatchQueue(label: "io.element.elementx.nse")
// 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
}
}
deinit { deinit {
cleanUp() cleanUp()
ExtensionLogger.logMemory(with: tag) ExtensionLogger.logMemory(with: tag)
@@ -111,11 +100,6 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
} }
} }
guard Self.eventCacheEnabled == settings.eventCacheEnabled else {
MXLog.error("Found missmatch `eventCacheEnabled` feature flag missmatch, restarting the NSE.")
exit(0)
}
Task { Task {
await run(with: credentials, await run(with: credentials,
roomID: roomID, roomID: roomID,