Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native Sliding Sync Discovery #3211

Merged
merged 5 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@
89B909AC66B96FA054EF3C14 /* InvitedRoomProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E95B3BDB80531C85CD50AE6 /* InvitedRoomProxy.swift */; };
8A0BD60CA4A6004DB06B5403 /* MediaUploadingPreprocessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669F35C505ACE1110589F875 /* MediaUploadingPreprocessor.swift */; };
8A5064CAC8E5F3B18645621D /* CallNotificationRoomTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD6E082B0507FB28F966516A /* CallNotificationRoomTimelineView.swift */; };
8A6CB15C8FC68F557750BF54 /* AuthenticationClientBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F569CFB77E0D40BD82203D9 /* AuthenticationClientBuilder.swift */; };
8A83D715940378B9BA9F739E /* RoomInviterLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EB58E4E8D6D634C246AD5C2 /* RoomInviterLabel.swift */; };
8AA84EF202F2EFC8453A97BD /* SecureBackupRecoveryKeyScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 645E027C112740573D27765C /* SecureBackupRecoveryKeyScreenModels.swift */; };
8AB8ED1051216546CB35FA0E /* UserSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E5E9C044BEB7C70B1378E91 /* UserSession.swift */; };
Expand Down Expand Up @@ -1248,6 +1249,7 @@
0E95B3BDB80531C85CD50AE6 /* InvitedRoomProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitedRoomProxy.swift; sourceTree = "<group>"; };
0EE9EAF0309A2A1D67D8FAF5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = sv; path = sv.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
0F5567A7EF6F2AB9473236F6 /* DocumentPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentPicker.swift; sourceTree = "<group>"; };
0F569CFB77E0D40BD82203D9 /* AuthenticationClientBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationClientBuilder.swift; sourceTree = "<group>"; };
0F64447FF544298A6A3BEF85 /* NotificationSettingsScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationSettingsScreenModels.swift; sourceTree = "<group>"; };
0FA60F848D1C14F873F9621A /* RoomMemberDetailsScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMemberDetailsScreenCoordinator.swift; sourceTree = "<group>"; };
105429F29096729EDD3152CF /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/SAS.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4586,6 +4588,7 @@
AAFDD509929A0CCF8BCE51EB /* Authentication */ = {
isa = PBXGroup;
children = (
0F569CFB77E0D40BD82203D9 /* AuthenticationClientBuilder.swift */,
F3A1AB5A84D843B6AC8D5F1E /* AuthenticationService.swift */,
5E75948AA1FE1D1A7809931F /* AuthenticationServiceProtocol.swift */,
65C2B80DD0BF6F10BB5FA922 /* MockAuthenticationServiceProxy.swift */,
Expand Down Expand Up @@ -6181,6 +6184,7 @@
88F348E2CB14FF71CBBB665D /* AudioRoomTimelineItemContent.swift in Sources */,
7BD2123144A32F082CECC108 /* AudioRoomTimelineView.swift in Sources */,
9278EC51D24E57445B290521 /* AudioSessionProtocol.swift in Sources */,
8A6CB15C8FC68F557750BF54 /* AuthenticationClientBuilder.swift in Sources */,
67E9926C4572C54F59FCA91A /* AuthenticationFlowCoordinator.swift in Sources */,
9847B056C1A216C314D21E68 /* AuthenticationService.swift in Sources */,
56DACDD379A86A1F5DEFE7BE /* AuthenticationServiceProtocol.swift in Sources */,
Expand Down Expand Up @@ -7679,7 +7683,7 @@
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
requirement = {
kind = exactVersion;
version = 1.0.42;
version = 1.0.43;
};
};
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
"state" : {
"revision" : "ccae0615642728bbadcd051e4851d96ab298bab2",
"version" : "1.0.42"
"revision" : "4acde0099d719f9f176d0df3594efd3e34ffa431",
"version" : "1.0.43"
}
},
{
Expand Down
15 changes: 5 additions & 10 deletions ElementX/Sources/Application/AppSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ final class AppSettings {
case elementCallEncryptionEnabled

// Feature flags
case simplifiedSlidingSyncEnabled
case slidingSyncDiscovery
case publicSearchEnabled
case fuzzyRoomListSearchEnabled
case pinningEnabled
Expand Down Expand Up @@ -106,10 +106,6 @@ final class AppSettings {
/// so that it can be passed to Rust as a ServerName for well-known discovery.
private(set) var defaultHomeserverAddress = "matrix.org"

/// An override of the homeserver's Sliding Sync proxy URL. This allows development against servers
/// that don't yet have an officially trusted proxy configured in their well-known.
let slidingSyncProxyURL: URL? = nil

/// The task identifier used for background app refresh. Also used in main target's the Info.plist
let backgroundAppRefreshTaskIdentifier = "io.element.elementx.background.refresh"

Expand Down Expand Up @@ -284,16 +280,15 @@ final class AppSettings {

@UserPreference(key: UserDefaultsKeys.pinningEnabled, defaultValue: false, storageType: .userDefaults(store))
var pinningEnabled

enum SlidingSyncDiscovery: Codable { case proxy, native, forceNative }
@UserPreference(key: UserDefaultsKeys.slidingSyncDiscovery, defaultValue: .native, storageType: .userDefaults(store))
var slidingSyncDiscovery: SlidingSyncDiscovery

#endif

// MARK: - Shared

@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
}
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
}

private func presentDeveloperOptions() {
let coordinator = DeveloperOptionsScreenCoordinator()
let coordinator = DeveloperOptionsScreenCoordinator(isUsingNativeSlidingSync: parameters.userSession.clientProxy.slidingSyncVersion == .native)

coordinator.actions
.sink { [weak self] action in
Expand All @@ -241,8 +241,6 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
switch action {
case .clearCache:
actionsSubject.send(.clearCache)
case .forceLogout:
actionsSubject.send(.forceLogout)
}
}
.store(in: &cancellables)
Expand Down
36 changes: 29 additions & 7 deletions ElementX/Sources/Mocks/Generated/GeneratedMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1925,6 +1925,28 @@ class ClientProxyMock: ClientProxyProtocol {
set(value) { underlyingHomeserver = value }
}
var underlyingHomeserver: String!
var slidingSyncVersion: SlidingSyncVersion {
get { return underlyingSlidingSyncVersion }
set(value) { underlyingSlidingSyncVersion = value }
}
var underlyingSlidingSyncVersion: SlidingSyncVersion!
var availableSlidingSyncVersionsCallsCount = 0
var availableSlidingSyncVersionsCalled: Bool {
return availableSlidingSyncVersionsCallsCount > 0
}

var availableSlidingSyncVersions: [SlidingSyncVersion] {
get async {
availableSlidingSyncVersionsCallsCount += 1
if let availableSlidingSyncVersionsClosure = availableSlidingSyncVersionsClosure {
return await availableSlidingSyncVersionsClosure()
} else {
return underlyingAvailableSlidingSyncVersions
}
}
}
var underlyingAvailableSlidingSyncVersions: [SlidingSyncVersion]!
var availableSlidingSyncVersionsClosure: (() async -> [SlidingSyncVersion])?
var userIDServerName: String?
var userDisplayNamePublisher: CurrentValuePublisher<String?, Never> {
get { return underlyingUserDisplayNamePublisher }
Expand Down Expand Up @@ -13832,8 +13854,8 @@ class TimelineProxyMock: TimelineProxyProtocol {
var toggleReactionToCalled: Bool {
return toggleReactionToCallsCount > 0
}
var toggleReactionToReceivedArguments: (reaction: String, eventID: String)?
var toggleReactionToReceivedInvocations: [(reaction: String, eventID: String)] = []
var toggleReactionToReceivedArguments: (reaction: String, itemID: TimelineItemIdentifier)?
var toggleReactionToReceivedInvocations: [(reaction: String, itemID: TimelineItemIdentifier)] = []

var toggleReactionToUnderlyingReturnValue: Result<Void, TimelineProxyError>!
var toggleReactionToReturnValue: Result<Void, TimelineProxyError>! {
Expand All @@ -13859,16 +13881,16 @@ class TimelineProxyMock: TimelineProxyProtocol {
}
}
}
var toggleReactionToClosure: ((String, String) async -> Result<Void, TimelineProxyError>)?
var toggleReactionToClosure: ((String, TimelineItemIdentifier) async -> Result<Void, TimelineProxyError>)?

func toggleReaction(_ reaction: String, to eventID: String) async -> Result<Void, TimelineProxyError> {
func toggleReaction(_ reaction: String, to itemID: TimelineItemIdentifier) async -> Result<Void, TimelineProxyError> {
toggleReactionToCallsCount += 1
toggleReactionToReceivedArguments = (reaction: reaction, eventID: eventID)
toggleReactionToReceivedArguments = (reaction: reaction, itemID: itemID)
DispatchQueue.main.async {
self.toggleReactionToReceivedInvocations.append((reaction: reaction, eventID: eventID))
self.toggleReactionToReceivedInvocations.append((reaction: reaction, itemID: itemID))
}
if let toggleReactionToClosure = toggleReactionToClosure {
return await toggleReactionToClosure(reaction, eventID)
return await toggleReactionToClosure(reaction, itemID)
} else {
return toggleReactionToReturnValue
}
Expand Down
Loading
Loading