Skip to content
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

an option to delete the original file on the phone after upload #40

Closed
salgado opened this issue Aug 21, 2015 · 1 comment
Closed

an option to delete the original file on the phone after upload #40

salgado opened this issue Aug 21, 2015 · 1 comment
Assignees

Comments

@salgado
Copy link

salgado commented Aug 21, 2015

No description provided.

@alexbbb
Copy link
Contributor

alexbbb commented Aug 22, 2015

You have to add the following permission to your app's manifest:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

and then you can delete the uploaded file from the AbstractUploadServiceReceiver's onCompleted method. You have to keep a reference to the uploded file paths. One simple way is to create a HashMap with uploadID's as keys and full file paths as values. I suggest you to check this post regarding file delete: http://stackoverflow.com/questions/1248292/how-to-delete-a-file-from-sd-card

However, I don't intend to implement such a feature at the moment, because it's beyond the scope of the library to make modifications on the file system. It's up to your app's specific logic to do that. Feel free to fork the project and add this feature if you need it :)

@alexbbb alexbbb closed this as completed Aug 22, 2015
@alexbbb alexbbb added the wontfix Something which is not going to happen. Ever. label Aug 27, 2015
@alexbbb alexbbb self-assigned this Aug 27, 2015
@alexbbb alexbbb added this to the 1.3 milestone Aug 27, 2015
@alexbbb alexbbb removed the wontfix Something which is not going to happen. Ever. label Jan 19, 2016
@alexbbb alexbbb removed this from the 1.3 milestone Jan 19, 2016
gotev added a commit that referenced this issue Sep 28, 2019
gotev added a commit that referenced this issue Sep 29, 2019
* #450 upgraded gradle plugin to 3.4.2, gradle wrapper to 5.4.1 and replaced dcendents maven plugin with new gradle-maven-plugin from sky-uk. Added kotlin support in the modules and bumped versions for new development cycles. Added script for local snapshot release. Updated RecyclerAdapter.

* update travis configuration

* update travis configuration

* #450 ported OkHttp module to Kotlin and upgraded to OkHttp 4.0.1

* #450 OkHttp BodyWriter is now cloaseable. Relying on Kotlin "use" to safely handle it. Refactored createBody method.

* #450 migrated HurlStack and generic http facade to Kotlin

* #450 try to make travis happy again

* #450 Refactored http package to network. Migrated ServerResponse to Kotlin and moved to network package. Setup kotlin in demo app and added global broadcast receiver.

* #450 migrated logger to Kotlin

* #450 better name for request body writer delegate method

* #450 migrated Scheme Handlers to Kotlin. It's now possible to register custom scheme handlers. Improved exception messages. Started migration of parcelable data classes to Kotlin.

* #450 moved all the configurable parameters in UploadServiceConfig. Enhanced debug log messages by printing upload service configuration, android version and processor cores

* #450 migrated UploadFile and Placeholders to Kotlin. Refactored scheme handlers names. Dropped ContentType class in favor of a String extension.

* #450 do not parcelize utility property bodyString

* #450 migrated BroadcastData in Kotlin

* #450 migrated UploadInfo to Kotlin.

* #450 Moved SchemeHandlers to UploadServiceConfig. Set default logger delegate debug log to info because some devices (e.g. Huawei ALE-L21 with Android API 22) does not display Log.d in LogCat and some vendor specific settings are needed. It's better to not deal with those.

* #450 Migrated UploadNotificationAction to Kotlin

* #450 fix cancelling uploads on Android API 26+

* #450 migrated UploadTaskParameters to Kotlin and refactored where needed

* #450 updated gradle plugin

* #450 updated Kotlin to 1.3.50. Used require to make code more readable.

* #450 migrated binary upload task to kotlin. Added http URL validator extension for strings

* #450 moved notification handling in separate listener. Removed automatic notification channel creation on Android 8+. This reduces UploadTask competences, complexity and code.

* #450 renamed package notifier to tasklistener

* #450 moved broadcast operations out of UploadTask. This further simplifies UploadTask logic and competences.

* #450 file deletion is now a competence of the scheme handler. This also solves a potential bug in FTP upload module and allows file deletion via content resolver (if supported). UploadInfo now contains full UploadFile information instead of the string path.

* #450 remove static constants in UploadTask in favor of a ServerResponse factory method

* #450 upload task now receives the notification ID as an init parameter

* #450 moved throttling logic in separate function

* #450 converted UploadTask in Kotlin

* #450 default number of retries for each request is now configurable in Retry Policy global configuration. Dropped Upload Delegate implementation.

* #450 Removed example empty UploadReceiver. BroadcastReceivers are now called RequestObservers. Log level can now be tuned based on BuildConfig.DEBUG value. Removed OkHttp call timeout. Not suitable for uploads which can run an indefinite amount of time. Started implementation of new kind of broadcast receivers. Added utility inline fun to safely perform the same action on all of the task's observers.

* #450 create new uploadInfo for each observer

* #450 http uploads now uses UTF-8 by default. removed concept of Intent from UploadTasks. Additional params are now passed directly in UploadTaskParameters. Converted UploadService to Kotlin

* #450 refactor starting upload. Reduced code in UploadService.

* #450 better log messages when instantiating new task fails

* #450 task observers are now passed as parameters in the init method. This in turn allowed to make the task independent from the upload service.

* #450 code shrinking

* #450 simplified notifying progress by sending only the bytes transferred and let the base class handle the rest

* #450 inject http stack in upload tasks. Done some renaming of http stack data types and methods to make the code more fluent to read

* #450 calculate sleep deadline only once

* #450 make HttpRequest implement the Closeable interface

* #450 use better equals

* #450 using lambda functions in logger to save performance evaluating messages which are not going to be logged. Started conversion of HttpUploadTask to Kotlin.

* #450 http stack requests auto-close on success and on error

* #450 converted MultipartUploadTask to Kotlin

* #450 code reorder

* #450 remove unnecessary annotation in Kotlin

* #450 progress listener is now passed to the BodyWriter which manages it internally. Simplified multipart upload task. Simplified notification handler.

* #450 Changed the task events lifecycle to be more Rx and LiveData-like

* #450 implemented tagging each HTTP connection with the uploadID to have better logging

* #450 refactored successfully uploaded files logic. Moved wake lock logic in extensions

* #450 removed author comments as they can be read from github, as well as some old docs

* #450 refactor sending broadcast

* #40 ported UploadNotificationConfig and UploadNotificationStatusConfig in Kotlin. Made necessary refactorings.

* #450 migrated all the request builders to Kotlin

* #450 made UploadServiceConfig, UploadServiceLogger and UploadService static methods java friendly. Migrated HttpUploadTaskParameters to Kotlin. Added extensions for multipart upload files.

* #450 migrated FTPUploadTaskParameters and UnixPermissions to Kotlin. Added Unit Tests for UnixPermissions.

* #450 moved content provider file selector in files picker activity. Moved Apache Commons FTP Code in FTPClientWrapper. Ported FTPUploadTask to Kotlin. Newer macOS doesn't have FTP server anymore, so setup a simple script to use vsftpd inside docker.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants