Skip to content

Commit 0d3322d

Browse files
authored
Merge branch 'develop' into feature/getVariableCategoryName
2 parents c1e056f + 471a1c8 commit 0d3322d

14 files changed

+675
-382
lines changed

.idea/dictionaries/m.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 337 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"cordova-plugin-appsettings": "1.0.2",
1616
"cordova-plugin-datepicker": "0.9.3",
1717
"cordova-plugin-device": "2.0.3",
18-
"cordova-plugin-inappbrowser": "3.2.0",
18+
"cordova-plugin-inappbrowser": "4.0.0",
1919
"cordova-plugin-inapppurchase": "1.2.0",
20-
"cordova-plugin-splashscreen": "5.0.3",
20+
"cordova-plugin-splashscreen": "5.0.4",
2121
"cordova-plugin-statusbar": "2.4.3",
2222
"cordova-plugin-whitelist": "1.3.4",
2323
"cordova-plugin-x-socialsharing": "5.6.8",
@@ -36,7 +36,7 @@
3636
"bugsnag": "2.4.3",
3737
"bugsnag-sourcemaps": "1.3.0",
3838
"cordova-android": "8.1.0",
39-
"cordova-ios": "5.1.1",
39+
"cordova-ios": "6.0.0",
4040
"cordova-plugin-compat": "1.2.0",
4141
"cordova-plugin-drawoverapps": "git+https://github.com/mikepsinn/cordova-plugin-drawoverapps.git#37813e845f8309edc339d847b0ea653032b8f748",
4242
"cordova-plugin-googleplus": "8.4.0",
@@ -83,7 +83,7 @@
8383
"gulp-util": "3.0.8",
8484
"gulp-watch": "5.0.1",
8585
"gulp-zip": "5.0.1",
86-
"inquirer": "7.1.0",
86+
"inquirer": "7.2.0",
8787
"ionic": "2.2.3",
8888
"jshint": "2.11.0",
8989
"lazypipe": "1.0.2",

