Wallet/src/js/controllers/disclaimer.js

38 lines
1 KiB
JavaScript
Raw Normal View History

'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-11-17 11:10:09 -03:00
$scope.init = function(noWallet) {
storageService.getCopayDisclaimerFlag(function(err, val) {
2015-09-18 01:03:22 +09:00
$scope.lang = uxLanguage.currentLanguage;
$scope.agreed = val;
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-11-17 11:10:09 -03:00
});