Skip to content

Upload Service 4 #450

Closed
Closed
@gotev

Description

@gotev
  • Android 10 Support. Set Target API to 29 https://developer.android.com/about/dashboards
  • Upgrade all the dependencies to their latest versions for maximum stability and support.
    • This Includes OkHttp 4.x which Min SDK is 21. This poses some limitations for old devices support, but the world needs to move forward, mainly for security and maintenance reasons. API < 21 devices have many problems supporting latest TLS ciphers. Many of them cannot at all. This is an upload library, safety comes first. My oldest hardware device has Android 5.0 (2014) and my apps are all API 21+. No contributor or supporter for older devices than 5.0 to date, so I cannot afford providing support of any kind for those versions myself. If someone is willing to help, let me know.
  • Migrate the codebase to Kotlin to ease maintenance, evolution and provide null safety
  • Code refactoring. The codebase has had many tiny modifications going forward, but looking at the whole picture now, there's a call for change. Google came up with many innovations and some JetPack components may be well suited for this library.
  • Use latest Gradle 5.x together with new gradle maven plugin from https://github.com/sky-uk/gradle-maven-plugin
  • Public API changes: delegates as they are implemented (3.5.2) have been a major source of issues and misdirection (even if there's a Wiki for that), as they don't support device rotation and user navigating away from the activity. They will be dropped and replaced by something better and less misleading.
  • Design and implement delegates substitutes
  • As explained in Add ability to customize notification channel name & group #382 there's a design mistake in how notification channels are handled. From 4.0.0 upload service will only use already created notification channels and throw errors if no channel is provided or if the provided channel ID does not exist.
  • Add possibility to register custom scheme handlers to handle other schemes which are not file or content via UploadServiceConfig.addSchemeHandler("yourscheme", YourHandler::class.java)
  • Move all the global configurations in the separated UploadServiceConfig class
  • Make default retries for each request configurable in UploadServiceConfig
  • Enable UTF8 Charset by default (up to 3.5.2 you had to manually enable it)
  • Fix cancelling upload tasks from notification on Android API 26+
  • Change the task events lifecycle to be more Rx and LiveData-like, with the following events
    • onProgress
    • onSuccess or onError
    • onCompleted (which comes always after onSuccess or onError)
    • task cancellation -> UserCancelledUploadException passed in onError
    • error response from server -> UploadError(serverResponse) passed in onError
  • Set Log level to DEBUG or OFF depending on BuildConfig variable value with UploadServiceLogger.setDevelopmentMode(BuildConfig.DEBUG)
  • Rename Broadcast Receiver to Request Observer
  • move uploadId parameter out of request builder constructors. Custom upload IDs can be set by calling .setUploadId("yourId") on request builder
  • Add method setBearerAuth("bearerToken") to HTTP upload builders (multipart, binary)
  • Fix NPEs in FTP Upload Module
  • Use LocalBroadcastManager instead of global to notify upload task events. This reduces overhead and augments security
  • Make ThreadPool overridable to allow library users to use shared ThreadPool
  • Custom and localizabile placeholders (Placeholders localization #466)
  • Custom notification handler. It's possible to use your own notification handler implementation.
  • Make it easier to add and handle notification actions, by supplying a default broadcast receiver which gets broadcast pending intents and the uploadId when building notification configuration
  • Remove setCustomUserAgent from request builders and move the notion of User-Agent to the Http Stack implementations
  • Other things which may pop up while doing the above

Docs, debugging and issues

  • Log exception which caused an upload retry
  • Provide step by step tutorials to migrate to 4.x
  • Improve debug logs to ease troubleshooting
  • New documentation and examples in Kotlin
  • Make a JSON representation for each of the bundled upload requests (multipart, binary, ftp)
  • New issue templates, for both 3.x and 4.x versions

Demo App

  • Upgrade to latest Recycler Adapter
  • Add example usage for system file picker with content resolver
  • Use Kotlin Extensions and remove ButterKnife
  • Allow choosing between File Picker and Content Provider Picker
  • Allow choosing the HTTP Stack (Hurl or OkHttp)

Metadata

Metadata

Assignees

Labels

ongoingIssue which is in progresstaskSomething which needs to be done. Not necessarily a bug or an enhancement

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions