mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Improve how alias settings are handled, add unit tests (#3686)
This commit is contained in:
+11
-1
@@ -79,8 +79,18 @@ class SecurityAndPrivacyScreenViewModel: SecurityAndPrivacyScreenViewModelType,
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
let userIDServerName = clientProxy.userIDServerName
|
||||
|
||||
roomProxy.infoPublisher
|
||||
.map(\.canonicalAlias)
|
||||
.compactMap { roomInfo in
|
||||
guard let userIDServerName else {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Give priority to aliases from the current user's homeserver as remote ones
|
||||
// cannot be edited.
|
||||
return roomInfo.firstAliasMatching(serverName: userIDServerName, useFallback: true)
|
||||
}
|
||||
.removeDuplicates()
|
||||
.receive(on: DispatchQueue.main)
|
||||
.weakAssign(to: \.state.canonicalAlias, on: self)
|
||||
|
||||
Reference in New Issue
Block a user