mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 13:37:11 +00:00
Add a feature flag for Simplified Sliding Sync. (#3057)
* Disable SSS when logging out. * Bump the SDK.
This commit is contained in:
parent
288d2c2fdc
commit
2fb7f65957
@ -7449,7 +7449,7 @@
|
||||
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = 1.0.25;
|
||||
version = 1.0.26;
|
||||
};
|
||||
};
|
||||
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
||||
|
@ -149,8 +149,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
||||
"state" : {
|
||||
"revision" : "dd9e0d89d65be16c3db1a14a121543e0af326536",
|
||||
"version" : "1.0.25"
|
||||
"revision" : "29a19a07df68a5fe97431d08c944ced27e791ae3",
|
||||
"version" : "1.0.26"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
|
||||
|
||||
let keychainController = KeychainController(service: .sessions,
|
||||
accessGroup: InfoPlistReader.main.keychainAccessGroupIdentifier)
|
||||
userSessionStore = UserSessionStore(keychainController: keychainController, appHooks: appHooks)
|
||||
userSessionStore = UserSessionStore(keychainController: keychainController, appSettings: appSettings, appHooks: appHooks)
|
||||
|
||||
let appLockService = AppLockService(keychainController: keychainController, appSettings: appSettings)
|
||||
let appLockNavigationCoordinator = NavigationRootCoordinator()
|
||||
|
@ -43,6 +43,7 @@ final class AppSettings {
|
||||
case elementCallEncryptionEnabled
|
||||
|
||||
// Feature flags
|
||||
case simplifiedSlidingSyncEnabled
|
||||
case publicSearchEnabled
|
||||
case fuzzyRoomListSearchEnabled
|
||||
}
|
||||
@ -62,6 +63,7 @@ final class AppSettings {
|
||||
static func resetSessionSpecificSettings() {
|
||||
MXLog.warning("Resetting the user session specific AppSettings.")
|
||||
store.removeObject(forKey: UserDefaultsKeys.hasRunIdentityConfirmationOnboarding.rawValue)
|
||||
store.removeObject(forKey: UserDefaultsKeys.simplifiedSlidingSyncEnabled.rawValue)
|
||||
}
|
||||
|
||||
static func configureWithSuiteName(_ name: String) {
|
||||
@ -286,4 +288,9 @@ final class AppSettings {
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.logLevel, defaultValue: TracingConfiguration.LogLevel.info, storageType: .userDefaults(store))
|
||||
var logLevel
|
||||
|
||||
// MARK: Shared Feature Flags
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.simplifiedSlidingSyncEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||
var simplifiedSlidingSyncEnabled
|
||||
}
|
||||
|
@ -4041,6 +4041,71 @@ open class ClientBuilderSDKMock: MatrixRustSDK.ClientBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - disableBuiltInRootCertificates
|
||||
|
||||
var disableBuiltInRootCertificatesUnderlyingCallsCount = 0
|
||||
open var disableBuiltInRootCertificatesCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return disableBuiltInRootCertificatesUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = disableBuiltInRootCertificatesUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
disableBuiltInRootCertificatesUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
disableBuiltInRootCertificatesUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var disableBuiltInRootCertificatesCalled: Bool {
|
||||
return disableBuiltInRootCertificatesCallsCount > 0
|
||||
}
|
||||
|
||||
var disableBuiltInRootCertificatesUnderlyingReturnValue: ClientBuilder!
|
||||
open var disableBuiltInRootCertificatesReturnValue: ClientBuilder! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return disableBuiltInRootCertificatesUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: ClientBuilder? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = disableBuiltInRootCertificatesUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
disableBuiltInRootCertificatesUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
disableBuiltInRootCertificatesUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var disableBuiltInRootCertificatesClosure: (() -> ClientBuilder)?
|
||||
|
||||
open override func disableBuiltInRootCertificates() -> ClientBuilder {
|
||||
disableBuiltInRootCertificatesCallsCount += 1
|
||||
if let disableBuiltInRootCertificatesClosure = disableBuiltInRootCertificatesClosure {
|
||||
return disableBuiltInRootCertificatesClosure()
|
||||
} else {
|
||||
return disableBuiltInRootCertificatesReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - disableSslVerification
|
||||
|
||||
var disableSslVerificationUnderlyingCallsCount = 0
|
||||
@ -4739,6 +4804,77 @@ open class ClientBuilderSDKMock: MatrixRustSDK.ClientBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - simplifiedSlidingSync
|
||||
|
||||
var simplifiedSlidingSyncEnableUnderlyingCallsCount = 0
|
||||
open var simplifiedSlidingSyncEnableCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return simplifiedSlidingSyncEnableUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = simplifiedSlidingSyncEnableUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
simplifiedSlidingSyncEnableUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
simplifiedSlidingSyncEnableUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var simplifiedSlidingSyncEnableCalled: Bool {
|
||||
return simplifiedSlidingSyncEnableCallsCount > 0
|
||||
}
|
||||
open var simplifiedSlidingSyncEnableReceivedEnable: Bool?
|
||||
open var simplifiedSlidingSyncEnableReceivedInvocations: [Bool] = []
|
||||
|
||||
var simplifiedSlidingSyncEnableUnderlyingReturnValue: ClientBuilder!
|
||||
open var simplifiedSlidingSyncEnableReturnValue: ClientBuilder! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return simplifiedSlidingSyncEnableUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: ClientBuilder? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = simplifiedSlidingSyncEnableUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
simplifiedSlidingSyncEnableUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
simplifiedSlidingSyncEnableUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var simplifiedSlidingSyncEnableClosure: ((Bool) -> ClientBuilder)?
|
||||
|
||||
open override func simplifiedSlidingSync(enable: Bool) -> ClientBuilder {
|
||||
simplifiedSlidingSyncEnableCallsCount += 1
|
||||
simplifiedSlidingSyncEnableReceivedEnable = enable
|
||||
DispatchQueue.main.async {
|
||||
self.simplifiedSlidingSyncEnableReceivedInvocations.append(enable)
|
||||
}
|
||||
if let simplifiedSlidingSyncEnableClosure = simplifiedSlidingSyncEnableClosure {
|
||||
return simplifiedSlidingSyncEnableClosure(enable)
|
||||
} else {
|
||||
return simplifiedSlidingSyncEnableReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - slidingSyncProxy
|
||||
|
||||
var slidingSyncProxySlidingSyncProxyUnderlyingCallsCount = 0
|
||||
@ -15494,42 +15630,6 @@ open class RoomListItemSDKMock: MatrixRustSDK.RoomListItem {
|
||||
}
|
||||
subscribeSettingsClosure?(settings)
|
||||
}
|
||||
|
||||
//MARK: - unsubscribe
|
||||
|
||||
var unsubscribeUnderlyingCallsCount = 0
|
||||
open var unsubscribeCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return unsubscribeUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = unsubscribeUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
unsubscribeUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
unsubscribeUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var unsubscribeCalled: Bool {
|
||||
return unsubscribeCallsCount > 0
|
||||
}
|
||||
open var unsubscribeClosure: (() -> Void)?
|
||||
|
||||
open override func unsubscribe() {
|
||||
unsubscribeCallsCount += 1
|
||||
unsubscribeClosure?()
|
||||
}
|
||||
}
|
||||
open class RoomListServiceSDKMock: MatrixRustSDK.RoomListService {
|
||||
init() {
|
||||
|
@ -23,11 +23,13 @@ extension ClientBuilder {
|
||||
httpProxy: String? = nil,
|
||||
slidingSyncProxy: URL? = nil,
|
||||
sessionDelegate: ClientSessionDelegate,
|
||||
simplifiedSlidingSyncEnabled: Bool,
|
||||
appHooks: AppHooks) -> ClientBuilder {
|
||||
var builder = ClientBuilder()
|
||||
.slidingSyncProxy(slidingSyncProxy: slidingSyncProxy?.absoluteString)
|
||||
.enableCrossProcessRefreshLock(processId: InfoPlistReader.main.bundleIdentifier, sessionDelegate: sessionDelegate)
|
||||
.userAgent(userAgent: UserAgentBuilder.makeASCIIUserAgent())
|
||||
.simplifiedSlidingSync(enable: simplifiedSlidingSyncEnabled)
|
||||
|
||||
if setupEncryption {
|
||||
builder = builder
|
||||
|
@ -46,6 +46,7 @@ enum DeveloperOptionsScreenViewAction {
|
||||
|
||||
protocol DeveloperOptionsProtocol: AnyObject {
|
||||
var logLevel: TracingConfiguration.LogLevel { get set }
|
||||
var simplifiedSlidingSyncEnabled: Bool { get set }
|
||||
var hideUnreadMessagesBadge: Bool { get set }
|
||||
var elementCallBaseURLOverride: URL? { get set }
|
||||
var fuzzyRoomListSearchEnabled: Bool { get set }
|
||||
|
@ -27,6 +27,13 @@ struct DeveloperOptionsScreen: View {
|
||||
LogLevelConfigurationView(logLevel: $context.logLevel)
|
||||
}
|
||||
|
||||
Section("Sliding Sync") {
|
||||
Toggle(isOn: $context.simplifiedSlidingSyncEnabled) {
|
||||
Text("Simplified Sliding Sync")
|
||||
Text("Requires app reboot")
|
||||
}
|
||||
}
|
||||
|
||||
Section("Room List") {
|
||||
Toggle(isOn: $context.hideUnreadMessagesBadge) {
|
||||
Text("Hide grey dots")
|
||||
|
@ -143,6 +143,7 @@ class AuthenticationService: AuthenticationServiceProtocol {
|
||||
.baseBuilder(httpProxy: appSettings.websiteURL.globalProxy,
|
||||
slidingSyncProxy: appSettings.slidingSyncProxyURL,
|
||||
sessionDelegate: userSessionStore.clientSessionDelegate,
|
||||
simplifiedSlidingSyncEnabled: appSettings.simplifiedSlidingSyncEnabled,
|
||||
appHooks: appHooks)
|
||||
.sessionPath(path: sessionDirectory.path(percentEncoded: false))
|
||||
.passphrase(passphrase: passphrase)
|
||||
|
@ -61,6 +61,7 @@ final class QRCodeLoginService: QRCodeLoginServiceProtocol {
|
||||
.baseBuilder(httpProxy: appSettings.websiteURL.globalProxy,
|
||||
slidingSyncProxy: appSettings.slidingSyncProxyURL,
|
||||
sessionDelegate: userSessionStore.clientSessionDelegate,
|
||||
simplifiedSlidingSyncEnabled: appSettings.simplifiedSlidingSyncEnabled,
|
||||
appHooks: appHooks)
|
||||
.sessionPath(path: sessionDirectory.path(percentEncoded: false))
|
||||
.passphrase(passphrase: passphrase)
|
||||
|
@ -20,6 +20,7 @@ import MatrixRustSDK
|
||||
|
||||
class UserSessionStore: UserSessionStoreProtocol {
|
||||
private let keychainController: KeychainControllerProtocol
|
||||
private let appSettings: AppSettings
|
||||
private let appHooks: AppHooks
|
||||
private let matrixSDKStateKey = "matrix-sdk-state"
|
||||
|
||||
@ -30,8 +31,9 @@ class UserSessionStore: UserSessionStoreProtocol {
|
||||
|
||||
var clientSessionDelegate: ClientSessionDelegate { keychainController }
|
||||
|
||||
init(keychainController: KeychainControllerProtocol, appHooks: AppHooks) {
|
||||
init(keychainController: KeychainControllerProtocol, appSettings: AppSettings, appHooks: AppHooks) {
|
||||
self.keychainController = keychainController
|
||||
self.appSettings = appSettings
|
||||
self.appHooks = appHooks
|
||||
}
|
||||
|
||||
@ -123,6 +125,7 @@ class UserSessionStore: UserSessionStoreProtocol {
|
||||
let builder = ClientBuilder
|
||||
.baseBuilder(httpProxy: URL(string: homeserverURL)?.globalProxy,
|
||||
sessionDelegate: keychainController,
|
||||
simplifiedSlidingSyncEnabled: appSettings.simplifiedSlidingSyncEnabled,
|
||||
appHooks: appHooks)
|
||||
.sessionPath(path: credentials.restorationToken.sessionDirectory.path(percentEncoded: false))
|
||||
.username(username: credentials.userID)
|
||||
|
@ -86,7 +86,10 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
|
||||
// It's imperative that we create **at most** one UserSession/Client per process
|
||||
Task.synchronous { [appHooks] in
|
||||
do {
|
||||
Self.userSession = try await NSEUserSession(credentials: credentials, clientSessionDelegate: keychainController, appHooks: appHooks)
|
||||
Self.userSession = try await NSEUserSession(credentials: credentials,
|
||||
clientSessionDelegate: keychainController,
|
||||
simplifiedSlidingSyncEnabled: settings.simplifiedSlidingSyncEnabled,
|
||||
appHooks: appHooks)
|
||||
} catch {
|
||||
MXLog.error("Failed creating user session with error: \(error)")
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import Foundation
|
||||
|
||||
protocol NSESettingsProtocol {
|
||||
var logLevel: TracingConfiguration.LogLevel { get }
|
||||
var simplifiedSlidingSyncEnabled: Bool { get }
|
||||
}
|
||||
|
||||
extension AppSettings: NSESettingsProtocol { }
|
||||
|
@ -25,7 +25,7 @@ final class NSEUserSession {
|
||||
imageCache: .onlyOnDisk)
|
||||
private let delegateHandle: TaskHandle?
|
||||
|
||||
init(credentials: KeychainCredentials, clientSessionDelegate: ClientSessionDelegate, appHooks: AppHooks) async throws {
|
||||
init(credentials: KeychainCredentials, clientSessionDelegate: ClientSessionDelegate, simplifiedSlidingSyncEnabled: Bool, appHooks: AppHooks) async throws {
|
||||
userID = credentials.userID
|
||||
if credentials.restorationToken.passphrase != nil {
|
||||
MXLog.info("Restoring client with encrypted store.")
|
||||
@ -36,6 +36,7 @@ final class NSEUserSession {
|
||||
.baseBuilder(setupEncryption: false,
|
||||
httpProxy: URL(string: homeserverURL)?.globalProxy,
|
||||
sessionDelegate: clientSessionDelegate,
|
||||
simplifiedSlidingSyncEnabled: simplifiedSlidingSyncEnabled,
|
||||
appHooks: appHooks)
|
||||
.sessionPath(path: credentials.restorationToken.sessionDirectory.path(percentEncoded: false))
|
||||
.username(username: credentials.userID)
|
||||
|
@ -60,7 +60,7 @@ packages:
|
||||
# Element/Matrix dependencies
|
||||
MatrixRustSDK:
|
||||
url: https://github.com/element-hq/matrix-rust-components-swift
|
||||
exactVersion: 1.0.25
|
||||
exactVersion: 1.0.26
|
||||
# path: ../matrix-rust-sdk
|
||||
Compound:
|
||||
url: https://github.com/element-hq/compound-ios
|
||||
|
Loading…
x
Reference in New Issue
Block a user