Skip to content

Commit

Permalink
Merge develop into feature/getFromLocalStorageOrApi
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Aug 27, 2021
2 parents 57f28f2 + 8ac6650 commit 40079b1
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 43 deletions.
64 changes: 54 additions & 10 deletions src/js/controllers/remindersInboxCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,48 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
numberOfDisplayedNotifications: 0,
favoritesTitle: "Your Favorites",
studiesResponse: null,
title: "Inbox"
title: "Inbox",
caughtUpCard: {
"id": "importDataPage",
"title": "All Caught Up!",
"color": {
"backgroundColor": "#f09402",
"circleColor": "#fab952"
},
"image": {
"url": "https://lh3.googleusercontent.com/pw/AM-JKLWOJ1Mj_5QbVOciDBFTYFLlZ-MYEUfECRTZ2PLBQbwyI-Ct28t9Mqv4mPa6FcgYsD2yBLD9I21CSoG5GatCBaugNh9BlyM5ALX1-qvu8rydGNnJTaaDcOxPV1HPCrdSGtg5aifZI_SXzAScJ9ro6YN1hw=s512-no?authuser=0"
},
"premiumFeature": true,
"bodyText": "Great Job!",
"nextPageButtonText": "Maybe Later",
"buttons": [{
"id": "reminderButton",
"buttonText": "Add a Reminder",
"buttonClass": "button button-clear button-positive ion-bell",
"goToState": "app.reminderSearch"
},{
"id": "measurementButton",
"buttonText": "Record a measurement",
"buttonClass": "button button-clear button-positive ion-edit",
"goToState": "app.measurementSearch"
},{
"id": "importButton",
"buttonText": "Import Your Data",
"buttonClass": "button button-clear button-positive ion-checkmark",
"goToState": "app.import"
},{
"id": "studiesButton",
"buttonText": "Discoveries",
"buttonClass": "button button-clear button-positive ion-book",
"goToState": "app.studies"
},{
"id": "chartsButton",
"buttonText": "Charts",
"buttonClass": "button button-clear button-positive ion-chart",
"goToState": "app.charts"
}],
"$$hashKey": "object:1200"
}
};
//createWordCloudFromNotes();
$scope.$on('$ionicView.beforeEnter', function(e){
Expand All @@ -54,20 +95,20 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
qmService.rootScope.setProperty('bloodPressure', {displayTotal: "Blood Pressure"});
$scope.stateParams = $stateParams;
qmService.actionSheet.setDefaultActionSheet(function(){
$scope.syncNotifications();
$scope.syncNotifications({}, "action button clicked");
}, getVariableCategoryName());
qmService.splash.hideSplashScreen();
});
$scope.$on('$ionicView.afterEnter', function(){
qmLog.info('RemindersInboxCtrl afterEnter: ' + window.location.href);
setPageTitle(); // Setting title afterEnter doesn't fix cutoff on Android
if(needToRefresh()){
$scope.syncNotifications();
$scope.syncNotifications({}, '$ionicView.afterEnter and needToRefresh()');
}
if($rootScope.platform.isWeb){
qm.webNotifications.registerServiceWorker();
}
autoRefresh();
scheduleAutoRefresh();
});
$scope.$on('$ionicView.beforeLeave', function(){
qmLog.debug('RemindersInboxCtrl beforeLeave');
Expand Down Expand Up @@ -96,13 +137,16 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
if(qm.notifications.mostRecentNotificationIsOlderThanMostFrequentInterval()){return true;}
return false;
}
function autoRefresh(){
function scheduleAutoRefresh(){
var minutes = 30;
qmLog.debug("Scheduling auto-refresh every "+minutes+" minutes")
$timeout(function(){
if($state.current.name.toLowerCase().indexOf('inbox') !== -1){
$scope.syncNotifications();
autoRefresh();
qmLog.debug("Auto-refreshing because "+minutes+" minutes has passed and we're in the inbox")
$scope.syncNotifications('autoRefresh');
scheduleAutoRefresh();
}
}, 30 * 60 * 1000);
}, minutes * 60 * 1000);
}
var setPageTitle = function(){
if(getVariableCategoryName() === 'Treatments'){
Expand Down Expand Up @@ -140,7 +184,7 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
if(moreNotificationsInStorage()){
addLocalNotificationsToScope('refreshIfRunningOutOfNotifications');
}else{
$scope.syncNotifications();
$scope.syncNotifications('refreshIfRunningOutOfNotifications said getNumberOfDisplayedNotifications < 2 and !moreNotificationsInStorage');
}
}
}
Expand Down Expand Up @@ -231,7 +275,7 @@ angular.module('starter').controller('RemindersInboxCtrl', ["$scope", "$state",
}
var closeWindowIfNecessary = function(){
if($state.current.name === "app.remindersInboxCompact" && !getNumberOfDisplayedNotifications()){
$scope.syncNotifications();
$scope.syncNotifications('closeWindowIfNecessary and !getNumberOfDisplayedNotifications()');
window.close();
}
};
Expand Down
4 changes: 3 additions & 1 deletion src/templates/fragments/help-info-card-fragment.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
style="background-color: #2E294E; padding-left: 0; padding-right: 0">
<span style="position: absolute; top: 15px; left: 15px; font-size: 36px; max-width: 40px; max-height: 40px; width: 100%; border-radius: 4px;">
<i ng-if="helpCard.icon" class="icon balanced {{helpCard.icon}}"></i>
<img style="max-width: 40px; max-height: 40px;" ng-if="helpCard.image.url" ng-src="{{helpCard.image.url}}">
<img style="max-width: 40px; max-height: 40px;"
ng-if="helpCard.image.url"
ng-src="{{helpCard.image.url}}">
</span>
<span style="text-align: center; height: 40px; line-height: 40px; white-space: nowrap; font-family: 'Open Sans', sans-serif;">
<p ng-if="!platform.isMobile" style="font-size: 24px; color: white; ">{{helpCard.title}}</p>
Expand Down
83 changes: 51 additions & 32 deletions src/templates/reminders-inbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
<ion-content scroll="true" overflow-scroll="true">
<!--<ion-content style="background-color: #f2f2f2" ng-class="{ isBrowserView : platform.isWeb == true } "> This breaks pull down to refresh in browser-->
<ion-refresher on-refresh="syncNotifications({noCache: true})"></ion-refresher>
<div id="aboveAverageWords"
ng-if="words && state.numberOfDisplayedNotifications === 0">
<word-cloud words="words.aboveAverageWords" width="width" height="height" padding="10"
on-click="wordClicked"></word-cloud>
</div>
<div id="belowAverageWords" ng-if="words">
<word-cloud words="words.belowAverageWords" width="width" height="height" padding="10"
on-click="wordClicked"></word-cloud>
</div>
<div ng-if="stateParams.showHelpCards === true && defaultHelpCards && defaultHelpCards[0]">
<div ng-repeat="helpCard in defaultHelpCards | limitTo:1">
<div ng-include="'templates/fragments/help-info-card-fragment.html'"></div>
Expand All @@ -37,7 +28,7 @@
class="item item-divider">
{{divider.name}}
<a style="float: right; margin: 5px; cursor: pointer;"
ng-click="syncNotifications({noCache: true})">
ng-click="syncNotifications({noCache: true}, 'button clicked')">
<i class="icon ion-refresh">&nbsp;Refresh</i>
</a>
</div>
Expand All @@ -52,64 +43,92 @@
</div>
</div>
</div>
<div id="allCaughtUpCard2"
ng-if="!state.loading && state.numberOfDisplayedNotifications === 0"
ng-repeat="helpCard in [state.caughtUpCard] | limitTo:1">
<div ng-include="'templates/fragments/help-info-card-fragment.html'"></div>
</div>
<div id="allCaughtUpCard"
class="list card"
ng-if="!state.loading && state.numberOfDisplayedNotifications === 0">
<div class="item" style="padding-bottom:10px;">
<p style=" text-align: center; line-height: normal; font-size: 25px;">All caught up!</p>
<p style=" text-align: center; line-height: normal; font-size: 25px;">
All caught up!
</p>
<div class="row">
<div class="col" style="padding-top: 0px;"><i style="text-align: center; font-size: 60px;"
class="icon positive ion-android-sunny"></i></div>
<div class="col col-75"><h2 style="white-space: normal; text-align: justify; line-height: normal; ">
Maybe you should refresh or add some more reminders? </h2></div>
<div class="col" style="padding-top: 0px;">
<i style="text-align: center; font-size: 60px;" class="icon positive ion-android-sunny">
</i>
</div>
</div>
<div class="row">
<div class="button-bar">
<button class="button button-clear button-balanced" style="font-size: 14px;"
ng-click="goToState('app.reminderSearch')"><i class="ion-android-notifications"> &nbsp;
Add a reminder &nbsp;</i></button>
<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"
style="font-size: 14px;"
ng-click="goToState('app.reminderSearch')">
<i class="ion-android-notifications"> &nbsp;
Add a reminder &nbsp;
</i>
</button>
</div>
</div>
<div class="row">
<div class="button-bar">
<button class="button button-clear button-royal" style="font-size: 14px;"
ng-click="goToState('app.measurementAddSearch')"><i class="ion-compose"> &nbsp; Record a
measurement &nbsp;</i></button>
ng-click="goToState('app.measurementAddSearch')">
<i class="ion-compose">
&nbsp; Record a
measurement &nbsp;
</i>
</button>
</div>
</div>
<div class="row">
<div class="button-bar">
<button class="button button-clear button-calm" style="font-size: 14px;"
ng-click="goToState('app.historyAll')"><i class="ion-ios-list-outline"> &nbsp; History
&nbsp;</i></button>
ng-click="goToState('app.historyAll')">
<i class="ion-ios-list-outline">
&nbsp; History
&nbsp;</i>
</button>
</div>
</div>
<div class="row">
<div class="button-bar">
<button class="button button-clear button-balanced" style="font-size: 14px;"
ng-click="syncNotifications({noCache: true})"><i class="ion-refresh"> &nbsp; Refresh
&nbsp;</i></button>
<button class="button button-clear button-balanced"
style="font-size: 14px;"
ng-click="syncNotifications({noCache: true}, 'button clicked')">
<i class="ion-refresh">
&nbsp; Refresh
&nbsp;</i>
</button>
</div>
</div>
</div>
</div>
<div id="Favorites"
class="list card"
ng-if="state.favoritesArray && state.favoritesArray.length && state.numberOfDisplayedNotifications === 0">
<div class="item item-divider" style="">{{state.favoritesTitle}}</div>
<div ng-include="'templates/fragments/blood-pressure-favorite-fragment.html'"></div>
<div ng-include="'templates/fragments/favorites-list-fragment.html'"></div>
<div id="word-cloud"
ng-if="words && state.numberOfDisplayedNotifications === 0"
ng-include="'templates/word-cloud.html'">
</div>
<div id="studies-container"
ng-if="state.studiesResponse.studies && state.studiesResponse.studies.length && state.numberOfDisplayedNotifications === 0"
class="list card">
<div ng-include="'templates/fragments/studies-list-fragment.html'"></div>
<div class="button-bar">
<a class="button button-clear button-positive" ng-click="goToState('app.predictorSearch')"
style="text-overflow: clip;"><i class="ion-search"> More Discoveries</i></a>
style="text-overflow: clip;">
<i class="ion-search"> More Discoveries</i>
</a>
</div>
<br>
</div>
<div id="Favorites"
class="list card"
ng-if="state.favoritesArray && state.favoritesArray.length && state.numberOfDisplayedNotifications === 0">
<div class="item item-divider" style="">{{state.favoritesTitle}}</div>
<div ng-include="'templates/fragments/blood-pressure-favorite-fragment.html'"></div>
<div ng-include="'templates/fragments/favorites-list-fragment.html'"></div>
</div>
<div id="charts-container"
ng-if="state.variableObject.charts && state.numberOfDisplayedNotifications === 0"
ng-include="'templates/fragments/charts-fragment.html'"></div>
Expand Down
9 changes: 9 additions & 0 deletions src/templates/word-cloud.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div id="aboveAverageWords"
ng-if="words && state.numberOfDisplayedNotifications === 0">
<word-cloud words="words.aboveAverageWords" width="width" height="height" padding="10"
on-click="wordClicked"></word-cloud>
</div>
<div id="belowAverageWords" ng-if="words">
<word-cloud words="words.belowAverageWords" width="width" height="height" padding="10"
on-click="wordClicked"></word-cloud>
</div>

1 comment on commit 40079b1

@mikepsinn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View recording of ionic_authentication_spec.js
Cypress Dashboard or Build Log or S3

ionic_authentication-ionic

BUILD LOG

Please sign in to comment.