Prevent multiple auth dialog being stacked
This commit is contained in:
parent
abc1891694
commit
ae92b030c5
2 changed files with 10 additions and 1 deletions
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
package org.linphone.activities.main
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.ComponentCallbacks2
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
|
@ -116,6 +117,7 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
|||
private val authenticationRequestedEvent: MutableLiveData<Event<AuthInfo>> by lazy {
|
||||
MutableLiveData<Event<AuthInfo>>()
|
||||
}
|
||||
private var authenticationRequiredDialog: Dialog? = null
|
||||
|
||||
private val coreListener: CoreListenerStub = object : CoreListenerStub() {
|
||||
override fun onAuthenticationRequested(core: Core, authInfo: AuthInfo, method: AuthMethod) {
|
||||
|
@ -687,6 +689,8 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
|||
private fun showAuthenticationRequestedDialog(
|
||||
authInfo: AuthInfo
|
||||
) {
|
||||
authenticationRequiredDialog?.dismiss()
|
||||
|
||||
val identity = "${authInfo.username}@${authInfo.domain}"
|
||||
Log.i("[Main Activity] Showing authentication required dialog for account [$identity]")
|
||||
|
||||
|
@ -702,6 +706,7 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
|||
|
||||
dialogViewModel.showCancelButton {
|
||||
dialog.dismiss()
|
||||
authenticationRequiredDialog = null
|
||||
}
|
||||
|
||||
dialogViewModel.showOkButton(
|
||||
|
@ -716,10 +721,12 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
|||
coreContext.core.refreshRegisters()
|
||||
|
||||
dialog.dismiss()
|
||||
authenticationRequiredDialog = null
|
||||
},
|
||||
getString(R.string.dialog_authentication_required_change_password_label)
|
||||
)
|
||||
|
||||
dialog.show()
|
||||
authenticationRequiredDialog = dialog
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,9 @@ open class ContactsSelectionViewModel : MessageNotifierViewModel() {
|
|||
it.address?.weakEqual(address) ?: false
|
||||
}
|
||||
if (found != null) {
|
||||
Log.i("[Contacts Selection] User-input is already present in search results, skipping request")
|
||||
Log.i(
|
||||
"[Contacts Selection] User-input is already present in search results, skipping request"
|
||||
)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue