Skip to content

Commit 8ac6650

Browse files
authored
Merge pull request #4570 from QuantiModo/feature/caught-up-card
2 parents b3b9028 + 7552eb6 commit 8ac6650

File tree

4 files changed

+117
-43
lines changed

4 files changed

+117
-43
lines changed

src/js/controllers/remindersInboxCtrl.js

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,48 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
2828
numberOfDisplayedNotifications: 0,
2929
favoritesTitle: "Your Favorites",
3030
studiesResponse: null,
31-
title: "Inbox"
31+
title: "Inbox",
32+
caughtUpCard: {
33+
"id": "importDataPage",
34+
"title": "All Caught Up!",
35+
"color": {
36+
"backgroundColor": "#f09402",
37+
"circleColor": "#fab952"
38+
},
39+
"image": {
40+
"url": "https://lh3.googleusercontent.com/pw/AM-JKLWOJ1Mj_5QbVOciDBFTYFLlZ-MYEUfECRTZ2PLBQbwyI-Ct28t9Mqv4mPa6FcgYsD2yBLD9I21CSoG5GatCBaugNh9BlyM5ALX1-qvu8rydGNnJTaaDcOxPV1HPCrdSGtg5aifZI_SXzAScJ9ro6YN1hw=s512-no?authuser=0"
41+
},
42+
"premiumFeature": true,
43+
"bodyText": "Great Job!",
44+
"nextPageButtonText": "Maybe Later",
45+
"buttons": [{
46+
"id": "reminderButton",
47+
"buttonText": "Add a Reminder",
48+
"buttonClass": "button button-clear button-positive ion-bell",
49+
"goToState": "app.reminderSearch"
50+
},{
51+
"id": "measurementButton",
52+
"buttonText": "Record a measurement",
53+
"buttonClass": "button button-clear button-positive ion-edit",
54+
"goToState": "app.measurementSearch"
55+
},{
56+
"id": "importButton",
57+
"buttonText": "Import Your Data",
58+
"buttonClass": "button button-clear button-positive ion-checkmark",
59+
"goToState": "app.import"
60+
},{
61+
"id": "studiesButton",
62+
"buttonText": "Discoveries",
63+
"buttonClass": "button button-clear button-positive ion-book",
64+
"goToState": "app.studies"
65+
},{
66+
"id": "chartsButton",
67+
"buttonText": "Charts",
68+
"buttonClass": "button button-clear button-positive ion-chart",
69+
"goToState": "app.charts"
70+
}],
71+
"$$hashKey": "object:1200"
72+
}
3273
};
3374
//createWordCloudFromNotes();
3475
$scope.$on('$ionicView.beforeEnter', function(e){
@@ -54,20 +95,20 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
5495
qmService.rootScope.setProperty('bloodPressure', {displayTotal: "Blood Pressure"});
5596
$scope.stateParams = $stateParams;
5697
qmService.actionSheet.setDefaultActionSheet(function(){
57-
$scope.syncNotifications();
98+
$scope.syncNotifications({}, "action button clicked");
5899
}, getVariableCategoryName());
59100
qmService.splash.hideSplashScreen();
60101
});
61102
$scope.$on('$ionicView.afterEnter', function(){
62103
qmLog.info('RemindersInboxCtrl afterEnter: ' + window.location.href);
63104
setPageTitle(); // Setting title afterEnter doesn't fix cutoff on Android
64105
if(needToRefresh()){
65-
$scope.syncNotifications();
106+
$scope.syncNotifications({}, '$ionicView.afterEnter and needToRefresh()');
66107
}
67108
if($rootScope.platform.isWeb){
68109
qm.webNotifications.registerServiceWorker();
69110
}
70-
autoRefresh();
111+
scheduleAutoRefresh();
71112
});
72113
$scope.$on('$ionicView.beforeLeave', function(){
73114
qmLog.debug('RemindersInboxCtrl beforeLeave');
@@ -96,13 +137,16 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
96137
if(qm.notifications.mostRecentNotificationIsOlderThanMostFrequentInterval()){return true;}
97138
return false;
98139
}
99-
function autoRefresh(){
140+
function scheduleAutoRefresh(){
141+
var minutes = 30;
142+
qmLog.debug("Scheduling auto-refresh every "+minutes+" minutes")
100143
$timeout(function(){
101144
if($state.current.name.toLowerCase().indexOf('inbox') !== -1){
102-
$scope.syncNotifications();
103-
autoRefresh();
145+
qmLog.debug("Auto-refreshing because "+minutes+" minutes has passed and we're in the inbox")
146+
$scope.syncNotifications('autoRefresh');
147+
scheduleAutoRefresh();
104148
}
105-
}, 30 * 60 * 1000);
149+
}, minutes * 60 * 1000);
106150
}
107151
var setPageTitle = function(){
108152
if(getVariableCategoryName() === 'Treatments'){
@@ -140,7 +184,7 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
140184
if(moreNotificationsInStorage()){
141185
addLocalNotificationsToScope('refreshIfRunningOutOfNotifications');
142186
}else{
143-
$scope.syncNotifications();
187+
$scope.syncNotifications('refreshIfRunningOutOfNotifications said getNumberOfDisplayedNotifications < 2 and !moreNotificationsInStorage');
144188
}
145189
}
146190
}
@@ -231,7 +275,7 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
231275
}
232276
var closeWindowIfNecessary = function(){
233277
if($state.current.name === "app.remindersInboxCompact" && !getNumberOfDisplayedNotifications()){
234-
$scope.syncNotifications();
278+
$scope.syncNotifications('closeWindowIfNecessary and !getNumberOfDisplayedNotifications()');
235279
window.close();
236280
}
237281
};

