Skip to content

implement AbstractFlashcardViewer / Javascript API versioning #6328

@mikehardy

Description

@mikehardy
Reproduction Steps
  1. alter the functionality in AnkiDroid's Javascript interface for a new version
  2. open a card with template based on advanced javascript functionality (e.g. Make available current card's and deck's details in WebView #6307)
Expected Result

Some indication that your card template isn't working correctly, and that there is a real reason, and ideally who to contact and maybe how to fix it yourself

Actual Result

Card might just break, no idea why

From @david-allison-1 in #6307 (review) I liked this idea a lot:

If we go down this route, we will want a method which will enable this complex functionality. Maybe not for this PR, but we should flesh out the plans, or we'll get hit by bad reviews that we can't do much about.

Something along the lines of: Define an "init" function, which accepts an API version number, and will toggle AbstractFlashcardViewer functions/signals in a forwards/backwards compatible manner.

So perhaps something like:

  • add an "ankidroidJsStatus" to AbstractFlashcardViewer
  • initialize that with contents of a 'ankidroidJsInit(int apiVersion, string developerContact)'
  • inject a warning in review below the reviewer minibar / top of card if any parts of the interface were used with either no init or a deprecated API, including a link to a wiki page for more info - bonus points if it is dismissable for the entirety of a review session
  • a wiki page explaining that we're adding to the interface and need to be able to version it to manage change over time, plus the exact changes (ideally copy-pastable for users) to get rid of the warning

Or similar, I'm more vague on the last points, anything reasonable to do versioning with user / developer notification of changes and ability to self help is welcome

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions