diff --git a/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift b/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift index 8172c9bfb..7b0e9a1e3 100644 --- a/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift +++ b/Linphone/UI/Assistant/Viewmodel/AccountLoginViewModel.swift @@ -34,6 +34,14 @@ class AccountLoginViewModel: ObservableObject { func login() { coreContext.doOnCoreQueue { core in + guard self.coreContext.networkStatusIsConnected else { + DispatchQueue.main.async { + self.coreContext.loggingInProgress = false + ToastViewModel.shared.toastMessage = "Registration_failed_no_network" + ToastViewModel.shared.displayToast = true + } + return + } do { let usernameWithDomain = self.username.split(separator: "@") diff --git a/Linphone/UI/Main/Fragments/ToastView.swift b/Linphone/UI/Main/Fragments/ToastView.swift index 7ef3d9d63..24a0c551b 100644 --- a/Linphone/UI/Main/Fragments/ToastView.swift +++ b/Linphone/UI/Main/Fragments/ToastView.swift @@ -129,6 +129,13 @@ struct ToastView: View { .default_text_style(styleSize: 15) .padding(8) + case "Registration_failed_no_network": + Text("Could not reach network") + .multilineTextAlignment(.center) + .foregroundStyle(Color.redDanger500) + .default_text_style(styleSize: 15) + .padding(8) + case "Success_account_logged_out": Text("Account successfully logged out") .multilineTextAlignment(.center)