2015-08-27 11:24:39 -03:00
|
|
|
'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-08-27 11:24:39 -03:00
|
|
|
|
2015-11-17 11:10:09 -03:00
|
|
|
|
|
|
|
|
$scope.create = function() {
|
2015-11-16 12:00:10 -03:00
|
|
|
$scope.creatingProfile = true;
|
2015-08-27 11:24:39 -03:00
|
|
|
if (isCordova) {
|
|
|
|
|
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Loading...'), true);
|
|
|
|
|
}
|
|
|
|
|
$scope.loading = true;
|
2015-11-17 11:10:09 -03:00
|
|
|
storageService.setCopayDisclaimerFlag(function(err) {
|
|
|
|
|
$scope.creatingProfile = false;
|
|
|
|
|
if (isCordova) {
|
|
|
|
|
window.plugins.spinnerDialog.hide();
|
|
|
|
|
}
|
|
|
|
|
applicationService.restart();
|
|
|
|
|
});
|
2015-08-27 11:24:39 -03:00
|
|
|
};
|
2015-11-16 12:00:10 -03:00
|
|
|
|
2015-11-17 11:10:09 -03:00
|
|
|
$scope.init = function(noWallet) {
|
2015-09-16 02:20:45 +02:00
|
|
|
storageService.getCopayDisclaimerFlag(function(err, val) {
|
2015-09-18 01:03:22 +09:00
|
|
|
$scope.lang = uxLanguage.currentLanguage;
|
2015-09-16 02:20:45 +02:00
|
|
|
$scope.agreed = val;
|
2015-11-16 12:00:10 -03:00
|
|
|
|
2015-11-17 11:10:09 -03:00
|
|
|
profileService.create({
|
|
|
|
|
noWallet: noWallet
|
|
|
|
|
}, function(err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
$log.warn(err);
|
|
|
|
|
$scope.error = err;
|
|
|
|
|
$scope.$apply();
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-09-16 02:20:45 +02:00
|
|
|
});
|
|
|
|
|
};
|
2015-11-17 11:10:09 -03:00
|
|
|
|
2015-08-27 11:24:39 -03:00
|
|
|
});
|