-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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(message overrides): extract message content with Platform-Specific Overrides #12917
fix(message overrides): extract message content with Platform-Specific Overrides #12917
Conversation
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.
@buddyeorl, appreciate this very much. I added a few questions and suggestions. Looking forward to work with you to get this in.
packages/notifications/src/inAppMessaging/providers/pinpoint/utils/helpers.ts
Outdated
Show resolved
Hide resolved
packages/notifications/src/inAppMessaging/providers/pinpoint/utils/helpers.ts
Outdated
Show resolved
Hide resolved
packages/notifications/src/inAppMessaging/providers/pinpoint/utils/helpers.ts
Outdated
Show resolved
Hide resolved
packages/notifications/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts
Outdated
Show resolved
Hide resolved
packages/notifications/__tests__/inAppMessaging/providers/pinpoint/utils/helpers.test.ts
Outdated
Show resolved
Hide resolved
packages/notifications/__tests__/inAppMessaging/providers/pinpoint/utils/helpers.test.ts
Outdated
Show resolved
Hide resolved
packages/notifications/__tests__/inAppMessaging/utils/processInAppMessages.test.ts
Outdated
Show resolved
Hide resolved
packages/notifications/src/inAppMessaging/providers/pinpoint/utils/helpers.ts
Outdated
Show resolved
Hide resolved
…rides' of https://github.com/buddyeorl/amplify-js into in-app-messaging/fix/extract-content-with-platform-overrides
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.
Thank you for the changes. Just one more important core
export update needed but otherwise it looks good to me!
packages/notifications/src/inAppMessaging/providers/pinpoint/utils/helpers.ts
Outdated
Show resolved
Hide resolved
…rides' of https://github.com/buddyeorl/amplify-js into in-app-messaging/fix/extract-content-with-platform-overrides
@cshfang, Oops, I'm on a new machine and realized I hadn't set up any plugins in my IDE. I've now added Prettier and reformatted all the modified/added code. It should be good now: |
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.
One last small change and I think we're probably good to go. Thanks for bearing with me on this
configPlatform: ButtonConfigPlatform, | ||
button?: InAppMessageButton, | ||
): InAppMessageButton['DefaultConfig'] | undefined => { | ||
if (!button || !button?.DefaultConfig) { |
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.
Nit: I think this is effectively the same as
if (!button?.DefaultConfig) {
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.
Yes, make sense to me:
if (!configPlatform || !button?.[configPlatform]) { | ||
return button?.DefaultConfig; | ||
} | ||
return { | ||
...button?.DefaultConfig, | ||
...button?.[configPlatform], | ||
}; |
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.
Given the guard clause above and how the spread operator works, I think we can actually condense this:
return {
button.DefaultConfig,
button.configPlatform,
}
Since we know button
is guaranteed to be truthy by this point and even if configPlatform
is nullish, it would spread just fine and we would end up returning the DefaultConfig.
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.
updated here:
removed unnecessary optional chaining operators
No worries - really appreciate it |
@buddyeorl Apologies for the delay here. I was finally able to verify the changes on both Android and iOS devices work properly. However, there are a few lint fixes you'll have to make before we merge. The failing test should give you the info needed. Looking to merge once these are updated. |
aa52fe7
@Samaritan1011001 Thanks for the update! I've addressed the lint fixes and re-run the tests on my end. Everything should be passing smoothly now. Please let me know if there's anything else needed from my side. Appreciate your assistance! |
Description of changes
Issue #, if available
Issue 12915
Description of how you validated changes
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.