Skip to content

Commit e584abc

Browse files
david-allisonmikehardy
authored andcommitted
refactor(shared-decks): remove onBackPressed
Issue 14558
1 parent 7c7f2ae commit e584abc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksDownloadFragment.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,14 +472,16 @@ class SharedDecksDownloadFragment : Fragment(R.layout.fragment_shared_decks_down
472472
* If there are any pending downloads, continue with them.
473473
* Else, set mIsPreviousDownloadOngoing as false and unregister mOnComplete broadcast receiver.
474474
*/
475-
@Suppress("deprecation") // onBackPressed
476-
private fun checkDownloadStatusAndUnregisterReceiver(isSuccessful: Boolean, isInvalidDeckFile: Boolean = false) {
475+
private fun checkDownloadStatusAndUnregisterReceiver(
476+
isSuccessful: Boolean,
477+
isInvalidDeckFile: Boolean = false,
478+
) {
477479
if (isVisible && !isSuccessful) {
478480
if (isInvalidDeckFile) {
479481
Timber.i("File is not a valid deck, hence return from the download screen")
480482
context?.let { showThemedToast(it, R.string.import_log_no_apkg, false) }
481483
// Go back if file is not a deck and cannot be imported
482-
activity?.onBackPressed()
484+
activity?.onBackPressedDispatcher?.onBackPressed()
483485
} else {
484486
Timber.i("Download failed, update UI and provide option to retry")
485487
context?.let { showThemedToast(it, R.string.something_wrong, false) }

0 commit comments

Comments
 (0)