From 3d392fd99e8310f39428b47ff7d26860f2c58754 Mon Sep 17 00:00:00 2001 From: Lumaa Date: Tue, 16 Jul 2024 16:13:55 +0200 Subject: [PATCH] full handle login --- Threaded/Views/AddInstanceView.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Threaded/Views/AddInstanceView.swift b/Threaded/Views/AddInstanceView.swift index b54725a..7417fbd 100644 --- a/Threaded/Views/AddInstanceView.swift +++ b/Threaded/Views/AddInstanceView.swift @@ -209,9 +209,14 @@ struct AddInstanceView: View { } private func signIn() async { - let cleanInstance = instanceUrl - .replacingOccurrences(of: "http://", with: "") - .replacingOccurrences(of: "https://", with: "") + var cleanInstance = self.instanceUrl + if instanceUrl.contains("@") { + cleanInstance = String(instanceUrl.split(separator: "@")[1]) // instance + } else { + cleanInstance = instanceUrl + .replacingOccurrences(of: "http://", with: "") + .replacingOccurrences(of: "https://", with: "") + } signInClient = .init(server: cleanInstance) if let oauthURL = try? await signInClient?.oauthURL(),