diff --git a/ElementX/Sources/Application/Settings/AppSettings.swift b/ElementX/Sources/Application/Settings/AppSettings.swift index a7f53da41..db8609ad4 100644 --- a/ElementX/Sources/Application/Settings/AppSettings.swift +++ b/ElementX/Sources/Application/Settings/AppSettings.swift @@ -80,6 +80,7 @@ final nonisolated class AppSettings: @unchecked Sendable { hideBrandChrome: Bool, pushGatewayBaseURL: URL, oAuthRedirectURL: URL, + oAuthClientURIPath: String?, websiteURL: URL, logoURL: URL, copyrightURL: URL, @@ -100,6 +101,7 @@ final nonisolated class AppSettings: @unchecked Sendable { self.hideBrandChrome = hideBrandChrome self.pushGatewayBaseURL = pushGatewayBaseURL self.oAuthRedirectURL = oAuthRedirectURL + self.oAuthClientURIPath = oAuthClientURIPath self.websiteURL = websiteURL self.logoURL = logoURL self.copyrightURL = copyrightURL @@ -198,11 +200,15 @@ final nonisolated class AppSettings: @unchecked Sendable { /// The redirect URL used for OAuth. For the normal case we don't actually need the bundle ID as the web authentication session handles the redirect internally. /// However in the case where MAS sends the user to an external app, we need to make sure that the system will open the correct variant of the app (e.g. Nightly). private(set) nonisolated(unsafe) var oAuthRedirectURL: URL! = URL(string: "https://element.io/oauth/ios/\(InfoPlistReader.main.bundleIdentifier)") + /// A path that is appended to `websiteURL` to form the OAuth `clientURI`. MAS uses `clientURI` as the identifier for a specific app, allowing us to + /// distinguish the various clients we have for Android, iOS and Web from each other. + /// Intentionally a distinct property so it can be easily overridden without having to manipulate the website URL. + private(set) var oAuthClientURIPath: String? // = "app/ios" var oAuthConfiguration: OAuthConfiguration { OAuthConfiguration(clientName: InfoPlistReader.main.bundleDisplayName, redirectURI: oAuthRedirectURL, - clientURI: websiteURL, + clientURI: oAuthClientURIPath.map { websiteURL.appending(path: $0) } ?? websiteURL, logoURI: logoURL, tosURI: acceptableUseURL, policyURI: privacyURL, diff --git a/ElementX/Sources/UITests/UITestsAppCoordinator.swift b/ElementX/Sources/UITests/UITestsAppCoordinator.swift index 034e0424f..1807329e7 100644 --- a/ElementX/Sources/UITests/UITestsAppCoordinator.swift +++ b/ElementX/Sources/UITests/UITestsAppCoordinator.swift @@ -155,6 +155,7 @@ class MockScreen: Identifiable { hideBrandChrome: false, pushGatewayBaseURL: appSettings.pushGatewayBaseURL, oAuthRedirectURL: appSettings.oAuthRedirectURL, + oAuthClientURIPath: appSettings.oAuthClientURIPath, websiteURL: appSettings.websiteURL, logoURL: appSettings.logoURL, copyrightURL: appSettings.copyrightURL, diff --git a/Enterprise b/Enterprise index 4bf143f56..9c0ac45da 160000 --- a/Enterprise +++ b/Enterprise @@ -1 +1 @@ -Subproject commit 4bf143f569ac2ec1b5b1b0772692fc18381a0387 +Subproject commit 9c0ac45dac889d6041582ba4aa2d6f414ba8286f diff --git a/Package.resolved b/Package.resolved index 555e4e82d..f4733dcc5 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/pkl-swift", "state" : { - "revision" : "40e5decb9481c8c5d8c64389255166023c936900", - "version" : "0.8.2" + "revision" : "00f4b15c0941e137bf90de712b6fb643c9f0880a", + "version" : "0.10.0" } }, { diff --git a/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift b/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift index b03c89eeb..732d3f1d1 100644 --- a/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift +++ b/UnitTests/Sources/AuthenticationStartScreenViewModelTests.swift @@ -336,6 +336,7 @@ final class AuthenticationStartScreenViewModelTests { hideBrandChrome: false, pushGatewayBaseURL: appSettings.pushGatewayBaseURL, oAuthRedirectURL: appSettings.oAuthRedirectURL, + oAuthClientURIPath: appSettings.oAuthClientURIPath, websiteURL: appSettings.websiteURL, logoURL: appSettings.logoURL, copyrightURL: appSettings.copyrightURL, diff --git a/UnitTests/Sources/ServerConfirmationScreenViewModelTests.swift b/UnitTests/Sources/ServerConfirmationScreenViewModelTests.swift index dbb76c609..d3a798872 100644 --- a/UnitTests/Sources/ServerConfirmationScreenViewModelTests.swift +++ b/UnitTests/Sources/ServerConfirmationScreenViewModelTests.swift @@ -325,6 +325,7 @@ final class ServerConfirmationScreenViewModelTests { hideBrandChrome: false, pushGatewayBaseURL: appSettings.pushGatewayBaseURL, oAuthRedirectURL: appSettings.oAuthRedirectURL, + oAuthClientURIPath: appSettings.oAuthClientURIPath, websiteURL: appSettings.websiteURL, logoURL: appSettings.logoURL, copyrightURL: appSettings.copyrightURL,