Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn if user action is not set in new reviewer #17588

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading