mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Fix provisioning click URI handler
This commit is contained in:
parent
49736388cf
commit
90231749c4
4 changed files with 20 additions and 13 deletions
|
|
@ -255,16 +255,12 @@ final class CoreContext: ObservableObject {
|
|||
}
|
||||
}, onConfiguringStatus: { (_: Core, status: ConfiguringState, message: String) in
|
||||
Log.info("New configuration state is \(status) = \(message)\n")
|
||||
var accountModels: [AccountModel] = []
|
||||
for account in self.mCore.accountList {
|
||||
accountModels.append(AccountModel(account: account, core: self.mCore))
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
if status == ConfiguringState.Successful {
|
||||
/*
|
||||
ToastViewModel.shared.toastMessage = "Success_qr_code_validated"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
*/
|
||||
var accountModels: [AccountModel] = []
|
||||
for account in self.mCore.accountList {
|
||||
accountModels.append(AccountModel(account: account, core: self.mCore))
|
||||
}
|
||||
self.accounts = accountModels
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,6 +158,9 @@ struct LinphoneApp: App {
|
|||
ToastView()
|
||||
.zIndex(3)
|
||||
}
|
||||
.onOpenURL { url in
|
||||
URIHandler.handleURL(url: url)
|
||||
}
|
||||
} else if coreContext.accounts.isEmpty || sharedMainViewModel.displayProfileMode {
|
||||
ZStack {
|
||||
AssistantView()
|
||||
|
|
@ -165,6 +168,9 @@ struct LinphoneApp: App {
|
|||
ToastView()
|
||||
.zIndex(3)
|
||||
}
|
||||
.onOpenURL { url in
|
||||
URIHandler.handleURL(url: url)
|
||||
}
|
||||
} else if !coreContext.accounts.isEmpty
|
||||
&& contactViewModel != nil
|
||||
&& editContactViewModel != nil
|
||||
|
|
@ -236,8 +242,6 @@ struct LinphoneApp: App {
|
|||
meetingViewModel = MeetingViewModel()
|
||||
conversationForwardMessageViewModel = ConversationForwardMessageViewModel()
|
||||
accountProfileViewModel = AccountProfileViewModel()
|
||||
}.onOpenURL { url in
|
||||
URIHandler.handleURL(url: url)
|
||||
}
|
||||
}
|
||||
}.onChange(of: scenePhase) { newPhase in
|
||||
|
|
|
|||
|
|
@ -76,6 +76,8 @@ class Coordinator: NSObject, AVCaptureMetadataOutputObjectsDelegate {
|
|||
core.stop()
|
||||
try? core.start()
|
||||
}
|
||||
ToastViewModel.shared.toastMessage = "Success_qr_code_validated"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
} else {
|
||||
ToastViewModel.shared.toastMessage = "Invalide URI"
|
||||
ToastViewModel.shared.displayToast.toggle()
|
||||
|
|
|
|||
|
|
@ -90,12 +90,17 @@ class URIHandler {
|
|||
|
||||
private static func initiateConfiguration(url: URL) {
|
||||
if autoRemoteProvisioningOnConfigUriHandler() {
|
||||
CoreContext.shared.performActionOnCoreQueueWhenCoreIsStarted { core in
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
Log.info("[URIHandler] provisioning app with URI: \(url.resourceSpecifier)")
|
||||
do {
|
||||
addCoreDelegate()
|
||||
core.config?.setString(section: "misc", key: "config-uri", value: url.resourceSpecifier)
|
||||
try core.setProvisioninguri(newValue: url.resourceSpecifier)
|
||||
var urlString = url.resourceSpecifier
|
||||
if urlString.starts(with: "//") {
|
||||
urlString = String(urlString.dropFirst(2))
|
||||
}
|
||||
|
||||
core.config?.setString(section: "misc", key: "config-uri", value: urlString)
|
||||
try core.setProvisioninguri(newValue: urlString)
|
||||
core.stop()
|
||||
try core.start()
|
||||
} catch {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue