-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Copy free upload #449
base: main
Are you sure you want to change the base?
Conversation
02ed398
to
69bf195
Compare
3648621
to
3fcd200
Compare
546e766
to
9abebf2
Compare
c809392
to
7072099
Compare
This PR/issue depends on: |
Things to do in this PR, or after:
Things to do definitely after:
For the android-core repo:
|
b754c35
to
11b101d
Compare
Now, the app starts a foreground service as soon as user-picked files arrive in the app. That way, we can keep the URI permissions until the upload is complete, without having to import/copying the data into the app storage. That lets us avoid filling the user device, and avoids no free storage issues. Change operations: 1. Replace DB-backed upload session with in-memory UploadState 2. Replace UploadWorker with UploadForegroundService 3. Replace UploadFileTask with TransferUploader 4. Replace TransferSendManager with UploadSessionStarter 5. Replace ImportFilesScreen with PickFilesScreen 6. Replace ImportFilesViewModel with PickFilesViewModel 7. Merge all upload related screen (progress, errors, success, email validation…) 8. Simplify navigation 9. Remove ImportationFilesManager 10. Remove ImportLocalStorage 11. Ensure the old importation directory is removed if present, freeing storage 12. Extract a few classes into their own file 13. Update NotificationUtils code for naming semantics 14. Move files from the importfiles package to the pickfiles package
The back buttons/gestures are enough and more standard. The close button previously removed picked files after a popup confirmation, which requires the same amount of steps as going back twice.
9c5063d
to
6cc83f9
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.
Don't forget to reformat all files, and group properties at the top of files
...c/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadFailureScreen.kt
Outdated
Show resolved
Hide resolved
) | ||
UploadState.Failure.RestrictedLocation -> UploadFailureScreen( | ||
exitNewTransfer = cancel, | ||
desc = "SwissTransfer doesn't work here yet" |
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.
Add a translated 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.
Done, reused the one shown in the bottom sheet. That said, I think we should think through this redundancy.
If we show a bottom sheet, what are supposed to show in the screen below?
If we show the error below, do we need a bottom sheet in the first place?
Also, do we allow retrying somehow, in case the user leaves a restricted location?
...main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/pickfiles/PickFilesViewModel.kt
Outdated
Show resolved
Hide resolved
notification.post(Ids.LastUpload) | ||
} | ||
|
||
fun buildUploadFailedNotification(canRetry: Boolean): Notification { |
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.
Check this canRetry
because it's always true
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.
Noted in my comment above. Maybe check that after this PR?
app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadScreen.kt
Outdated
Show resolved
Hide resolved
...m/infomaniak/swisstransfer/ui/screen/newtransfer/validateemail/ValidateUserEmailViewModel.kt
Outdated
Show resolved
Hide resolved
We'll reintroduce a case in UploadState.Retry later on, for when we detect a read failure.
The user can just go back afterwards. That lets the user look at which files they selected to look for an alternative, and they can also retry, in case they move to a non restricted location.
I did my best to address everything in new commits (without touching the previous ones since your review, @sirambd). I hope it's good to go, and that we can do what I wrote down in the updated comment above after. |
|
BTW, about notifications, we need to allow the upload to start even if the permission is denied. Foreground services can still run without that, so we don't absolutely need it to proceed with the transfer upload. We probably want an alternative to |
Now, the app starts a foreground service as soon as user-picked files arrive in the app.
That way, we can keep the URI permissions until the upload is complete, without having to import/copying the data into the app storage.
That lets us avoid filling the user device, and avoids no free storage issues.
Change operations:
Depends on Infomaniak/android-core#305