From 3a402740031fbde683cc5dccb1fcc6d21c70fec5 Mon Sep 17 00:00:00 2001 From: Lakoja Date: Tue, 22 Aug 2023 21:17:22 +0200 Subject: [PATCH] 3486: Re-introduce separate check method to not need a synthetic accessor (lint error) --- .../keylesspalace/tusky/EditProfileActivity.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt b/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt index ea55bd810..a24ccc10a 100644 --- a/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt @@ -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) {