Skip to content

Commit

Permalink
warn if user action is not set in new reviewer
Browse files Browse the repository at this point in the history
  • Loading branch information
MorenoTropical authored and david-allison committed Dec 10, 2024
1 parent a0b387e commit 34d42da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AnkiDroid/src/main/assets/scripts/ankidroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ globalThis.ankidroid.userAction = function (number) {
let userJs = globalThis[`userJs${number}`];
if (userJs != null) {
userJs();
} else {
window.location.href = `missing-user-action:${number}`;
}
} catch (e) {
alert(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ import com.ichi2.anki.dialogs.TtsVoicesDialogFragment
import com.ichi2.anki.localizedErrorMessage
import com.ichi2.anki.snackbar.showSnackbar
import com.ichi2.anki.utils.ext.packageManager
import com.ichi2.anki.utils.openUrl
import com.ichi2.compat.CompatHelper.Companion.resolveActivityCompat
import com.ichi2.themes.Themes
import com.ichi2.utils.show
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import timber.log.Timber
Expand Down Expand Up @@ -162,6 +164,17 @@ abstract class CardViewerFragment(
"tts-voices" -> TtsVoicesDialogFragment().show(childFragmentManager, null)
"android-app" -> handleIntentUrl(url, Intent.URI_ANDROID_APP_SCHEME)
"intent" -> handleIntentUrl(url, Intent.URI_INTENT_SCHEME)
"missing-user-action" -> {
val actionNumber = url.toString().substringAfter(":")
val message = getString(R.string.missing_user_action_dialog_message, actionNumber)
AlertDialog.Builder(requireContext()).show {
setMessage(message)
setPositiveButton(R.string.dialog_ok) { _, _ -> }
setNeutralButton(R.string.help) { _, _ ->
openUrl(R.string.link_user_actions_help)
}
}
}
else -> {
try {
openUrl(url)
Expand Down

0 comments on commit 34d42da

Please sign in to comment.