create profile before accepting terms
This commit is contained in:
parent
003a2a95a2
commit
8217c7bfbd
2 changed files with 35 additions and 41 deletions
|
|
@ -1,47 +1,39 @@
|
|||
'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, gettextCatalog, applicationService, uxLanguage, go) {
|
||||
|
||||
$scope.create = function(noWallet) {
|
||||
|
||||
$scope.create = function() {
|
||||
$scope.creatingProfile = true;
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Loading...'), true);
|
||||
}
|
||||
$scope.loading = true;
|
||||
$timeout(function() {
|
||||
storageService.setCopayDisclaimerFlag(function(err) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
profileService.create({
|
||||
noWallet: noWallet
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
$scope.creatingProfile = false;
|
||||
$log.warn(err);
|
||||
$scope.error = err;
|
||||
$scope.$apply();
|
||||
$timeout(function() {
|
||||
$scope.create(noWallet);
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
storageService.setCopayDisclaimerFlag(function(err) {
|
||||
$scope.creatingProfile = false;
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
applicationService.restart();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.init = function(noWallet) {
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
$scope.agreed = val;
|
||||
|
||||
if (profileService.profile) {
|
||||
go.walletHome();
|
||||
}
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
profileService.create({
|
||||
noWallet: noWallet
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
$scope.error = err;
|
||||
$scope.$apply();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue