2015-08-27 11:24:39 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular.module('copayApp.controllers').controller('disclaimerController',
|
2015-11-16 12:00:10 -03:00
|
|
|
function($scope, $timeout, $log, profileService, isCordova, storageService, gettextCatalog, uxLanguage, go) {
|
2015-08-27 11:24:39 -03:00
|
|
|
|
2015-11-16 12:00:10 -03:00
|
|
|
$scope.create = function(noWallet) {
|
|
|
|
|
$scope.creatingProfile = true;
|
2015-08-27 11:24:39 -03:00
|
|
|
if (isCordova) {
|
|
|
|
|
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Loading...'), true);
|
|
|
|
|
}
|
|
|
|
|
$scope.loading = true;
|
|
|
|
|
$timeout(function() {
|
|
|
|
|
storageService.setCopayDisclaimerFlag(function(err) {
|
2015-11-16 12:00:10 -03:00
|
|
|
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);
|
2015-08-27 11:24:39 -03:00
|
|
|
}
|
2015-11-16 12:00:10 -03:00
|
|
|
});
|
2015-08-27 11:24:39 -03:00
|
|
|
});
|
|
|
|
|
}, 100);
|
|
|
|
|
};
|
2015-11-16 12:00:10 -03:00
|
|
|
|
2015-09-16 02:20:45 +02:00
|
|
|
$scope.init = function() {
|
|
|
|
|
storageService.getCopayDisclaimerFlag(function(err, val) {
|
2015-09-18 01:03:22 +09:00
|
|
|
$scope.lang = uxLanguage.currentLanguage;
|
2015-09-16 02:20:45 +02:00
|
|
|
$scope.agreed = val;
|
2015-11-16 12:00:10 -03:00
|
|
|
|
|
|
|
|
if (profileService.profile) {
|
|
|
|
|
go.walletHome();
|
|
|
|
|
}
|
2015-09-16 02:20:45 +02:00
|
|
|
$timeout(function() {
|
|
|
|
|
$scope.$digest();
|
|
|
|
|
}, 1);
|
|
|
|
|
});
|
|
|
|
|
};
|
2015-08-27 11:24:39 -03:00
|
|
|
});
|