Refactoring
This commit is contained in:
parent
96fdbad7b9
commit
167a050a89
|
@ -3,15 +3,15 @@
|
|||
import Foundation
|
||||
|
||||
extension String {
|
||||
private static let colonDoubleSlash = "://"
|
||||
private static let HTTPSPrefix = "https://"
|
||||
|
||||
func url(scheme: String = "https") throws -> URL {
|
||||
func url() throws -> URL {
|
||||
let url: URL?
|
||||
|
||||
if hasPrefix(scheme + Self.colonDoubleSlash) {
|
||||
if hasPrefix(Self.HTTPSPrefix) {
|
||||
url = URL(string: self)
|
||||
} else {
|
||||
url = URL(string: scheme + Self.colonDoubleSlash + self)
|
||||
url = URL(string: Self.HTTPSPrefix + self)
|
||||
}
|
||||
|
||||
guard let validURL = url else { throw URLError(.badURL) }
|
||||
|
|
|
@ -55,6 +55,7 @@ class AddIdentityViewModel: ObservableObject {
|
|||
return
|
||||
}
|
||||
|
||||
// TODO: Ensure instance has not disabled public preview
|
||||
identitiesService.createIdentity(id: identityID, instanceURL: instanceURL)
|
||||
.map { identityID }
|
||||
.assignErrorsToAlertItem(to: \.alertItem, on: self)
|
||||
|
|
Loading…
Reference in New Issue