-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
JS API to open card browser and search with query #9247
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this idea, but as mentioned in comments, split into 2 commits where one alters the API and all callers to always use Nullable query string to open card browser as a small simple change, then second commit layers the new Javascript API on top of it using the new capability
AnkiDroid/src/main/java/com/ichi2/anki/NavigationDrawerActivity.java
Outdated
Show resolved
Hide resolved
I will split into two PR. Thanks |
For this one could just be 2 commits I think - in this same PR, that would work for me, these ones will be small |
Okay, I will do it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use @JavascriptInterface
in this one as well? Like in #9245 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Has a conflict with your other PR though 😅 |
Yes, I think I need to rebase it. I also thinking about implementing in signal. Because here are two types of function
So, should we make a rule that function that needs parameter(s) should go through signal and the function which do no require parameter(s) should go though As security concerns discussed in PR comments #9245 |
|
Okay, I am on it. |
0ba962d
to
2e8c4c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Pull Request template
Purpose / Description
This is continuation of JS API features. From reviewer using js function/button in one click it will go to CardBrowser and search for cards using query.
Fixes
Fixes #8109
Approach
mSearchTerms
then callsearchCards()
How Has This Been Tested?
Testesd on devices and emulator
AnkiDroidJS.ankiSearchCard(query)
video
Note in this video: Add
AnkiDroidJS.
beforeankiSearchCard
because JSInterface used to call this function.video.mp4
Another example, Added following to front side of card template
image
Learning (optional, can help others)
https://github.com/ankidroid/Anki-Android/wiki/AnkiDroid-Javascript-API
Checklist
Please, go through these checks before submitting the PR.
if
statements)