Closed Limegrass closed 5 years ago
I'm not sure about the button appearing without access to Anki, but I can reproduce a crash by:
This actually happens in AnkiDroid's API sample app too so I opened a similar issue there: https://github.com/ankidroid/apisample/issues/10
One workaround would be to catch the IllegalStateException
and display an informative message to the user.
@mattdeckard Thanks for the great investigative work. It looks like AnkiDroid itself is not functional without the storage permission since it defaults to a save location where it is required, but it would definitely be nice to have an API call available that returns whether the storage permission is granted to Anki and/or an api call that request storage permission on the behalf of AnkiDroid if it doesn't have it. I'd prefer that over adding error handling if possible.
If you have more time on your hands, you could submit an issue to the AnkiDroid project to add such an API call, or even add it yourself. Otherwise, I can add the API calls and submit a pull request when I finish up re-architecturing Wanicchou itself. Though there's room for debate on whether it should even exist if AnkiDroid is not functional without it, so who knows if it'll get accepted.
The button appearing issue was a result from an accidental commit when I was testing and rushing to get this out, since I was anticipated not having time to work on it soon when I released it. Luckily I have the time again, and it's resolved in the typical case (where the user grants AnkiDroid storage permission.) in a commit to the 1.0.2 branch, but it'll still be a just bit more until I'm ready to release that version due to rearchitecturing.
Sure thing! Thank you for making this app. I've found it so useful, it's become my main method of adding cards to my Japanese deck. I used to use Aedict3 to add them from JMDict entries and then manually replaced the English definitions with ones from Sanseido using AnkiDroid's card editor. So you can imagine how much time this app has saved me! 😄
I added an issue here
I'd be happy to work on the PR too but I'm going to try to wait until that issue gets some discussion cause I'm not sure which route the AnkiDroid maintainers will want to go.
Glad to hear it! That's definitely the right route in the API case.
But, really. You have no idea how happy knowing someone else actually gets use from the app. Despite the fact that a lot of my dev has been focused on self-satisfaction... Definitely more feature focused soon(tm) though. Probably additional sources and send-to Wanicchou (for direct searching of highlighted text) after things are cleaned up.
@mattdeckard Once again, thank you for the research. I added a check and message as suggested. It completely slipped me to just check their permissions with Android's PackageManager, and they do conveniently provide their package name to check.
With that said, it would probably help a lot to have the apisample updated so other developers know how to handle the issue at least. I personally would still appreciate an API method for checking API availability and Storage permission (or both as a combination and being encompassed by a method like isApiAvailable from the apisample), but we'll see how they feel about it (eventually). Feels a little silly to me to expose the app's package name in an API method and forcing every developer to write the code to perform the same two checks.
Google Play review seems to suggests that the Anki Import button is appearing without access to Anki, causing a crash upon button press. The button should not reveal if Anki Droid is not installed and permission was not given to access it.