Skip to content

Adds interface for localized push notifications #769

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

Merged
merged 6 commits into from
Oct 26, 2017
Merged

Conversation

flovilmart
Copy link
Contributor

@flovilmart flovilmart commented Sep 1, 2017

  • This is somewhat different from parse.com and probably more efficient

See also: parse-community/parse-server#4130

@flovilmart
Copy link
Contributor Author

@acinader can you have a look on this one?

@flovilmart flovilmart requested a review from acinader October 26, 2017 18:26
README.md Outdated
@@ -282,6 +282,26 @@ When `user1` logs in, he/she will be able to manage `myAppId1` and `myAppId2` fr

When *`user2`* logs in, he/she will only be able to manage *`myAppId1`* from the dashboard.

## Configuring Localized Push Notifications

With the latest version of the dashboard, it is possible to send localized messages for push notifications.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make dashboard a link. for bonus points make push notifications a link to doc too ;)

return false;
}
return true;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.filter(locale => !(locale === '' || locale === undefined))

(since you kept the one in the dashboard ;))

const available = this.context.currentApp.isLocalizationAvailable();
if (available) {
const locales = this.context.currentApp.fetchPushLocales();
let filteredLocales = locales.filter((locale) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer const? or am I missing where it gets edited?

@@ -202,6 +195,13 @@ export default class PushNew extends DashboardView {
payload.badge = "Increment";
}

// Gather the translations, and inject into the payload
Object.keys(changes).forEach((key) => {
if (key.indexOf('translation[') === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a comment showing the string we're operating on here please.

@@ -404,13 +406,11 @@ export default class ParseApp {
}

isLocalizationAvailable() {
let path = '/apps/' + this.slug + '/is_localization_available';
return AJAX.abortableGet(path);
return this.serverInfo.features.push.localization === true;
Copy link
Contributor

@acinader acinader Oct 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as written, this is exactly the same as just
return this.serverInfo.features.push.localization
it's like boolean day or something ;)

if this.serverInfo.features.push.localization might just be truthy instead of actual true then === wont work and you'd want return !!this.serverInfo.features.push.localization instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right :)

Copy link
Contributor

@acinader acinader Oct 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- This is somewhat different from parse.com and probably more efficient
@flovilmart
Copy link
Contributor Author

@acinader adressed the nits + merge conflicts.

// Gather the translations, and inject into the payload
Object.keys(changes).forEach((key) => {
// translations are stored as `tranlation[lang]` strings as keys,
// this is why we slice it this way
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear. thanks...just thinking out loud, not asking for change....

const needle = 'translation[';
if (key.indexOf(needle) === 0) {
  const locale = key.slice(needle.length, key.length - 1);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eheh, if you need a comment, many others may need a comment. it's better with it than without.

Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm (assuming tests pass of course.)

@flovilmart
Copy link
Contributor Author

Looks like I broke master by merging #709

@flovilmart flovilmart merged commit 618ba05 into master Oct 26, 2017
@flovilmart flovilmart deleted the localized-push branch October 26, 2017 19:37
flovilmart added a commit that referenced this pull request Oct 27, 2017
* Adds interface for localized push notifications

- This is somewhat different from parse.com and probably more efficient

* Fix lint issues

* nits

* nit

* fixes compile issues

* cache node_modules
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.

2 participants