summaryrefslogtreecommitdiff
path: root/www/js/app.js
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2016-08-01 19:46:06 -0400
committerPliable Pixels <pliablepixels@gmail.com>2016-08-01 19:46:06 -0400
commitc89196934f5c83b117afdc6c2061f1efe4a2c60a (patch)
treeeece008671bdc04ddff9ee4217e780a6cff49d54 /www/js/app.js
parent0dcbfc493c5c08b463d3cb02c29f932ff3e3f2ea (diff)
#292 - firstuse fixes - dealing with problems of checking firstuse before all data is loaded
Former-commit-id: 7b071f959eb86ae0109094f1828a1ca4f7b3cfde
Diffstat (limited to 'www/js/app.js')
-rw-r--r--www/js/app.js39
1 files changed, 35 insertions, 4 deletions
diff --git a/www/js/app.js b/www/js/app.js
index 40fb76cb..849365d3 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -1043,7 +1043,7 @@ angular.module('zmApp', [
$rootScope.$on('$stateChangeStart', function (event, toState, toParams) {
var requireLogin = toState.data.requireLogin;
- if (ZMDataModel.isLoggedIn() || toState.name =="login" ) {
+ if (ZMDataModel.isLoggedIn() || toState.data.requireLogin ==false ) {
//console.log("State transition is authorized");
return;
@@ -1115,7 +1115,20 @@ angular.module('zmApp', [
localforage.getItem("defaultServerName")
.then (function (val)
{
- if (!val && defaultServerName)
+ console.log (">>>> localforage reported defaultServerName as " + val);
+ // if neither, we are in first use, mates!
+ if (!val && !defaultServerName)
+ {
+ continueInitialInit();
+ /* ZMDataModel.zmDebug ("Neither localstorage or forage - First use, showing warm and fuzzy...");
+ $ionicHistory.nextViewOptions({
+ disableAnimate: true,
+ disableBack: true
+ });
+ $state.go('first-use');*/
+ }
+
+ else if (!val && defaultServerName)
{
ZMDataModel.zmLog (">>>>Importing data from localstorage....");
@@ -1252,8 +1265,26 @@ angular.module('zmApp', [
.then(function (success) {
ZMDataModel.zmLog(">>>>Language to be used:" + $translate.proposedLanguage());
moment.locale($translate.proposedLanguage());
- continueRestOfInit();
-
+
+ // Remember this is before data Init
+ // so I need to do a direct forage fetch
+ localforage.getItem("isFirstUse")
+ .then (function(val)
+ {
+ console.log ("isFirstUse is " + val);
+ if (val == null || val == true)
+ {
+ ZMDataModel.zmLog ("First time detected");
+ $state.go("first-use");
+ }
+ else
+ {
+ continueRestOfInit();
+ }
+
+ });
+
+
});
}