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

Conversation

mithleshjs
Copy link

Extra Parameters Added:

  1. android_sound
  2. small_icon
  3. large_icon
  4. big_picture
  5. android_led_color
  6. android_background_data

@@ -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);

@facebook-github-bot
Copy link

@mithleshjs updated the pull request.

@facebook-github-bot
Copy link

@mithleshjs updated the pull request.

3 similar comments
@facebook-github-bot
Copy link

@mithleshjs updated the pull request.

@facebook-github-bot
Copy link

@mithleshjs updated the pull request.

@facebook-github-bot
Copy link

@mithleshjs updated the pull request.

@mithleshjs
Copy link
Author

@flovilmart using reduce is causing build to fail and it overrides other params. I think it is best without a reduce.

@flovilmart
Copy link
Contributor

What do you mean it overrides other params and build is failing?

@mithleshjs
Copy link
Author

What I meant was that implementating reduce method as pointed by you is not working correctly.

@flovilmart
Copy link
Contributor

You mean with the ... ?

@mithleshjs
Copy link
Author

I was referring to this note by you.

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

This method didn't work.

@flovilmart
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants