Skip to content

Commit 3059086

Browse files
committed
Makes sure we track it all correctly
1 parent 4a9bc7d commit 3059086

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Push/PushWorker.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,13 @@ export class PushWorker {
5656
if (results.length == 0) {
5757
return;
5858
}
59-
return this.sendToAdapter(body, results, pushStatus, config);
59+
return this.sendToAdapter(body, results, pushStatus, config, UTCOffset);
6060
}, err => {
6161
throw err;
62-
}).then((results) => {
63-
return pushStatus.trackSent(results, UTCOffset);
6462
});
6563
}
6664

67-
sendToAdapter(body: any, installations: any[], pushStatus: any, config: Config): Promise<*> {
65+
sendToAdapter(body: any, installations: any[], pushStatus: any, config: Config, UTCOffset: ?any): Promise<*> {
6866
pushStatus = pushStatusHandler(config, pushStatus.objectId);
6967
// Check if we have locales in the push body
7068
const locales = utils.getLocalesFromPush(body);
@@ -77,14 +75,16 @@ export class PushWorker {
7775
const promises = Object.keys(grouppedInstallations).map((locale) => {
7876
const installations = grouppedInstallations[locale];
7977
const body = bodiesPerLocales[locale];
80-
return this.sendToAdapter(body, installations, pushStatus, config);
78+
return this.sendToAdapter(body, installations, pushStatus, config, UTCOffset);
8179
});
8280
return Promise.all(promises);
8381
}
8482

8583
if (!utils.isPushIncrementing(body)) {
8684
logger.verbose(`Sending push to ${installations.length}`);
87-
return this.adapter.send(body, installations, pushStatus.objectId);
85+
return this.adapter.send(body, installations, pushStatus.objectId).then((results) => {
86+
return pushStatus.trackSent(results, UTCOffset).then(() => results);
87+
});
8888
}
8989

9090
// Collect the badges to reduce the # of calls
@@ -95,7 +95,7 @@ export class PushWorker {
9595
const payload = deepcopy(body);
9696
payload.data.badge = parseInt(badge);
9797
const installations = badgeInstallationsMap[badge];
98-
return this.sendToAdapter(payload, installations, pushStatus, config);
98+
return this.sendToAdapter(payload, installations, pushStatus, config, UTCOffset);
9999
});
100100
return Promise.all(promises);
101101
}

0 commit comments

Comments
 (0)