- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 108
          fix: Setting the iOS alert property overwrites the title property
          #287
        
          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
base: master
Are you sure you want to change the base?
Conversation
…that alert will overwrite title.
| Thanks for opening this pull request!
 | 
| I will reformat the title to use the proper commit message syntax. | 
| }); | ||
| fcm.pushType = 'apple'; | ||
| const data = { data: { title: 'title' } }; | ||
| const data = { data: { title: 'title', alert: 'alert' } }; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a new test to test specifically what this fix is about, rather than modifying an existing test?
| // When we receive a value, prepare `alert` dictionary if needed | ||
| // and set its `body` property | ||
| apnsPayload['apns']['payload']['aps']['alert'] = {}; | ||
| if (!apnsPayload['apns']['payload']['aps'].hasOwnProperty('alert')) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that this is a replication of the logic under caes 'title':, correct? However, I find it strange to use hasOwnProperty for this, did you just use this from the other case?
alert property is overwriting iOS title property
      | I will reformat the title to use the proper commit message syntax. | 
alert property is overwriting iOS title propertyalert property is overwriting iOS title property
      alert property is overwriting iOS title propertyalert property overwrites the title property
      | Just a friendly ping, if you find some time to address the review feedback, then we could go ahead and merge this... | 
New Pull Request Checklist
Issue Description
When
titleandalertare provided as a strings, the adapter code has to convert the Parse dictionary to the format that FCM is expecting. This would set the title property first and then reinitialize the alert key before setting the alert. This would wipe out the title property.Related issue: #286
Approach
In the switch statement where both alert and title get set, the title property was correctly checking if the alert property was already set before initializing it. All I had to do was copy that code up to the
alertcase.Closes: #286
TODOs before merging