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

Update OneSignalPushAdapter.js [More Parameters Added for Android] #770

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
37 changes: 36 additions & 1 deletion src/Adapters/Push/OneSignalPushAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,42 @@ export class OneSignalPushAdapter extends PushAdapter {
if(data['uri']) {
post['url'] = data['uri'];
}

if(data['android_background_data'])
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be nicer with a reduce:

post = ['android_background_data', ...].reduce( (post, key) {
  if (data[key]) {
    post[key] = data[key];
    delete data[key];
  }
  return post;
}, post);

{
post['android_background_data'] = data['android_background_data'];
delete data['android_background_data'];
}

if(data['android_sound'])
{
post['android_sound'] = data['android_sound'];
delete data['android_sound'];
}

if(data['small_icon'])
{
post['small_icon'] = data['small_icon'];
delete data['small_icon'];
}

if(data['large_icon'])
{
post['large_icon'] = data['large_icon'];
delete data['large_icon'];
}

if(data['big_picture'])
{
post['big_picture'] = data['big_picture'];
delete data['big_picture'];
}

if(data['android_led_color'])
{
post['android_led_color'] = data['android_led_color'];
delete data['android_led_color'];
}

post['data'] = data;

let promise = new Parse.Promise();
Expand Down