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

Allow SNS Adapter to send to a topic #2444

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ node_modules
.vscode

# Babel.js
lib/
lib
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove that change


# cache folder
.cache
Expand Down
9 changes: 9 additions & 0 deletions src/Controllers/PushController.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export class PushController extends AdaptableController {
let updateWhere = deepcopy(where);

badgeUpdate = () => {
if (updateWhere.arn){
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the badge update skipped in that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@flovilmart this could be improved in the future, and as fair as I know, when sending bulk PN via Topic with SNS, it is not possible to increment the badge, otherwise you need to go through all installations and Endpoints again, which can lead to high memory usage. We still able to send bulk PN and increment the badge if we want by passing the Installation Query

return;
}
updateWhere.deviceType = 'ios';
// Build a real RestQuery so we can use it in RestWrite
let restQuery = new RestQuery(config, master(config), '_Installation', updateWhere);
Expand All @@ -88,6 +91,12 @@ export class PushController extends AdaptableController {
onPushStatusSaved(pushStatus.objectId);
return badgeUpdate();
}).then(() => {
if (this.adapter.snsConfig && where.arn){
body.data.badge = null // skip badge increment by bulk push send
return {
results : where
}
}
return rest.find(config, auth, '_Installation', where);
}).then((response) => {
if (!response.results) {
Expand Down