From 8feab0b52a49bfb72513797ee157faf17b7d4b2c Mon Sep 17 00:00:00 2001 From: Brayan Oliveira <69634269+brayandso@users.noreply.github.com> Date: Mon, 15 Jan 2024 20:15:51 -0300 Subject: [PATCH] refactor: remove FirefoxSnackbarWorkaround fixed in Firefox release version since years ago --- .../src/main/java/com/ichi2/anki/Reviewer.kt | 6 --- .../workarounds/FirefoxSnackbarWorkaround.kt | 52 ------------------- AnkiDroid/src/main/res/values/03-dialogs.xml | 1 - 3 files changed, 59 deletions(-) delete mode 100644 AnkiDroid/src/main/java/com/ichi2/anki/workarounds/FirefoxSnackbarWorkaround.kt diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt b/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt index 2e022adbb737..200121fe7541 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt @@ -71,7 +71,6 @@ import com.ichi2.anki.servicelayer.NoteService.toggleMark import com.ichi2.anki.servicelayer.rescheduleCards import com.ichi2.anki.servicelayer.resetCards import com.ichi2.anki.snackbar.showSnackbar -import com.ichi2.anki.workarounds.FirefoxSnackbarWorkaround.handledLaunchFromWebBrowser import com.ichi2.annotations.NeedsTest import com.ichi2.audio.AudioRecordingController import com.ichi2.audio.AudioRecordingController.Companion.generateTempAudioFile @@ -184,11 +183,6 @@ open class Reviewer : return } super.onCreate(savedInstanceState) - if (handledLaunchFromWebBrowser(intent, this)) { - this.setResult(RESULT_CANCELED) - finish() - return - } colorPalette = findViewById(R.id.whiteboard_editor) answerTimer = AnswerTimer(findViewById(R.id.card_time)) textBarNew = findViewById(R.id.new_number) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/workarounds/FirefoxSnackbarWorkaround.kt b/AnkiDroid/src/main/java/com/ichi2/anki/workarounds/FirefoxSnackbarWorkaround.kt deleted file mode 100644 index 92e58effb1cb..000000000000 --- a/AnkiDroid/src/main/java/com/ichi2/anki/workarounds/FirefoxSnackbarWorkaround.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (c) 2020 David Allison - - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free Software - Foundation; either version 3 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see . - */ - -package com.ichi2.anki.workarounds - -import android.content.Context -import android.content.Intent -import android.provider.Browser -import com.ichi2.anki.R -import com.ichi2.anki.UIUtils.showThemedToast -import timber.log.Timber - -/** #5374 - * - * If a user attempts to open an apkg from the Firefox Snackbar, we just get a ACTION_VIEW on Reviewer... - * It works if they click the download notification, but if they click "Open", then that disappears. - * - * So... tell them to go to about:downloads, or select the file from their file manager. - * It sucks, but not much we can do. - * - * Reported as fixed in Firefox Preview - */ -object FirefoxSnackbarWorkaround { - fun handledLaunchFromWebBrowser(intent: Intent?, context: Context): Boolean { - if (intent == null) { - Timber.w("FirefoxSnackbarWorkaround: No intent provided") - return false - } - if (wasLaunchFromWebBrowser(intent)) { - showThemedToast(context, context.getString(R.string.firefox_workaround_launched_reviewer_opening_deck), false) - return true - } - return false - } - - private fun wasLaunchFromWebBrowser(intent: Intent): Boolean { - return intent.getStringExtra(Browser.EXTRA_APPLICATION_ID) != null - } -} diff --git a/AnkiDroid/src/main/res/values/03-dialogs.xml b/AnkiDroid/src/main/res/values/03-dialogs.xml index 3275ba6f887e..d5044127feab 100644 --- a/AnkiDroid/src/main/res/values/03-dialogs.xml +++ b/AnkiDroid/src/main/res/values/03-dialogs.xml @@ -60,7 +60,6 @@ A new card is being rescheduled. Rescheduling also turns new cards into review cards. Use the ‘reposition card’ option to change a new card\'s position within the new queue Rescheduling also resets how the scheduler treats the card in the future (ease will be set to %d%%) - Select the deck in your file manager or visit the about:downloads page to import it Database error Writing to the collection failed. The database could be corrupt or there may not to be enough empty space on disk.\n\nIf this happens more often, try checking the database, repairing the collection or restoring it from a backup. Touch “options” for that.\n\Or it could be an AnkiDroid bug as well; please report the error so that we can check this. Report error