2015-08-27 11:24:39 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular.module('copayApp.controllers').controller('splashController',
|
2015-09-16 13:52:28 -03:00
|
|
|
function($scope, $timeout, $log, profileService, storageService, go) {
|
|
|
|
|
|
2015-08-27 11:24:39 -03:00
|
|
|
$scope.create = function(noWallet) {
|
|
|
|
|
$scope.creatingProfile = true;
|
|
|
|
|
|
|
|
|
|
$timeout(function() {
|
|
|
|
|
profileService.create({
|
|
|
|
|
noWallet: noWallet
|
|
|
|
|
}, function(err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
$scope.creatingProfile = false;
|
|
|
|
|
$log.warn(err);
|
|
|
|
|
$scope.error = err;
|
|
|
|
|
$scope.$apply();
|
|
|
|
|
$timeout(function() {
|
|
|
|
|
$scope.create(noWallet);
|
|
|
|
|
}, 3000);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, 100);
|
|
|
|
|
};
|
2015-09-16 13:52:28 -03:00
|
|
|
|
|
|
|
|
$scope.init = function() {
|
|
|
|
|
storageService.getCopayDisclaimerFlag(function(err, val) {
|
|
|
|
|
if (!val) go.path('disclaimer');
|
|
|
|
|
|
|
|
|
|
if (profileService.profile) {
|
|
|
|
|
go.walletHome();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
2015-08-27 11:24:39 -03:00
|
|
|
});
|