ignore object replacement character (#550)
This commit is contained in:
parent
199e8adf91
commit
2a8685a420
|
@ -55,3 +55,7 @@ extension String {
|
||||||
return textSize.width
|
return textSize.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public extension CharacterSet {
|
||||||
|
static var objectReplacement: CharacterSet = .init(charactersIn: "\u{fffc}")
|
||||||
|
}
|
||||||
|
|
|
@ -46,17 +46,11 @@ final class ConnectToServerViewModel: ViewModel {
|
||||||
|
|
||||||
func connectToServer(uri: String, redirectCount: Int = 0) {
|
func connectToServer(uri: String, redirectCount: Int = 0) {
|
||||||
|
|
||||||
#if targetEnvironment(simulator)
|
let uri = uri.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
var uri = uri
|
.trimmingCharacters(in: .objectReplacement)
|
||||||
if uri == "http://localhost" || uri == "localhost" {
|
|
||||||
uri = "http://localhost:8096"
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
let trimmedURI = uri.trimmingCharacters(in: .whitespaces)
|
LogManager.log.debug("Attempting to connect to server at \"\(uri)\"", tag: "connectToServer")
|
||||||
|
SessionManager.main.connectToServer(with: uri)
|
||||||
LogManager.log.debug("Attempting to connect to server at \"\(trimmedURI)\"", tag: "connectToServer")
|
|
||||||
SessionManager.main.connectToServer(with: trimmedURI)
|
|
||||||
.trackActivity(loading)
|
.trackActivity(loading)
|
||||||
.sink(receiveCompletion: { completion in
|
.sink(receiveCompletion: { completion in
|
||||||
// This is disgusting. ViewModel Error handling overall needs to be refactored
|
// This is disgusting. ViewModel Error handling overall needs to be refactored
|
||||||
|
|
|
@ -48,6 +48,11 @@ final class UserSignInViewModel: ViewModel {
|
||||||
func signIn(username: String, password: String) {
|
func signIn(username: String, password: String) {
|
||||||
LogManager.log.debug("Attempting to login to server at \"\(server.currentURI)\"", tag: "login")
|
LogManager.log.debug("Attempting to login to server at \"\(server.currentURI)\"", tag: "login")
|
||||||
|
|
||||||
|
let username = username.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
.trimmingCharacters(in: .objectReplacement)
|
||||||
|
let password = password.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
.trimmingCharacters(in: .objectReplacement)
|
||||||
|
|
||||||
SessionManager.main.signInUser(server: server, username: username, password: password)
|
SessionManager.main.signInUser(server: server, username: username, password: password)
|
||||||
.trackActivity(loading)
|
.trackActivity(loading)
|
||||||
.sink { completion in
|
.sink { completion in
|
||||||
|
|
Loading…
Reference in New Issue