2015-08-27 11:24:39 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular.module('copayApp.controllers').controller('disclaimerController',
|
2015-11-17 11:10:09 -03:00
|
|
|
function($scope, $timeout, $log, profileService, isCordova, storageService, gettextCatalog, applicationService, uxLanguage, go) {
|
2015-11-17 12:39:51 -03:00
|
|
|
self = this;
|
|
|
|
|
$scope.noProfile = true;
|
2015-11-17 11:10:09 -03:00
|
|
|
|
|
|
|
|
$scope.create = function() {
|
|
|
|
|
storageService.setCopayDisclaimerFlag(function(err) {
|
|
|
|
|
applicationService.restart();
|
|
|
|
|
});
|
2015-08-27 11:24:39 -03:00
|
|
|
};
|
2015-11-16 12:00:10 -03:00
|
|
|
|
2015-11-17 11:10:09 -03:00
|
|
|
$scope.init = function(noWallet) {
|
2015-09-16 02:20:45 +02:00
|
|
|
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
|
|
|
|
2015-11-17 11:10:09 -03:00
|
|
|
profileService.create({
|
|
|
|
|
noWallet: noWallet
|
|
|
|
|
}, function(err) {
|
2015-11-17 12:39:51 -03:00
|
|
|
if (err && !'EEXIST') {
|
2015-11-17 11:10:09 -03:00
|
|
|
$log.warn(err);
|
|
|
|
|
$scope.error = err;
|
|
|
|
|
$scope.$apply();
|
2015-11-17 12:39:51 -03:00
|
|
|
$scope.noProfile = true;
|
|
|
|
|
$timeout(function() {
|
|
|
|
|
$scope.init();
|
|
|
|
|
}, 3000);
|
|
|
|
|
} else {
|
|
|
|
|
$scope.error = "";
|
|
|
|
|
$scope.noProfile = false;
|
2015-11-17 11:10:09 -03:00
|
|
|
}
|
|
|
|
|
});
|
2015-09-16 02:20:45 +02:00
|
|
|
});
|
|
|
|
|
};
|
2015-11-17 11:10:09 -03:00
|
|
|
|
2015-08-27 11:24:39 -03:00
|
|
|
});
|