3486: Re-introduce separate check method to not need a synthetic accessor (lint error)
This commit is contained in:
parent
ba50ff5686
commit
3a40274003
|
@ -214,18 +214,21 @@ class EditProfileActivity : BaseActivity(), Injectable {
|
||||||
}
|
}
|
||||||
|
|
||||||
val onBackCallback = object : OnBackPressedCallback(enabled = true) {
|
val onBackCallback = object : OnBackPressedCallback(enabled = true) {
|
||||||
override fun handleOnBackPressed() {
|
override fun handleOnBackPressed() = checkForUnsavedChanges()
|
||||||
if (viewModel.hasUnsavedChanges(currentProfileData)) {
|
|
||||||
showUnsavedChangesDialog()
|
|
||||||
} else {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onBackPressedDispatcher.addCallback(this, onBackCallback)
|
onBackPressedDispatcher.addCallback(this, onBackCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun checkForUnsavedChanges() {
|
||||||
|
if (viewModel.hasUnsavedChanges(currentProfileData)) {
|
||||||
|
showUnsavedChangesDialog()
|
||||||
|
} else {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
super.onStop()
|
super.onStop()
|
||||||
if (!isFinishing) {
|
if (!isFinishing) {
|
||||||
|
|
Loading…
Reference in New Issue