From 6bb74b028d48df0c0fceae203f1edcb6c993e575 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Mon, 1 Jul 2024 14:29:26 +0200 Subject: [PATCH] Can use username with domain in login view --- .../UI/Assistant/Viewmodel/AccountLoginViewModel.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift b/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift index b4d8229e5..8172c9bfb 100644 --- a/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift +++ b/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift @@ -35,6 +35,14 @@ class AccountLoginViewModel: ObservableObject { func login() { coreContext.doOnCoreQueue { core in do { + let usernameWithDomain = self.username.split(separator: "@") + + if usernameWithDomain.count > 1 { + DispatchQueue.main.async { + self.domain = String(usernameWithDomain.last ?? "") + self.username = String(usernameWithDomain.first ?? "") + } + } if self.domain != "sip.linphone.org" { if let assistantLinphone = Bundle.main.path(forResource: "assistant_third_party_default_values", ofType: nil) {