mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Show an alert when entering an account provider that requires Element Pro. (#4326)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright 2025 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
extension ClientProtocol {
|
||||
func elementWellKnown() async -> Result<Data, ClientProxyError> {
|
||||
let serverNameURLString = if let userIDServerName = try? userIdServerName() {
|
||||
"https://\(userIDServerName)"
|
||||
} else {
|
||||
server() ?? homeserver()
|
||||
}
|
||||
|
||||
do {
|
||||
guard let url = URL(string: serverNameURLString)?.appending(path: "/.well-known/element/element.json") else {
|
||||
return .failure(.invalidServerName)
|
||||
}
|
||||
|
||||
let response = try await getUrl(url: url.absoluteString)
|
||||
|
||||
guard let data = response.data(using: .utf8) else {
|
||||
return .failure(.invalidResponse)
|
||||
}
|
||||
|
||||
return .success(data)
|
||||
} catch {
|
||||
return .failure(.sdkError(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ enum ClientProxyError: Error {
|
||||
|
||||
case invalidMedia
|
||||
case invalidServerName
|
||||
case invalidResponse
|
||||
case failedUploadingMedia(ErrorKind)
|
||||
case roomPreviewIsPrivate
|
||||
case failedRetrievingUserIdentity
|
||||
|
||||
Reference in New Issue
Block a user