src/js/controllers/appCtrl.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,7 @@ angular.module('starter')// Parent Controller - This controller runs before ever
317317
});
318318
}
319319
if(index === 3){
320-
qmService.goToState('app.historyAllVariable', {
321-
variableObject: variableObject,
322-
variableName: variableObject.name
323-
});
320+
qmService.goToState('app.historyAllVariable', {variableObject: variableObject});
324321
}
325322
if(index === 4){
326323
qmService.goToVariableSettingsByName(favorite.variableName);

src/js/controllers/historyAllMeasurementsCtrl.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -311,22 +311,13 @@ angular.module('starter').controller('historyAllMeasurementsCtrl', ["$scope", "$
311311
$scope.editMeasurement($scope.state.measurement);
312312
}
313313
if(index === 1){
314-
qmService.goToState('app.reminderAdd', {
315-
variableObject: variableObject,
316-
variableName: variableObject.name
317-
});
314+
qmService.goToState('app.reminderAdd', {variableObject: variableObject});
318315
}
319316
if(index === 2){
320-
qmService.goToState('app.charts', {
321-
variableObject: variableObject,
322-
variableName: variableObject.name
323-
});
317+
qmService.goToState('app.charts', {variableObject: variableObject});
324318
}
325319
if(index === 3){
326-
qmService.goToState('app.historyAllVariable', {
327-
variableObject: variableObject,
328-
variableName: variableObject.name
329-
});
320+
qmService.goToState('app.historyAllVariable', {variableObject: variableObject});
330321
}
331322
if(index === 4){
332323
qmService.goToVariableSettingsByName($scope.state.measurement.variableName);

src/js/controllers/reminderAddCtrl.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,8 @@ angular.module('starter').controller('ReminderAddCtrl', ["$scope", "$state", "$s
461461
if($scope.state.variableCategoryObject.defaultValuePlaceholderText){
462462
$scope.state.defaultValuePlaceholderText = $scope.state.variableCategoryObject.defaultValuePlaceholderText;
463463
}
464-
r = $scope.state.trackingReminder = qmService.addVariableCategoryImagePaths(r);
464+
qm.api.addVariableCategoryAndUnit(r)
465+
$scope.state.trackingReminder = r;
465466
showMoreUnitsIfNecessary();
466467
setHideDefaultValueField();
467468
};

src/js/controllers/remindersInboxCtrl.js

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
88
qmLog.debug('Loading ' + $scope.controller_name);
99
qmService.navBar.setFilterBarSearchIcon(false);
1010
$scope.state = {
11-
maximumNotificationsToDisplay: 20,
11+
maximumNotificationsToDisplay: 10, // I think more might slow it down?
1212
showMeasurementBox: false,
1313
selectedReminder: false,
1414
reminderDefaultValue: "",
@@ -186,8 +186,9 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
186186
trackingReminderNotification.modifiedValue = trackingReminderNotification.total;
187187
var lastAction = 'Recorded ' + trackingReminderNotification.modifiedValue + ' ' + trackingReminderNotification.unitAbbreviatedName;
188188
qm.notifications.lastAction = qm.stringHelper.formatValueUnitDisplayText(lastAction) + ' for '+trackingReminderNotification.variableName;
189-
notificationAction(trackingReminderNotification);
190-
qm.notifications.trackNotification(trackingReminderNotification);
189+
notificationAction(trackingReminderNotification, function (params) {
190+
qm.notifications.trackNotification(params);
191+
});
191192
refreshIfRunningOutOfNotifications();
192193
};
193194
function getFavorites(){
@@ -235,18 +236,31 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
235236
});
236237
}
237238
};
238-
var notificationAction = function(trackingReminderNotification){
239-
trackingReminderNotification = qmService.notifications.handleNotificationAction(trackingReminderNotification,
240-
getTrackingReminderNotifications);
239+
var notificationAction = function(n, cb){
240+
qmLog.info("Clicked " + qm.notifications.lastAction + " for " + n.variableName);
241+
n.hide = true;
242+
qm.notifications.numberOfPendingNotifications--;
243+
qmService.notifications.undo = false
244+
qmService.showToastWithButton(qm.notifications.lastAction, 'UNDO', function(){
245+
qmService.notifications.undo = true
246+
});
247+
if(!n.trackingReminderNotificationId){n.trackingReminderNotificationId = n.id;}
241248
$scope.state.numberOfDisplayedNotifications--;
242249
if($state.current.name === "app.remindersInboxCompact"){
243-
if(!$scope.state.numberOfDisplayedNotifications){
244-
window.close();
245-
}
250+
if(!$scope.state.numberOfDisplayedNotifications){window.close();}
246251
$scope.trackingReminderNotifications.shift();
247252
}
253+
setTimeout(function () {
254+
if(qmService.notifications.undo){
255+
n.hide = false;
256+
getTrackingReminderNotifications();
257+
qmService.notifications.undo = false;
258+
} else{
259+
cb(n);
260+
}
261+
}, 5000)
248262
closeWindowIfNecessary();
249-
return trackingReminderNotification;
263+
return n;
250264
};
251265
$scope.track = function(notification, value, $event){
252266
if(isGhostClick($event)){return false;}
@@ -255,9 +269,10 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
255269
var variableName = notification.variableName;
256270
valueUnit = qm.stringHelper.formatValueUnitDisplayText(valueUnit);
257271
qm.notifications.lastAction = 'Recorded ' + valueUnit + ' for '+ variableName;
258-
var body = notificationAction(notification);
259-
if(value !== null){body.modifiedValue = value;}
260-
qm.notifications.trackNotification(body);
272+
notificationAction(notification, function (params) {
273+
if(value !== null){params.modifiedValue = value;}
274+
qm.notifications.trackNotification(params);
275+
});
261276
refreshIfRunningOutOfNotifications();
262277
if($scope.state.showTrackAllButtons){
263278
qm.toast.showQuestionToast('Want to record ' + valueUnit + " for ALL remaining " + variableName + " notifications?",
@@ -270,9 +285,10 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
270285
notification.modifiedValue = value;
271286
var lastAction = 'Recorded ' + value + ' ' + notification.unitAbbreviatedName;
272287
qm.notifications.lastAction = qm.stringHelper.formatValueUnitDisplayText(lastAction) + ' for all '+notification.variableName;
273-
var body = notificationAction(notification);
274-
qmService.notifications.trackAll(body, value, ev);
275-
getTrackingReminderNotifications();
288+
notificationAction(notification, function (params) {
289+
qmService.notifications.trackAll(params, value, ev);
290+
getTrackingReminderNotifications();
291+
});
276292
}
277293
$scope.trackAllWithConfirmation = function(trackingReminderNotification, modifiedReminderValue, ev){
278294
qm.ui.preventDragAfterAlert(ev);
@@ -291,18 +307,18 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
291307
return;
292308
}
293309
qm.notifications.lastAction = 'Skipped '+trackingReminderNotification.variableName;
294-
var params = notificationAction(trackingReminderNotification);
295-
qm.notifications.skip(params);
296-
qmService.logEventToGA(qm.analytics.eventCategories.inbox, "skip");
310+
notificationAction(trackingReminderNotification, function (params) {
311+
qm.notifications.skip(params);
312+
qmService.logEventToGA(qm.analytics.eventCategories.inbox, "skip");
313+
});
297314
refreshIfRunningOutOfNotifications();
298315
};
299316
$scope.snooze = function(trackingReminderNotification, $event){
300-
if(isGhostClick($event)){
301-
return;
302-
}
317+
if(isGhostClick($event)){return;}
303318
qm.notifications.lastAction = 'Snoozed '+trackingReminderNotification.variableName;
304-
var params = notificationAction(trackingReminderNotification);
305-
qm.notifications.snoozeNotification(params);
319+
notificationAction(trackingReminderNotification, function (params) {
320+
qm.notifications.snoozeNotification(params);
321+
});
306322
qmService.logEventToGA(qm.analytics.eventCategories.inbox, "snooze");
307323
refreshIfRunningOutOfNotifications();
308324
};

0 commit comments

Comments
 (0)