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

Adds ability to set android ring tone on success/error #97

Merged
merged 2 commits into from
Nov 28, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ Returns a promise with the string ID of the upload. Will reject if there is a c
|`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 }`|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please indicate this is android-only. Also if you could alphabetize the props, I'd appreciate it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StevePotter I've added this to the header. The complete notification object is android only

|`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