@@ -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 } ;
0 commit comments