Skip to content

Commit

Permalink
Merge pull request #97 from Grait-Interaction/add-android-ringtone
Browse files Browse the repository at this point in the history
Adds ability to set android ring tone on success/error
  • Loading branch information
StevePotter committed Nov 28, 2018
2 parents 9ddf916 + 2a62d85 commit 46d8a36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" }`|
Expand Down
4 changes: 4 additions & 0 deletions android/src/main/java/com/vydia/UploaderModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 46d8a36

Please sign in to comment.