From e76b2d7c61e190cc73844f348367743e2acd89e1 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 28 Sep 2022 14:43:00 +0200 Subject: [PATCH] Suppress deprecation warning for `onBackPressed()`. The required change are too big, this will be handled separately. --- .../im/vector/app/core/platform/SimpleFragmentActivity.kt | 1 + .../java/im/vector/app/core/platform/VectorBaseActivity.kt | 1 + .../java/im/vector/app/features/call/VectorCallActivity.kt | 2 ++ .../app/features/createdirect/CreateDirectRoomActivity.kt | 1 + .../crypto/keysbackup/restore/KeysBackupRestoreActivity.kt | 1 + .../crypto/keysbackup/settings/KeysBackupManageActivity.kt | 1 + .../crypto/keysbackup/setup/KeysBackupSetupActivity.kt | 1 + .../main/java/im/vector/app/features/home/HomeActivity.kt | 5 ++++- .../app/features/home/room/detail/RoomDetailActivity.kt | 1 + .../vector/app/features/invite/InviteUsersToRoomActivity.kt | 1 + .../im/vector/app/features/login/AbstractLoginFragment.kt | 2 ++ .../main/java/im/vector/app/features/login/LoginActivity.kt | 5 ++++- .../app/features/media/VectorAttachmentViewerActivity.kt | 1 + .../im/vector/app/features/onboarding/OnboardingActivity.kt | 5 ++++- .../features/onboarding/ftueauth/AbstractFtueAuthFragment.kt | 2 ++ .../im/vector/app/features/rageshake/BugReportActivity.kt | 1 + .../features/roomdirectory/createroom/CreateRoomFragment.kt | 5 ++++- .../features/roomprofile/settings/RoomSettingsFragment.kt | 1 + .../app/features/spaces/manage/SpaceSettingsFragment.kt | 1 + .../java/im/vector/app/features/usercode/UserCodeActivity.kt | 5 ++++- .../im/vector/app/features/webview/VectorWebViewActivity.kt | 1 + 21 files changed, 39 insertions(+), 5 deletions(-) diff --git a/vector/src/main/java/im/vector/app/core/platform/SimpleFragmentActivity.kt b/vector/src/main/java/im/vector/app/core/platform/SimpleFragmentActivity.kt index 4cd7da2a4f..794d5c7886 100644 --- a/vector/src/main/java/im/vector/app/core/platform/SimpleFragmentActivity.kt +++ b/vector/src/main/java/im/vector/app/core/platform/SimpleFragmentActivity.kt @@ -83,6 +83,7 @@ abstract class SimpleFragmentActivity : VectorBaseActivity() { // ignore return } + @Suppress("DEPRECATION") super.onBackPressed() } } diff --git a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt index 0b8d6698d2..7e61958565 100644 --- a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt +++ b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt @@ -505,6 +505,7 @@ abstract class VectorBaseActivity : AppCompatActivity(), Maver private fun onBackPressed(fromToolbar: Boolean) { val handled = recursivelyDispatchOnBackPressed(supportFragmentManager, fromToolbar) if (!handled) { + @Suppress("DEPRECATION") super.onBackPressed() } } diff --git a/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt b/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt index 7e226304c1..a96097a830 100644 --- a/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt +++ b/vector/src/main/java/im/vector/app/features/call/VectorCallActivity.kt @@ -194,6 +194,7 @@ class VectorCallActivity : override fun onBackPressed() { if (!enterPictureInPictureIfRequired()) { + @Suppress("DEPRECATION") super.onBackPressed() } } @@ -231,6 +232,7 @@ class VectorCallActivity : } android.R.id.home -> { // We check here as we want PiP in some cases + @Suppress("DEPRECATION") onBackPressed() true } diff --git a/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomActivity.kt b/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomActivity.kt index 707b78d328..fd28235a51 100644 --- a/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomActivity.kt +++ b/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomActivity.kt @@ -78,6 +78,7 @@ class CreateDirectRoomActivity : SimpleFragmentActivity() { sharedActionViewModel .stream() .onEach { action -> + @Suppress("DEPRECATION") when (action) { UserListSharedAction.Close -> finish() UserListSharedAction.GoBack -> onBackPressed() diff --git a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreActivity.kt b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreActivity.kt index c6e86f6f6b..f7964cf0ed 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreActivity.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreActivity.kt @@ -52,6 +52,7 @@ class KeysBackupRestoreActivity : SimpleFragmentActivity() { override fun onBackPressed() { hideWaitingView() + @Suppress("DEPRECATION") super.onBackPressed() } diff --git a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupManageActivity.kt b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupManageActivity.kt index aabd05d913..32826d013f 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupManageActivity.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/settings/KeysBackupManageActivity.kt @@ -114,6 +114,7 @@ class KeysBackupManageActivity : SimpleFragmentActivity() { finish() return } + @Suppress("DEPRECATION") super.onBackPressed() } } diff --git a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/setup/KeysBackupSetupActivity.kt b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/setup/KeysBackupSetupActivity.kt index 077bcc2cf3..8238da8245 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/setup/KeysBackupSetupActivity.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/setup/KeysBackupSetupActivity.kt @@ -183,6 +183,7 @@ class KeysBackupSetupActivity : SimpleFragmentActivity() { } .show() } else { + @Suppress("DEPRECATION") super.onBackPressed() } } diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt index 689d141023..18c9e7e3b9 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt @@ -668,7 +668,10 @@ class HomeActivity : if (views.drawerLayout.isDrawerOpen(GravityCompat.START)) { views.drawerLayout.closeDrawer(GravityCompat.START) } else { - validateBackPressed { super.onBackPressed() } + validateBackPressed { + @Suppress("DEPRECATION") + super.onBackPressed() + } } } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailActivity.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailActivity.kt index 6b66d0ec47..ecbea133df 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailActivity.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailActivity.kt @@ -178,6 +178,7 @@ class RoomDetailActivity : if (views.drawerLayout.isDrawerOpen(GravityCompat.START)) { views.drawerLayout.closeDrawer(GravityCompat.START) } else { + @Suppress("DEPRECATION") super.onBackPressed() } } diff --git a/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomActivity.kt b/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomActivity.kt index 883c879e90..86f061849b 100644 --- a/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomActivity.kt +++ b/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomActivity.kt @@ -68,6 +68,7 @@ class InviteUsersToRoomActivity : SimpleFragmentActivity() { sharedActionViewModel .stream() .onEach { sharedAction -> + @Suppress("DEPRECATION") when (sharedAction) { UserListSharedAction.Close -> finish() UserListSharedAction.GoBack -> onBackPressed() diff --git a/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt b/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt index 9512a518e8..6ee276342c 100644 --- a/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt +++ b/vector/src/main/java/im/vector/app/features/login/AbstractLoginFragment.kt @@ -133,6 +133,7 @@ abstract class AbstractLoginFragment : VectorBaseFragment( .setMessage(R.string.login_signup_cancel_confirmation_content) .setPositiveButton(R.string.yes) { _, _ -> displayCancelDialog = false + @Suppress("DEPRECATION") vectorBaseActivity.onBackPressed() } .setNegativeButton(R.string.no, null) @@ -147,6 +148,7 @@ abstract class AbstractLoginFragment : VectorBaseFragment( .setMessage(R.string.login_reset_password_cancel_confirmation_content) .setPositiveButton(R.string.yes) { _, _ -> displayCancelDialog = false + @Suppress("DEPRECATION") vectorBaseActivity.onBackPressed() } .setNegativeButton(R.string.no, null) diff --git a/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt b/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt index 90917dfecb..4e4df5d1aa 100644 --- a/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt +++ b/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt @@ -317,7 +317,10 @@ open class LoginActivity : VectorBaseActivity(), UnlockedA } override fun onBackPressed() { - validateBackPressed { super.onBackPressed() } + validateBackPressed { + @Suppress("DEPRECATION") + super.onBackPressed() + } } private fun onRegistrationStageNotSupported() { diff --git a/vector/src/main/java/im/vector/app/features/media/VectorAttachmentViewerActivity.kt b/vector/src/main/java/im/vector/app/features/media/VectorAttachmentViewerActivity.kt index 6177fb5857..d523d99d76 100644 --- a/vector/src/main/java/im/vector/app/features/media/VectorAttachmentViewerActivity.kt +++ b/vector/src/main/java/im/vector/app/features/media/VectorAttachmentViewerActivity.kt @@ -175,6 +175,7 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), AttachmentInt transitionImageContainer.isVisible = true } isAnimatingOut = true + @Suppress("DEPRECATION") super.onBackPressed() } diff --git a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingActivity.kt b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingActivity.kt index 060472a2da..e79250d39d 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingActivity.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingActivity.kt @@ -48,7 +48,10 @@ class OnboardingActivity : VectorBaseActivity(), UnlockedA } override fun onBackPressed() { - validateBackPressed { super.onBackPressed() } + validateBackPressed { + @Suppress("DEPRECATION") + super.onBackPressed() + } } override fun initUiAndData() { diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/AbstractFtueAuthFragment.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/AbstractFtueAuthFragment.kt index f3cb326221..9fd0bd08ed 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/AbstractFtueAuthFragment.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/AbstractFtueAuthFragment.kt @@ -123,6 +123,7 @@ abstract class AbstractFtueAuthFragment : VectorBaseFragment displayCancelDialog = false + @Suppress("DEPRECATION") vectorBaseActivity.onBackPressed() } .setNegativeButton(R.string.no, null) @@ -137,6 +138,7 @@ abstract class AbstractFtueAuthFragment : VectorBaseFragment displayCancelDialog = false + @Suppress("DEPRECATION") vectorBaseActivity.onBackPressed() } .setNegativeButton(R.string.no, null) diff --git a/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt b/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt index b19a98b3ce..78d3347cbe 100755 --- a/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt +++ b/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt @@ -267,6 +267,7 @@ class BugReportActivity : // Ensure there is no crash status remaining, which will be sent later on by mistake bugReporter.deleteCrashFile() + @Suppress("DEPRECATION") super.onBackPressed() } diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomFragment.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomFragment.kt index f4c3e515c5..59657aae35 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomFragment.kt @@ -100,7 +100,10 @@ class CreateRoomFragment : .allowBack(useCross = true) viewModel.observeViewEvents { when (it) { - CreateRoomViewEvents.Quit -> vectorBaseActivity.onBackPressed() + CreateRoomViewEvents.Quit -> { + @Suppress("DEPRECATION") + vectorBaseActivity.onBackPressed() + } is CreateRoomViewEvents.Failure -> showFailure(it.throwable) } } diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsFragment.kt index ba50890db3..26da1a45d2 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/settings/RoomSettingsFragment.kt @@ -106,6 +106,7 @@ class RoomSettingsFragment : RoomSettingsViewEvents.Success -> showSuccess() RoomSettingsViewEvents.GoBack -> { ignoreChanges = true + @Suppress("DEPRECATION") vectorBaseActivity.onBackPressed() } } diff --git a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsFragment.kt b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsFragment.kt index ac3e5e4d05..98c81b19bc 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsFragment.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/manage/SpaceSettingsFragment.kt @@ -107,6 +107,7 @@ class SpaceSettingsFragment : RoomSettingsViewEvents.Success -> showSuccess() RoomSettingsViewEvents.GoBack -> { ignoreChanges = true + @Suppress("DEPRECATION") vectorBaseActivity.onBackPressed() } } diff --git a/vector/src/main/java/im/vector/app/features/usercode/UserCodeActivity.kt b/vector/src/main/java/im/vector/app/features/usercode/UserCodeActivity.kt index cf7d9c6ddb..4fd8305f29 100644 --- a/vector/src/main/java/im/vector/app/features/usercode/UserCodeActivity.kt +++ b/vector/src/main/java/im/vector/app/features/usercode/UserCodeActivity.kt @@ -151,7 +151,10 @@ class UserCodeActivity : VectorBaseActivity(), override fun onBackPressed() = withState(sharedViewModel) { when (it.mode) { - UserCodeState.Mode.SHOW -> super.onBackPressed() + UserCodeState.Mode.SHOW -> { + @Suppress("DEPRECATION") + super.onBackPressed() + } is UserCodeState.Mode.RESULT, UserCodeState.Mode.SCAN -> sharedViewModel.handle(UserCodeActions.SwitchMode(UserCodeState.Mode.SHOW)) } diff --git a/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt b/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt index e21bef193f..c97f87972e 100644 --- a/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt +++ b/vector/src/main/java/im/vector/app/features/webview/VectorWebViewActivity.kt @@ -101,6 +101,7 @@ class VectorWebViewActivity : VectorBaseActivity() if (views.simpleWebview.canGoBack()) { views.simpleWebview.goBack() } else { + @Suppress("DEPRECATION") super.onBackPressed() } }