fix blank page
This commit is contained in:
parent
4061c807c1
commit
fd32a1ec91
3 changed files with 44 additions and 31 deletions
|
|
@ -1,10 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('disclaimerController',
|
||||
function($scope, $timeout, $log, profileService, isCordova, storageService, gettextCatalog, uxLanguage, go) {
|
||||
function($scope, $timeout, $log, profileService, isCordova, storageService, applicationService, gettextCatalog, uxLanguage, go) {
|
||||
self = this;
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
|
||||
$scope.goHome = function() {
|
||||
storageService.setCopayDisclaimerFlag(function(err) {
|
||||
go.walletHome();
|
||||
|
|
@ -16,14 +15,13 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
|||
profileService.create({}, function(err) {
|
||||
|
||||
if (err) {
|
||||
|
||||
$log.warn(err);
|
||||
if (err == 'EEXISTS') {
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
if (val) return go.walletHome();
|
||||
$scope.creatingProfile = false;
|
||||
});
|
||||
} else {
|
||||
$log.warn(err);
|
||||
$scope.error = err;
|
||||
$scope.$apply();
|
||||
$timeout(function() {
|
||||
|
|
@ -38,6 +36,8 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
|||
});
|
||||
};
|
||||
|
||||
create();
|
||||
|
||||
if (!profileService.profile)
|
||||
create();
|
||||
else
|
||||
applicationService.restart();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -457,27 +457,33 @@ angular
|
|||
url: '/cordova/:status/:isHome',
|
||||
views: {
|
||||
'main': {
|
||||
controller: function($rootScope, $state, $stateParams, $timeout, go, isCordova, storageService) {
|
||||
controller: function($rootScope, $state, $log, $stateParams, $timeout, go, isCordova, storageService) {
|
||||
|
||||
if ($stateParams.status == "pause")
|
||||
return;
|
||||
|
||||
switch ($stateParams.status) {
|
||||
case 'resume':
|
||||
$rootScope.$emit('Local/Resume');
|
||||
break;
|
||||
case 'backbutton':
|
||||
if (isCordova && $stateParams.isHome == 'true' && !$rootScope.modalOpened) {
|
||||
navigator.app.exitApp();
|
||||
} else {
|
||||
$rootScope.$emit('closeModal');
|
||||
}
|
||||
break;
|
||||
};
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
if (!val) navigator.app.exitApp();
|
||||
|
||||
$timeout(function() {
|
||||
$rootScope.$emit('Local/SetTab', 'walletHome', true);
|
||||
}, 100);
|
||||
go.walletHome();
|
||||
$log.debug('### State: ', $stateParams.status);
|
||||
switch ($stateParams.status) {
|
||||
case 'resume':
|
||||
$rootScope.$emit('Local/Resume');
|
||||
break;
|
||||
case 'backbutton':
|
||||
var shouldExit = $stateParams.isHome == 'true' || !val;
|
||||
if (isCordova && shouldExit && !$rootScope.modalOpened) {
|
||||
return navigator.app.exitApp();
|
||||
} else {
|
||||
$rootScope.$emit('closeModal');
|
||||
}
|
||||
break;
|
||||
};
|
||||
|
||||
if (val) {
|
||||
go.walletHome(true);
|
||||
} else {
|
||||
$state.transitionTo('disclaimer');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('go', function($window, $rootScope, $location, $state, profileService, nodeWebkit) {
|
||||
angular.module('copayApp.services').factory('go', function($window, $rootScope, $location, $state, $timeout, profileService, nodeWebkit) {
|
||||
var root = {};
|
||||
|
||||
var hideSidebars = function() {
|
||||
|
|
@ -32,8 +32,7 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope,
|
|||
root.openExternalLink = function(url, target) {
|
||||
if (nodeWebkit.isDefined()) {
|
||||
nodeWebkit.openExternalLink(url);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
target = target || '_blank';
|
||||
var ref = window.open(url, target, 'location=no');
|
||||
}
|
||||
|
|
@ -53,14 +52,22 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope,
|
|||
toggleSidebar(invert);
|
||||
};
|
||||
|
||||
root.walletHome = function() {
|
||||
root.walletHome = function(delayed) {
|
||||
var fc = profileService.focusedClient;
|
||||
if (fc && !fc.isComplete()) {
|
||||
root.path('copayers');
|
||||
} else {
|
||||
root.path('walletHome', function() {
|
||||
$rootScope.$emit('Local/SetTab', 'walletHome', true);
|
||||
});
|
||||
if (delayed) {
|
||||
$timeout(function() {
|
||||
root.path('walletHome', function() {
|
||||
$rootScope.$emit('Local/SetTab', 'walletHome', true);
|
||||
});
|
||||
}, 100);
|
||||
} else {
|
||||
root.path('walletHome', function() {
|
||||
$rootScope.$emit('Local/SetTab', 'walletHome', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue