mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Replace setNewPassword with updateAuthInfo in PopupUpdatePassword
This commit is contained in:
parent
37b913d692
commit
8ee693a092
2 changed files with 34 additions and 1 deletions
|
|
@ -57,6 +57,8 @@ class CoreContext: ObservableObject {
|
|||
private var callStateCallBacks: [((Call.State) -> Void)] = []
|
||||
private var configuringStateCallBacks: [((ConfiguringState) -> Void)] = []
|
||||
|
||||
var digestAuthInfoPendingPasswordUpdate: AuthInfo?
|
||||
|
||||
private init() {
|
||||
do {
|
||||
try initialiseCore()
|
||||
|
|
@ -284,6 +286,8 @@ class CoreContext: ObservableObject {
|
|||
userInfo: ["address": "sip:" + identity]
|
||||
)
|
||||
}
|
||||
|
||||
self.digestAuthInfoPendingPasswordUpdate = authInfo
|
||||
}
|
||||
}, onTransferStateChanged: { (_: Core, transferred: Call, callState: Call.State) in
|
||||
Log.info("[CoreContext] Transferred call \(transferred.remoteAddress!.asStringUriOnly()) state changed \(callState)")
|
||||
|
|
|
|||
|
|
@ -79,6 +79,9 @@ struct PopupUpdatePassword: View {
|
|||
.stroke(isPasswordFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.bottom)
|
||||
.onTapGesture {
|
||||
isPasswordFocused = true
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
isShowUpdatePasswordPopup = false
|
||||
|
|
@ -99,7 +102,7 @@ struct PopupUpdatePassword: View {
|
|||
.padding(.bottom, 10)
|
||||
|
||||
Button(action: {
|
||||
setNewPassword()
|
||||
updateAuthInfo()
|
||||
isShowUpdatePasswordPopup = false
|
||||
}, label: {
|
||||
Text("dialog_ok")
|
||||
|
|
@ -122,9 +125,11 @@ struct PopupUpdatePassword: View {
|
|||
.shadow(color: Color.orangeMain500, radius: 0, x: 0, y: 2)
|
||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||
.position(x: geometry.size.width / 2, y: geometry.size.height / 2)
|
||||
.onTapGesture {}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func setNewPassword() {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
Log.info("[SetNewPassword] ---- \(core.defaultAccount?.params?.identityAddress?.asStringUriOnly() ?? "No account found") \(passwordUpdateAddress)")
|
||||
|
|
@ -146,6 +151,30 @@ struct PopupUpdatePassword: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func updateAuthInfo() {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
Log.info("[SetNewPassword] ---- \(core.defaultAccount?.params?.identityAddress?.asStringUriOnly() ?? "No account found") \(passwordUpdateAddress)")
|
||||
|
||||
if let account = core.accountList.first { $0.params?.identityAddress?.asStringUriOnly() == passwordUpdateAddress } {
|
||||
let authInfo = CoreContext.shared.digestAuthInfoPendingPasswordUpdate
|
||||
if (authInfo != nil) {
|
||||
Log.info(
|
||||
"[SetNewPassword] Updating password for username \(authInfo!.username) using auth info \(authInfo!)"
|
||||
)
|
||||
authInfo!.password = passwordPopupText
|
||||
core.addAuthInfo(info: authInfo!)
|
||||
CoreContext.shared.digestAuthInfoPendingPasswordUpdate = nil
|
||||
core.refreshRegisters()
|
||||
} else {
|
||||
Log.warn(
|
||||
"[SetNewPassword] Failed to find auth info for account \(account.params?.identityAddress?.asStringUriOnly())"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue