mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Replace defaultAccount by boolean hasDefaultAccount in CoreContext
This commit is contained in:
parent
0e818ee772
commit
b16372c420
4 changed files with 9 additions and 9 deletions
|
|
@ -38,7 +38,7 @@ final class CoreContext: ObservableObject {
|
|||
var coreVersion: String = Core.getVersion
|
||||
@Published var loggedIn: Bool = false
|
||||
@Published var loggingInProgress: Bool = false
|
||||
@Published var defaultAccount: Account?
|
||||
@Published var hasDefaultAccount: Bool = false
|
||||
@Published var coreIsStarted: Bool = false
|
||||
|
||||
private var mCore: Core!
|
||||
|
|
@ -113,11 +113,11 @@ final class CoreContext: ObservableObject {
|
|||
|
||||
self.mCoreSuscriptions.insert(self.mCore.publisher?.onGlobalStateChanged?.postOnMainQueue { (cbVal: (core: Core, state: GlobalState, message: String)) in
|
||||
if cbVal.state == GlobalState.On {
|
||||
self.defaultAccount = self.mCore.defaultAccount
|
||||
self.hasDefaultAccount = true
|
||||
self.coreIsStarted = true
|
||||
} else if cbVal.state == GlobalState.Off {
|
||||
self.defaultAccount = nil
|
||||
self.coreIsStarted = true
|
||||
self.hasDefaultAccount = false
|
||||
self.coreIsStarted = false
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -88,14 +88,14 @@ struct LinphoneApp: App {
|
|||
if coreContext.coreIsStarted {
|
||||
if !sharedMainViewModel.welcomeViewDisplayed {
|
||||
WelcomeView()
|
||||
} else if coreContext.defaultAccount == nil || sharedMainViewModel.displayProfileMode {
|
||||
} else if !coreContext.hasDefaultAccount || sharedMainViewModel.displayProfileMode {
|
||||
ZStack {
|
||||
AssistantView()
|
||||
|
||||
ToastView()
|
||||
.zIndex(3)
|
||||
}
|
||||
} else if coreContext.defaultAccount != nil
|
||||
} else if coreContext.hasDefaultAccount
|
||||
&& coreContext.loggedIn
|
||||
&& contactViewModel != nil
|
||||
&& editContactViewModel != nil
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class AccountLoginViewModel: ObservableObject {
|
|||
// Also set the newly added account as default
|
||||
core.defaultAccount = account
|
||||
DispatchQueue.main.async {
|
||||
self.coreContext.defaultAccount = account
|
||||
self.coreContext.hasDefaultAccount = true
|
||||
}
|
||||
|
||||
self.domain = "sip.linphone.org"
|
||||
|
|
@ -142,7 +142,7 @@ class AccountLoginViewModel: ObservableObject {
|
|||
if let account = core.defaultAccount {
|
||||
core.removeAccount(account: account)
|
||||
DispatchQueue.main.async {
|
||||
self.coreContext.defaultAccount = nil
|
||||
self.coreContext.hasDefaultAccount = false
|
||||
}
|
||||
|
||||
// To remove all accounts use
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ struct SideMenu: View {
|
|||
Log.info("$TAG Account has been removed")
|
||||
|
||||
DispatchQueue.main.async {
|
||||
coreContext.defaultAccount = nil
|
||||
coreContext.hasDefaultAccount = false
|
||||
coreContext.loggedIn = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue