forked from mirrors/linphone-iphone
Display error toast instead of spinning forever when trying to login for the first time with no network connected
This commit is contained in:
parent
321e1065ac
commit
df8f515601
2 changed files with 15 additions and 0 deletions
|
|
@ -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: "@")
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue