-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Manual-Download-link #17351
base: main
Are you sure you want to change the base?
Manual-Download-link #17351
Conversation
First PR! 🚀 We sincerely appreciate that you have taken the time to propose a change to AnkiDroid! Please have patience with us as we are all volunteers - we will get to this as soon as possible. |
Important Maintainers: This PR contains Strings changes
|
Task Remaining
|
Hi @david-allison ! I've opened a draft PR for the issue #17178. Could you review it to see if it meets the desired result, and let me know if there are any changes needed? |
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.
Looks good!
A few nitpicks. Main issue is the target of the URL
I would add a few @NeedsTest
annotations, or unit tests for the functionality
AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksDownloadFragment.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksDownloadFragment.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksDownloadFragment.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksDownloadFragment.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksDownloadFragment.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksDownloadFragment.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksDownloadFragment.kt
Outdated
Show resolved
Hide resolved
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/download_progress" | ||
app:layout_constraintVertical_bias="0.958" /> |
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.
Probably not what you want. Can you represent this another way?
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.
AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksDownloadFragment.kt
Outdated
Show resolved
Hide resolved
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.
Looks great! Sorry for the slow response, been really busy
AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksDownloadFragment.kt
Outdated
Show resolved
Hide resolved
android:id="@+id/download_from_ankiWeb" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="@string/download_deck_from_AnkiWeb" | ||
android:background="@color/material_blue_500" | ||
android:textColor="@color/white" | ||
android:padding="8dp" | ||
android:layout_marginBottom="24dp" | ||
android:layout_marginStart="24dp" | ||
android:layout_marginEnd="24dp" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintBottom_toTopOf="@id/try_again_deck_download" | ||
android:visibility="gone" |
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 couldn't see on the gif, but I'd expect this to either be a material 'text button', or be underline so a user knows it's a link
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.
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.
Looks great, cheers!
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.
Looks good but just one question why not m3 button?
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.
Hi,
First, nice to meet you. Thanks for working on this!
First feedback on your PR, if it's not too hard, when you change the behaviour, I'd love that you update the gif in the first message, so that I know what I expect to see.
You implemented what David requested, and I should have commented on the bug report sooner. I admit I'm not entirely convinced this is the best feature we may have for this problem.
I'd expect that, in case of download issue, we'd want to directly send the intent without requesting a user to tap on the button. And have a message stating that the user should must navigate to their download folders. Or otherwise that they can download it manually from this link, and have a button allowing the user to copy the link in the clipboard.
First, because I don't really know a case where the user would not want to go through the browser. And if they always want to go through the browser, let's do it for them. (Admittedly, if they don't yet have any preferred browser, that may be a not optimal experience. I don't know how many people will have opened ankidroid but not a browser. That must exists sometime. I'd expect this is mostly an issue when you are a developer testing on simulator)
More importantly, if it's relatively easy to solve the error through an alternate route, then we can just be silent about the error. I'd expect most users not to care that there was supposed to be a more efficient route that failed. And even if it usually work on their device and that's the first time it failed, it's still no big deal that the route is different for this time.
In the case when we keep with your current implementation, and requiring the user to do the click, I still believe that the button message should be changed
|
||
val fileToBeDownloaded = arguments?.getSerializableCompat<DownloadFile>(DOWNLOAD_FILE)!! | ||
downloadManager = (activity as SharedDecksActivity).downloadManager | ||
|
||
downloadFile(fileToBeDownloaded) | ||
|
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.
Why do you remove this line? That's not wrong, but I admit I'd have not expected to see changes in part of the code you didn't touch.
@@ -268,6 +268,7 @@ | |||
<string name="percentage">%s%%</string> | |||
|
|||
<string name="download_deck">Download deck</string> | |||
<string name="download_deck_from_AnkiWeb">Download deck from AnkiWeb</string> |
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.
Not fan of this phrasing to be honest. I can't imagine that the average user would know what ankiweb is. And even if they knew, how does it differ from what they did? After all, we were already on ankiweb website
Sorry for the late response. Thank you for the feedback and suggestions! 1- I understand your suggestion to directly send the intent on download failure and provide a message guiding users to their download folder. However, if we send the intent every time a download fails, wouldn’t that make the 'Try Again' button redundant? The button currently allows users to retry manually, which could still be helpful. Should we consider removing or repurposing it? 2- Adding a button to copy the link to the clipboard feels similar to the Could you please confirm if I’ve understood your approach correctly? And since we’re redirecting to AnkiWeb in the browser, I agree that the button label should be updated. Instead of |
@@ -105,7 +122,8 @@ | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
app:layout_constraintStart_toStartOf="parent" | |||
app:layout_constraintEnd_toEndOf="parent" | |||
android:visibility="gone" /> | |||
android:visibility="gone" |
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.
why this change?
No worries, we are all volunteers. Also, sorry for my delay.
Ideally, I'd say that, if the intent suceeded, we remove "try again", otherwise we keep it. I have no idea whether it's something we can actually now. To give a better answer, I'd need to know what failures we have. If we expect to have ankiweb failure, then yeah, "retry" is great. If we expect to have failure due to some version of android not accepting to read downloaded file, "retry" is useless. And I've no idea what are the problems we actually encounter. Even if I can guess that ankiweb is down some of the time
I agree. I only suggested it in case the first solution failed. I don't know the entire Android API and could imagine we didn't do the first proposed suggestion because of some limitation I didn't know.
"Open in Browser seems fine." if you open the html page that contains the download button. Admittedly, it's not clear the ankiweb apkg link is expected to survive more than a few seconds. For example |
This should also handle the case where the import fails due to something like: |
Purpose / Description
The user can download the deck manually if download fails.
Fixes
Approach
This change allows users to manually download decks from AnkiWeb through an external browser if the download fails in the in-app WebView. By using an Intent, we redirect users to their preferred browser.
Once the download is initiated, the app pops the fragment stack.
Steps to reproduce the download failed error.
1 : Comment out the downloadFile() function call in the onViewCreated method.
2 : Instead, call checkDownloadStatusAndUnregisterReceiver(false, false).
Checklist
(https://play.google.com/store/apps/details?id=com.google.android.apps.accessibility.auditor)