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-24 17:16:52 -03:00
function($scope, $timeout, $log, profileService, isCordova, storageService, applicationService, gettextCatalog, uxLanguage, go) {
2015-11-17 12:39:51 -03:00
self = this;
2015-11-17 15:49:17 -03:00
var create = function() {
2015-11-17 13:36:31 -03:00
$scope.creatingProfile = true;
profileService.create({}, function(err) {
if (err) {
2015-11-24 17:16:52 -03:00
$log.warn(err);
2015-11-30 13:32:54 -03:00
$scope.error = err;
$scope.$apply();
$timeout(function() {
$log.warn('Retrying to create profile......');
create();
}, 3000);
2015-11-17 13:36:31 -03:00
} else {
$scope.error = "";
$scope.creatingProfile = false;
}
});
};
2015-11-17 11:10:09 -03:00
2015-12-04 18:45:35 -03:00
this.init = function() {
self.lang = uxLanguage.currentLanguage;
storageService.getProfile(function(err, profile) {
if (!profile) create();
else $scope.creatingProfile = false;
2015-12-04 18:45:35 -03:00
//compatible
profileService.checkDisclaimer(function(val) {
if (val) go.walletHome();
});
});
2015-12-04 18:45:35 -03:00
};
});