diff --git a/README.md b/README.md index 36b236fc..e4231117 100644 --- a/README.md +++ b/README.md @@ -155,12 +155,13 @@ Returns a promise with the string ID of the upload. Will reject if there is a c |`parameters`|object|Optional||Additional form fields to include in the HTTP request. Only used when `type: 'multipart`|| |`notification`|Notification object (see below)|Optional||Android only. |`{ enabled: true, onProgressTitle: "Uploading...", autoClear: true }`| -### Notification Object +### Notification Object (Android Only) |Name|Type|Required|Description|Example| |---|---|---|---|---| |`enabled`|boolean|Optional|Enable or diasable notifications|`{ enabled: true }`| |`autoClear`|boolean|Optional|Autoclear notification on complete|`{ autoclear: true }`| |`notificationChannel`|string|Optional|Sets android notificaion channel|`{ notificationChannel: "My-Upload-Service" }`| +|`enableRingTone`|boolean|Optional|Sets whether or not to enable the notification sound when the upload gets completed with success or error|`{ enableRingTone: true }`| |`onProgressTitle`|string|Optional|Sets notification progress title|`{ onProgressTitle: "Uploading" }`| |`onProgressMessage`|string|Optional|Sets notification progress message|`{ onProgressMessage: "Uploading new video" }`| |`onCompleteTitle`|string|Optional|Sets notification complete title|`{ onCompleteTitle: "Upload finished" }`| diff --git a/android/src/main/java/com/vydia/UploaderModule.java b/android/src/main/java/com/vydia/UploaderModule.java index 2cf389b8..c9a51de0 100644 --- a/android/src/main/java/com/vydia/UploaderModule.java +++ b/android/src/main/java/com/vydia/UploaderModule.java @@ -222,6 +222,10 @@ public void onCancelled(Context context, UploadInfo uploadInfo) { notificationConfig.getCompleted().autoClear = true; } + if (notification.hasKey("enableRingTone") && notification.getBoolean("enableRingTone")){ + notificationConfig.setRingToneEnabled(true); + } + if (notification.hasKey("onCompleteTitle")) { notificationConfig.getCompleted().title = notification.getString("onCompleteTitle"); }