Skip to content

Commit 7760f5f

Browse files
committed
qm.notifications.syncTrackingReminderNotifications
1 parent 0c57583 commit 7760f5f

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/js/controllers/appCtrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ angular.module('starter')// Parent Controller - This controller runs before ever
1414
});
1515
$scope.$on('$ionicView.afterEnter', function(e){
1616
qmLog.debug($scope.controller_name + ".afterEnter so posting queued notifications if any");
17-
qm.notifications.post();
17+
qmService.syncTrackingReminderNotifications();
1818
qmService.refreshUserUsingAccessTokenInUrlIfNecessary();
1919
$rootScope.setMicAndSpeechEnabled(qm.mic.getMicEnabled());
2020
qm.chatButton.setZohoChatButtonZIndex();

src/js/controllers/remindersInboxCtrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
7777
});
7878
$scope.$on('$ionicView.beforeLeave', function(){
7979
qmLog.debug('RemindersInboxCtrl beforeLeave');
80-
qm.notifications.post();
80+
qmService.syncTrackingReminderNotifications();
8181
});
8282
$scope.$on('$ionicView.afterLeave', function(){
8383
qmLog.debug('RemindersInboxCtrl afterLeave');

src/js/popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ document.addEventListener('DOMContentLoaded', function(){
312312
}else{
313313
qmLog.pushDebug("popup addEventListener: Calling hidePopup...");
314314
hidePopup();
315-
qm.notifications.post(updateQuestion, qm.notifications.closePopup);
315+
qm.notifications.syncTrackingReminderNotifications(updateQuestion, qm.notifications.closePopup);
316316
}
317317
qmLog.pushDebug("popup addEventListener: calling setFaceButtonListeners...");
318318
setFaceButtonListeners();

src/js/qmHelpers.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5517,7 +5517,7 @@ var qm = {
55175517
refreshIfEmpty: function(successHandler, errorHandler){
55185518
if(!qm.notifications.getNumberInGlobalsOrLocalStorage()){
55195519
qm.qmLog.info('No notifications in local storage');
5520-
qm.notifications.post(successHandler, errorHandler);
5520+
qm.notifications.syncTrackingReminderNotifications(successHandler, errorHandler);
55215521
return true;
55225522
}
55235523
qm.qmLog.info(qm.notifications.getNumberInGlobalsOrLocalStorage() + ' notifications in local storage');
@@ -5528,7 +5528,7 @@ var qm = {
55285528
qm.qmLog.info("qm.notifications.refreshIfEmptyOrStale");
55295529
if(!qm.notifications.getNumberInGlobalsOrLocalStorage() || qm.notifications.getSecondsSinceLastNotificationsRefresh() > 3600){
55305530
qm.qmLog.info('Refreshing notifications because empty or last refresh was more than an hour ago');
5531-
qm.notifications.post(callback);
5531+
qm.notifications.syncTrackingReminderNotifications(callback);
55325532
}else{
55335533
qm.qmLog.info('Not refreshing notifications because last refresh was last than an hour ago and we have notifications in local storage');
55345534
if(callback){
@@ -5620,7 +5620,7 @@ var qm = {
56205620
}else{
56215621
console.info('No rating notifications for popup');
56225622
qm.notifications.getLastNotificationsRefreshTime();
5623-
qm.notifications.post();
5623+
qm.notifications.syncTrackingReminderNotifications();
56245624
return null;
56255625
}
56265626
},
@@ -5629,7 +5629,7 @@ var qm = {
56295629
},
56305630
promise: null,
56315631
refreshAndShowPopupIfNecessary: function(notificationParams){
5632-
qm.notifications.post(function(response){
5632+
qm.notifications.syncTrackingReminderNotifications(function(response){
56335633
var uniqueNotification = qm.notifications.getMostRecentUniqueNotificationNotInSyncQueue();
56345634
function objectLength(obj){
56355635
var result = 0;
@@ -5747,7 +5747,7 @@ var qm = {
57475747
if(!successHandler){
57485748
return null;
57495749
}
5750-
qm.notifications.post(function(response){
5750+
qm.notifications.syncTrackingReminderNotifications(function(response){
57515751
var notification = qm.notifications.getMostRecentNotification();
57525752
if(notification){
57535753
successHandler(notification);
@@ -5759,7 +5759,7 @@ var qm = {
57595759
schedulePost: function(delayInMilliseconds){
57605760
var queue = qm.storage.getItem(qm.items.notificationsSyncQueue);
57615761
if(queue && queue.length > 10){
5762-
qm.notifications.post();
5762+
qm.notifications.syncTrackingReminderNotifications();
57635763
return;
57645764
}
57655765
if(!delayInMilliseconds){
@@ -5775,7 +5775,7 @@ var qm = {
57755775
}
57765776
setTimeout(function(){
57775777
qm.qmLog.info("Notifications sync countdown completed. Syncing now... ");
5778-
qm.notifications.post();
5778+
qm.notifications.syncTrackingReminderNotifications();
57795779
}, delayInMilliseconds);
57805780
}else{
57815781
if(!qm.platform.isMobile()){ // Better performance
@@ -5804,8 +5804,8 @@ var qm = {
58045804
qm.notifications.deleteByVariableName(n.variableName);
58055805
qm.notifications.addToSyncQueue(n);
58065806
},
5807-
post: function(successHandler, errorHandler){
5808-
qm.qmLog.debug("Called postNotifications...");
5807+
syncTrackingReminderNotifications: function(successHandler, errorHandler){
5808+
qm.qmLog.debug("Called syncTrackingReminderNotifications...");
58095809
var notifications = qm.storage.getItem(qm.items.notificationsSyncQueue);
58105810
qm.storage.removeItem(qm.items.notificationsSyncQueue);
58115811
qm.storage.removeItem(qm.items.trackingReminderNotificationSyncScheduled);

src/js/services/qmService.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2890,12 +2890,12 @@ angular.module('starter').factory('qmService', ["$http", "$q", "$rootScope", "$i
28902890
deferred.reject(error);
28912891
});
28922892
};
2893-
qm.notifications.post(function(){
2893+
qmService.syncTrackingReminderNotifications().then(function(){
28942894
postTrackingRemindersToApiAndHandleResponse();
2895-
}, function(error){
2895+
}, function (err){
28962896
postTrackingRemindersToApiAndHandleResponse();
28972897
deferred.reject(error);
2898-
});
2898+
})
28992899
}else{
29002900
qmLog.info('syncTrackingReminders: trackingReminderSyncQueue empty so just fetching trackingReminders from API', null);
29012901
qm.reminderHelper.getTrackingRemindersFromApi({force: force}, function(reminders){
@@ -5105,7 +5105,7 @@ angular.module('starter').factory('qmService', ["$http", "$q", "$rootScope", "$i
51055105
var deferred = $q.defer();
51065106
if(params && params.noCache){qmService.notificationsPromise = false;}
51075107
if(qmService.notificationsPromise){return qmService.notificationsPromise;}
5108-
qm.notifications.post(function(response){
5108+
qm.notifications.syncTrackingReminderNotifications(function(response){
51095109
var notifications = qm.notifications.getFromGlobalsOrLocalStorage();
51105110
if(notifications.length && $rootScope.platform.isMobile && getDeviceTokenToSync()){qmService.registerDeviceToken();}
51115111
qmService.notifications.broadcastGetTrackingReminderNotifications();

0 commit comments

Comments
 (0)