2015-08-27 11:24:39 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular.module('copayApp.controllers').controller('disclaimerController',
|
2015-11-17 13:36:31 -03:00
|
|
|
function($scope, $timeout, $log, profileService, isCordova, storageService, gettextCatalog, uxLanguage, go) {
|
2015-11-17 12:39:51 -03:00
|
|
|
self = this;
|
2015-11-17 13:36:31 -03:00
|
|
|
$scope.lang = uxLanguage.currentLanguage;
|
2015-11-17 11:10:09 -03:00
|
|
|
|
2015-11-17 13:36:31 -03:00
|
|
|
$scope.goHome = function() {
|
|
|
|
|
go.walletHome();
|
2015-08-27 11:24:39 -03:00
|
|
|
};
|
2015-11-16 12:00:10 -03:00
|
|
|
|
2015-11-17 13:36:31 -03:00
|
|
|
var create = function () {
|
|
|
|
|
$scope.creatingProfile = true;
|
|
|
|
|
profileService.create({}, function(err) {
|
|
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
|
|
|
|
if (err == 'EEXISTS')
|
|
|
|
|
return go.walletHome();
|
|
|
|
|
|
|
|
|
|
$log.warn(err);
|
|
|
|
|
$scope.error = err;
|
|
|
|
|
$scope.$apply();
|
|
|
|
|
$timeout(function() {
|
|
|
|
|
$log.warn('Retrying to create profile......');
|
|
|
|
|
create();
|
|
|
|
|
}, 3000);
|
|
|
|
|
} else {
|
|
|
|
|
$scope.error = "";
|
|
|
|
|
$scope.creatingProfile = false;
|
|
|
|
|
}
|
2015-09-16 02:20:45 +02:00
|
|
|
});
|
|
|
|
|
};
|
2015-11-17 11:10:09 -03:00
|
|
|
|
2015-11-17 13:36:31 -03:00
|
|
|
// create();
|
|
|
|
|
|
2015-08-27 11:24:39 -03:00
|
|
|
});
|