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

fix: Setting the iOS alert property overwrites the title property #287

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

chadpav
Copy link

@chadpav chadpav commented Aug 13, 2024

New Pull Request Checklist

Issue Description

When title and alert are 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 alert case.

Closes: #286

TODOs before merging

  • Add tests
  • Add entry to changelog
  • Add changes to documentation (guides, repository pages, in-code descriptions)

Copy link

parse-github-assistant bot commented Aug 13, 2024

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

@chadpav chadpav changed the title FIX: iOS Alert property is overwriting iOS Title property fix: iOS Alert property is overwriting iOS Title property Aug 13, 2024
Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title fix: iOS Alert property is overwriting iOS Title property fix: IOS Alert property is overwriting iOS Title property Aug 13, 2024
@@ -159,13 +159,13 @@ describe('FCM', () => {
});
});
fcm.pushType = 'apple';
const data = { data: { title: 'title' } };
const data = { data: { title: 'title', alert: 'alert' } };
Copy link
Member

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?

// and set its `body` property
apnsPayload['apns']['payload']['aps']['alert'] = {};
if (!apnsPayload['apns']['payload']['aps'].hasOwnProperty('alert')) {
Copy link
Member

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?

@mtrezza mtrezza changed the title fix: IOS Alert property is overwriting iOS Title property fix: iOS alert property is overwriting iOS title property Oct 31, 2024
Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title fix: iOS alert property is overwriting iOS title property fix: IOS alert property is overwriting iOS title property Oct 31, 2024
@mtrezza mtrezza changed the title fix: IOS alert property is overwriting iOS title property fix: Setting the iOS alert property overwrites the title property Oct 31, 2024
@mtrezza
Copy link
Member

mtrezza commented Nov 20, 2024

Just a friendly ping, if you find some time to address the review feedback, then we could go ahead and merge this...

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.

iOS Title property is not received when Alert property is a string
2 participants