Wallet/src/js/controllers/disclaimer.js
Gustavo Maximiliano Cortez bdfa89115d
Fix disclaimer
2015-12-05 20:50:31 -03:00

38 lines
1 KiB
JavaScript

'use strict';
angular.module('copayApp.controllers').controller('disclaimerController',
function($scope, $timeout, $log, profileService, isCordova, storageService, applicationService, gettextCatalog, uxLanguage, go) {
self = this;
var create = function() {
$scope.creatingProfile = true;
profileService.create({}, function(err) {
if (err) {
$log.warn(err);
$scope.error = err;
$scope.$apply();
$timeout(function() {
$log.warn('Retrying to create profile......');
create();
}, 3000);
} else {
$scope.error = "";
$scope.creatingProfile = false;
}
});
};
this.init = function() {
self.lang = uxLanguage.currentLanguage;
storageService.getProfile(function(err, profile) {
if (!profile) create();
else $scope.creatingProfile = false;
//compatible
profileService.checkDisclaimer(function(val) {
if (val) go.walletHome();
});
});
};
});