Use server name from user id function (#6082)

update sdk and use the new server from user id function from the sdk
This commit is contained in:
Mauro
2026-08-27 16:28:40 +02:00
committed by GitHub
parent efefd549a2
commit 9f7e30820b
8 changed files with 31 additions and 18 deletions
@@ -7,6 +7,7 @@
//
import Combine
import MatrixRustSDK
import SwiftUI
typealias LoginScreenViewModelType = StateStoreViewModelV2<LoginScreenViewState, LoginScreenViewAction>
@@ -66,9 +67,7 @@ class LoginScreenViewModel: LoginScreenViewModelType, LoginScreenViewModelProtoc
private func parseUsername() {
let username = state.bindings.username
guard MatrixEntityRegex.isMatrixUserIdentifier(username) else { return }
let homeserverDomain = String(username.split(separator: ":")[1])
guard let homeserverDomain = try? serverNameFromUserId(userId: username) else { return }
startLoading(isInteractionBlocking: false)
@@ -7,6 +7,7 @@
//
import Combine
import MatrixRustSDK
import SwiftUI
typealias ServerSelectionScreenViewModelType = StateStoreViewModelV2<ServerSelectionScreenViewState, ServerSelectionScreenViewAction>
@@ -101,7 +102,9 @@ class ServerSelectionScreenViewModel: ServerSelectionScreenViewModelType, Server
/// Updates the login flow using the supplied homeserver address, or shows an error when this isn't possible.
private func configureHomeserver() async {
let homeserverAddress = state.bindings.homeserverAddress
let userInput = state.bindings.homeserverAddress
// People often enter their Matrix ID here, so use the server name from it when they do.
let homeserverAddress = (try? serverNameFromUserId(userId: userInput)) ?? userInput
startLoading()
switch await authenticationService.configure(for: homeserverAddress, flow: authenticationFlow) {