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

Proposal for tracking Pushes #2917

Closed
wants to merge 7 commits into from
Closed
Changes from 2 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
18 changes: 17 additions & 1 deletion src/Controllers/PushController.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,33 @@ export class PushController extends AdaptableController {
if (!response.results) {
return Promise.reject({error: 'PushController: no results in query'})
}
return response;
}).then((response) => {
return this.starTracking(response.results, pushStatus);
}).then((response) => {
pushStatus.setRunning(response.results);
return this.sendToAdapter(body, response.results, pushStatus, config);
}).then((results) => {
return pushStatus.complete(results);
return pushStatus.complete(results).then(() => {
return updateTracking(response.results, results, pushStatus);
Copy link
Contributor

Choose a reason for hiding this comment

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

Response don't exist here...

Copy link
Author

Choose a reason for hiding this comment

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

Agreed. It'd need to be refactored.

};
}).catch((err) => {
return pushStatus.fail(err).then(() => {
throw err;
});
});
}

startTracking(installations, pushStatus) {
// todo: insert a Push object per installation, with timestamp, and pushStatus.objectId
return Promise.resolve();
}

updateTracking(installations, pushStatus, results) {
// todo, find and update each of the Push objects with their result
return Promise.resolve();
}

sendToAdapter(body, installations, pushStatus, config) {
if (body.data && body.data.badge && typeof body.data.badge == 'string' && body.data.badge.toLowerCase() == "increment") {
// Collect the badges to reduce the # of calls
Expand Down