Adds support for localized push notification in push payload#4129
Adds support for localized push notification in push payload#4129flovilmart merged 5 commits intomasterfrom
Conversation
- passign alert-[lang|locale] or title-[lang|locale] will inject the proper locale on the push body based on the installation
Codecov Report
@@ Coverage Diff @@
## master #4129 +/- ##
==========================================
+ Coverage 90.79% 90.81% +0.02%
==========================================
Files 116 116
Lines 7941 7993 +52
==========================================
+ Hits 7210 7259 +49
- Misses 731 734 +3
Continue to review full report at Codecov.
|
acinader
left a comment
There was a problem hiding this comment.
lgtm. some optional nits for you.
| }).catch((err) => { | ||
| return pushStatus.fail(err).then(() => { | ||
| throw err; | ||
| }); |
src/Push/PushWorker.js
Outdated
| map[badge].push(installation); | ||
| function groupBy(key, objects) { | ||
| return objects.reduce((map, object) => { | ||
| const value = object[key] + ''; |
There was a problem hiding this comment.
actually I should revert that.
| if (!data) { | ||
| return []; | ||
| } | ||
| return [...new Set(Object.keys(data).reduce((memo, key) => { |
src/Routers/PushRouter.js
Outdated
| }); | ||
| }).catch((err) => { | ||
| req.config.loggerController.error(err); | ||
| }); |
There was a problem hiding this comment.
could just .catch(req.config.loggerController.error)?
acinader
left a comment
There was a problem hiding this comment.
found a typo in a comment.
spec/PushWorker.spec.js
Outdated
| }); | ||
| }); | ||
|
|
||
| it('should properly handle defaut cases', () => { |
There was a problem hiding this comment.
defaut is a typo. Should be default.
src/Push/utils.js
Outdated
| if (added) { | ||
| return; | ||
| } | ||
| if (installation.localeIdentifier && installation.localeIdentifier.indexOf(locale) == 0) { |
|
Thanks for the quick review @acinader ! |
|
Is this somehow compatible with the "notification" field in the FCM/Android payload? I'd like to easily send localized push notifications to that platform as well. |
|
Yes, it’s 100% compatible with android. |
proper locale on the push body based on the installation
ex:
I'll need to update the docs accordingly, with that feature, we'll be able to restore those in the dashboard as well, being able to add localized alerts etc...