ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
7.96k stars 2.16k forks source link

[BUG]: globalThis.AnkiDroidJS is undefined #16357

Open abdnh opened 1 week ago

abdnh commented 1 week ago

Checked for duplicates?

Does it also happen in the desktop version?

What are the steps to reproduce this bug?

Accessing the AnkiDroidJS object through globalThis no longer works, apparently after https://github.com/ankidroid/Anki-Android/pull/14564.

Expected behaviour

globalThis.AnkiDroidJS should be equivalent to AnkiDroidJS.

Actual behaviour

globalThis.AnkiDroidJS and window.AnkiDroidJS are undefined, while AnkiDroidJS works as expected.

Debug info

AnkiDroid Version = 2.18beta2-debug (bc58dceaad164f3cfeb9a16729dcb890f5ab5fa2)

Backend Version = 0.1.38-anki24.04.1 (24.04.1 ccd9ca1a8309b80bcb50ddc5d99c7ce63440bce9)

Android Version = 14 (SDK 34)

ProductFlavor = amazon

Manufacturer = Google

Model = sdk_gphone64_x86_64

Hardware = ranchu

Webview User Agent = Mozilla/5.0 (Linux; Android 14; sdk_gphone64_x86_64 Build/UE1A.230829.030; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/113.0.5672.136 Mobile Safari/537.36

ACRA UUID = 700f99a6-74f2-4112-927f-578cd2cdb1ee

FSRS Enabled = false

Crash Reports Enabled = false

(Optional) Anything else you want to share?

This behavior is unintuitive and is breaking some functionality in popular note types, e.g. https://forums.ankiweb.net/t/anki-as-a-knowledge-base-with-a-massive-cloze-note/11658/92

Research

david-allison commented 1 week ago

@BrayanDSO FYI

BrayanDSO commented 1 week ago

This has been around since at least alpha15 and I can't think of anything specific that I have done that could result in that.

I can't find the documentation specifying that this should be intended or not. @krmanik has any thoughts?