3486: Re-introduce separate check method to not need a synthetic accessor (lint error)

This commit is contained in:
Lakoja 2023-08-22 21:17:22 +02:00
parent ba50ff5686
commit 3a40274003
1 changed files with 10 additions and 7 deletions

View File

@ -214,18 +214,21 @@ class EditProfileActivity : BaseActivity(), Injectable {
}
val onBackCallback = object : OnBackPressedCallback(enabled = true) {
override fun handleOnBackPressed() {
if (viewModel.hasUnsavedChanges(currentProfileData)) {
showUnsavedChangesDialog()
} else {
finish()
}
}
override fun handleOnBackPressed() = checkForUnsavedChanges()
}
onBackPressedDispatcher.addCallback(this, onBackCallback)
}
fun checkForUnsavedChanges() {
if (viewModel.hasUnsavedChanges(currentProfileData)) {
showUnsavedChangesDialog()
} else {
finish()
}
}
override fun onStop() {
super.onStop()
if (!isFinishing) {