Automatic discovery of the sliding sync proxy. (#535)

* Automatic discovery of the sliding sync proxy.

* Handle homeserver detection from a MXID.

* Update sliding sync info link, SDK and bump patch.

Add a migration on the new version. The change in restoration token format requires the user to sign in again, but this will fail with the existing device ID.
This commit is contained in:
Doug
2023-02-08 19:07:02 +00:00
committed by GitHub
parent f7fbdcc32c
commit 4d87701ae9
22 changed files with 115 additions and 44 deletions
@@ -136,9 +136,10 @@ class AppCoordinator: AppCoordinatorProtocol {
private func performMigrationsIfNecessary(from oldVersion: Version, to newVersion: Version) {
guard oldVersion != newVersion else { return }
if oldVersion < Version(1, 0, 17) {
// Version 1.0.17 hardcoded a new sliding sync proxy for matrix.org
// Force a sign out for the user to log in with the new proxy.
if oldVersion < Version(1, 0, 20) {
// Version 1.0.20 introduced a new format for restoration tokens.
// Remove user data to prevent conflict in the crypto store
// with the newly generated device ID when signing in again.
MXLog.warning("Clearing user data for hardcoded proxy.")
wipeUserData()
}
@@ -24,7 +24,6 @@ final class AppSettings: ObservableObject {
case timelineStyle
case enableAnalytics
case isIdentifiedForAnalytics
case slidingSyncProxyBaseURLString
case enableInAppNotifications
case pusherProfileTag
}
@@ -62,7 +61,12 @@ final class AppSettings: ObservableObject {
/// 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(staticString: "https://slidingsync.lab.matrix.org")
let slidingSyncProxyURL: URL? = nil
// MARK: - Authentication
/// The URL that is opened when tapping the Learn more button on the sliding sync alert during authentication.
let slidingSyncLearnMoreURL = URL(staticString: "https://github.com/matrix-org/sliding-sync/blob/main/docs/Landing.md")
// MARK: - Notifications