iOS: Add callback to request all values in deck for specific field

Hi I am working on a Manga reader for all platforms based off Suwayomi/Tachiyomi. It has instant ocr and 2 tap word lookups on mobile, 1 click on desktop GitHub - KolbyML/Mangatan: A 1 click solution for reading Manga with OCR'ed textboxs, works seamless with Yomitan the app also supports ocr and dictionaries for all languages as well. We have some English/Chinese/Korean learners, but the majority of our users are learning Japanese.

I added Anki support for creating flashcards already for Desktop/Android using AnkiConnect an extension which provides an API for anki.

For iOS I need to use callbacks which is fine, the problem is currently if users look up a word on iOS it will always show the “create flashcard button” which is unideal as creating a flashcard already made then alerting the user it is a duplicate is extremely tedious and bad UX.

So my request is if we could add a callback where I could specify

  • the deck
  • the notetype
  • the field

Then the callback would give me a list of target words/(aka the selected field) which I could use for the duplicate check locally on my end. That way I can show the user if they already have a flashcard for that word or not.

Assuming the callback returns utf 8 and the google says the average japanese word is 2.8 moji, lets use a basic seperator like , 40000 (an assumed worse case, 40k words in japanese is insanely high) target words * 2.8 average moji + 40000 comma’s = 152000 charecters google says ```
For 152,000 Japanese characters in UTF-8 encoding, the size can range from 456,000 to 608,000 bytes, depending on the specific characters used
```

Which I think is more then reasonable for a call which will not be used all the time for syncing the users mined words for duplicate checks.

This feature would increase the UX for making flashcards on iOS immensily and would be greatly appreciated. It would allow for the addNote callback only being called on actually nondupe words, which would greatly decrease the fatigue that builds from mining cards on iOS you have already mined.

Anyways all I can do from here is hope :folded_hands: I am a big fan of Anki and want to provide the best experience possible for my users. I think this addition to the callback API would make a night and day difference.

Thank you for your time

2 Likes

This would be great to have as described.

Suggestion: ExtensionKit as next gen replacement for URL schemes would be a better way to provide this functionality, and may also be less work for the Anki team since a smaller amount of the work could be required in the iOS layer with the rest done in Rust. But it requires a prototype so there is more up front work and evaluation needed.

I agree Suggestion: ExtensionKit as next gen replacement for URL schemes is the better solution, with the assumption the new api could be enabled via a callback, so apps could prompt the user to enable it, instead of instructing them, which is a big UX hurdle.

I just want a working system for duplicate checks which doesn’t rely on tedious callbacks, and is instant.

My solution can have desyncing and could require manual syncs of “target word”’s by the user, but should reduce the rate users click “add card” just to see they already had a card made which is a horrible user experience. Or users not wanting to mine words due to the fatigue of it failing enough.

From my understanding your suggestion would remove callbacks all together (if it requires users hitting a flag to enable the api and I can’t use a callback to prompt the user to enable it, your proposal would be a deal breaker for me, but I assume adding a callback for it shouldn’t be the worse)

My concern though is it has been almost 3 years and that proposal isn’t avaliable. If it could be implemented in a reasonable timeframe (not years again, hopefully within this quarter or less), than I am more then happy. I am assuming my callback proposal is less then 100 lines and would 100x UX for mining on iOS, greatly reduce the about of callbacks a user makes, which inturn greatly reduce the fatigue of mining on iOS.

I just want a real solution to happen, because right now mining on iOS sucks. Duplicate checks (before adding a card) is insanely important for UX.

:folded_hands: I would prefer your solution (with callback to enable API), but if we got my proposal in I would be insanely happy as it would provide such a better experience for Language Learners than what is avaliable on iOS today. I assume my proposal is less work, but I just want a solution at this point. Whether it is optimal UX or a massive UX increase, the current experience is painful. I just want a win.

1 Like

I am going to close this thread. I am just going to implement in my app

  • syncing anki aka download/upload decks
  • reading the downloaded decks for the info I need,
  • adding a new card

This will remove the desync issue and make it so Anki is more accessible, and people don’t have to use callbacks on iOS :grin:

Just thought of this idea last night, when I was thinking what to do

hmm I don’t know if I can close this

I am going to make a formal request to Dae as I want to do things on good terms

That’s what this is – you’ve made a formal request to the dev to implement this in the app. If you want to withdraw it, that’s fine. I’ll close the thread.

[If you want to do this a different way for yourself, you don’t need special permission for that, as long as it doesn’t violate the ToS for the app.]