src/templates/fragments/help-info-card-fragment.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
style="background-color: #2E294E; padding-left: 0; padding-right: 0">
44
<span style="position: absolute; top: 15px; left: 15px; font-size: 36px; max-width: 40px; max-height: 40px; width: 100%; border-radius: 4px;">
55
<i ng-if="helpCard.icon" class="icon balanced {{helpCard.icon}}"></i>
6-
<img style="max-width: 40px; max-height: 40px;" ng-if="helpCard.image.url" ng-src="{{helpCard.image.url}}">
6+
<img style="max-width: 40px; max-height: 40px;"
7+
ng-if="helpCard.image.url"
8+
ng-src="{{helpCard.image.url}}">
79
</span>
810
<span style="text-align: center; height: 40px; line-height: 40px; white-space: nowrap; font-family: 'Open Sans', sans-serif;">
911
<p ng-if="!platform.isMobile" style="font-size: 24px; color: white; ">{{helpCard.title}}</p>

src/templates/reminders-inbox.html

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@
33
<ion-content scroll="true" overflow-scroll="true">
44
<!--<ion-content style="background-color: #f2f2f2" ng-class="{ isBrowserView : platform.isWeb == true } "> This breaks pull down to refresh in browser-->
55
<ion-refresher on-refresh="syncNotifications({noCache: true})"></ion-refresher>
6-
<div id="aboveAverageWords"
7-
ng-if="words && state.numberOfDisplayedNotifications === 0">
8-
<word-cloud words="words.aboveAverageWords" width="width" height="height" padding="10"
9-
on-click="wordClicked"></word-cloud>
10-
</div>
11-
<div id="belowAverageWords" ng-if="words">
12-
<word-cloud words="words.belowAverageWords" width="width" height="height" padding="10"
13-
on-click="wordClicked"></word-cloud>
14-
</div>
156
<div ng-if="stateParams.showHelpCards === true && defaultHelpCards && defaultHelpCards[0]">
167
<div ng-repeat="helpCard in defaultHelpCards | limitTo:1">
178
<div ng-include="'templates/fragments/help-info-card-fragment.html'"></div>
@@ -37,7 +28,7 @@
3728
class="item item-divider">
3829
{{divider.name}}
3930
<a style="float: right; margin: 5px; cursor: pointer;"
40-
ng-click="syncNotifications({noCache: true})">
31+
ng-click="syncNotifications({noCache: true}, 'button clicked')">
4132
<i class="icon ion-refresh">&nbsp;Refresh</i>
4233
</a>
4334
</div>
@@ -52,64 +43,92 @@
5243
</div>
5344
</div>
5445
</div>
46+
<div id="allCaughtUpCard2"
47+
ng-if="!state.loading && state.numberOfDisplayedNotifications === 0"
48+
ng-repeat="helpCard in [state.caughtUpCard] | limitTo:1">
49+
<div ng-include="'templates/fragments/help-info-card-fragment.html'"></div>
50+
</div>
5551
<div id="allCaughtUpCard"
5652
class="list card"
5753
ng-if="!state.loading && state.numberOfDisplayedNotifications === 0">
5854
<div class="item" style="padding-bottom:10px;">
59-
<p style=" text-align: center; line-height: normal; font-size: 25px;">All caught up!</p>
55+
<p style=" text-align: center; line-height: normal; font-size: 25px;">
56+
All caught up!
57+
</p>
6058
<div class="row">
61-
<div class="col" style="padding-top: 0px;"><i style="text-align: center; font-size: 60px;"
62-
class="icon positive ion-android-sunny"></i></div>
63-
<div class="col col-75"><h2 style="white-space: normal; text-align: justify; line-height: normal; ">
64-
Maybe you should refresh or add some more reminders? </h2></div>
59+
<div class="col" style="padding-top: 0px;">
60+
<i style="text-align: center; font-size: 60px;" class="icon positive ion-android-sunny">
61+
</i>
62+
</div>
6563
</div>
6664
<div class="row">
6765
<div class="button-bar">
68-
<button class="button button-clear button-balanced" style="font-size: 14px;"
69-
ng-click="goToState('app.reminderSearch')"><i class="ion-android-notifications"> &nbsp;
70-
Add a reminder &nbsp;</i></button>
66+
<button class="text-pink-500 bg-transparent border border-solid border-pink-500 hover:bg-pink-500 hover:text-white active:bg-pink-600 font-bold uppercase px-8 py-3 rounded-full outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150"
67+
style="font-size: 14px;"
68+
ng-click="goToState('app.reminderSearch')">
69+
<i class="ion-android-notifications"> &nbsp;
70+
Add a reminder &nbsp;
71+
</i>
72+
</button>
7173
</div>
7274
</div>
7375
<div class="row">
7476
<div class="button-bar">
7577
<button class="button button-clear button-royal" style="font-size: 14px;"
76-
ng-click="goToState('app.measurementAddSearch')"><i class="ion-compose"> &nbsp; Record a
77-
measurement &nbsp;</i></button>
78+
ng-click="goToState('app.measurementAddSearch')">
79+
<i class="ion-compose">
80+
&nbsp; Record a
81+
measurement &nbsp;
82+
</i>
83+
</button>
7884
</div>
7985
</div>
8086
<div class="row">
8187
<div class="button-bar">
8288
<button class="button button-clear button-calm" style="font-size: 14px;"
83-
ng-click="goToState('app.historyAll')"><i class="ion-ios-list-outline"> &nbsp; History
84-
&nbsp;</i></button>
89+
ng-click="goToState('app.historyAll')">
90+
<i class="ion-ios-list-outline">
91+
&nbsp; History
92+
&nbsp;</i>
93+
</button>
8594
</div>
8695
</div>
8796
<div class="row">
8897
<div class="button-bar">
89-
<button class="button button-clear button-balanced" style="font-size: 14px;"
90-
ng-click="syncNotifications({noCache: true})"><i class="ion-refresh"> &nbsp; Refresh
91-
&nbsp;</i></button>
98+
<button class="button button-clear button-balanced"
99+
style="font-size: 14px;"
100+
ng-click="syncNotifications({noCache: true}, 'button clicked')">
101+
<i class="ion-refresh">
102+
&nbsp; Refresh
103+
&nbsp;</i>
104+
</button>
92105
</div>
93106
</div>
94107
</div>
95108
</div>
96-
<div id="Favorites"
97-
class="list card"
98-
ng-if="state.favoritesArray && state.favoritesArray.length && state.numberOfDisplayedNotifications === 0">
99-
<div class="item item-divider" style="">{{state.favoritesTitle}}</div>
100-
<div ng-include="'templates/fragments/blood-pressure-favorite-fragment.html'"></div>
101-
<div ng-include="'templates/fragments/favorites-list-fragment.html'"></div>
109+
<div id="word-cloud"
110+
ng-if="words && state.numberOfDisplayedNotifications === 0"
111+
ng-include="'templates/word-cloud.html'">
102112
</div>
103113
<div id="studies-container"
104114
ng-if="state.studiesResponse.studies && state.studiesResponse.studies.length && state.numberOfDisplayedNotifications === 0"
105115
class="list card">
106116
<div ng-include="'templates/fragments/studies-list-fragment.html'"></div>
107117
<div class="button-bar">
108118
<a class="button button-clear button-positive" ng-click="goToState('app.predictorSearch')"
109-
style="text-overflow: clip;"><i class="ion-search"> More Discoveries</i></a>
119+
style="text-overflow: clip;">
120+
<i class="ion-search"> More Discoveries</i>
121+
</a>
110122
</div>
111123
<br>
112124
</div>
125+
<div id="Favorites"
126+
class="list card"
127+
ng-if="state.favoritesArray && state.favoritesArray.length && state.numberOfDisplayedNotifications === 0">
128+
<div class="item item-divider" style="">{{state.favoritesTitle}}</div>
129+
<div ng-include="'templates/fragments/blood-pressure-favorite-fragment.html'"></div>
130+
<div ng-include="'templates/fragments/favorites-list-fragment.html'"></div>
131+
</div>
113132
<div id="charts-container"
114133
ng-if="state.variableObject.charts && state.numberOfDisplayedNotifications === 0"
115134
ng-include="'templates/fragments/charts-fragment.html'"></div>

src/templates/word-cloud.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<div id="aboveAverageWords"
2+
ng-if="words && state.numberOfDisplayedNotifications === 0">
3+
<word-cloud words="words.aboveAverageWords" width="width" height="height" padding="10"
4+
on-click="wordClicked"></word-cloud>
5+
</div>
6+
<div id="belowAverageWords" ng-if="words">
7+
<word-cloud words="words.belowAverageWords" width="width" height="height" padding="10"
8+
on-click="wordClicked"></word-cloud>
9+
</div>

0 commit comments

Comments
 (0)