mirror of https://github.com/BTCPrivate/copay.git
create profile before accepting terms
This commit is contained in:
parent
003a2a95a2
commit
8217c7bfbd
|
@ -1,47 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('disclaimerController',
|
||||
function($scope, $timeout, $log, profileService, isCordova, storageService, gettextCatalog, uxLanguage, go) {
|
||||
function($scope, $timeout, $log, profileService, isCordova, storageService, gettextCatalog, applicationService, uxLanguage, go) {
|
||||
|
||||
$scope.create = function(noWallet) {
|
||||
|
||||
$scope.create = function() {
|
||||
$scope.creatingProfile = true;
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Loading...'), true);
|
||||
}
|
||||
$scope.loading = true;
|
||||
$timeout(function() {
|
||||
storageService.setCopayDisclaimerFlag(function(err) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
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);
|
||||
storageService.setCopayDisclaimerFlag(function(err) {
|
||||
$scope.creatingProfile = false;
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
applicationService.restart();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.init = function(noWallet) {
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
$scope.agreed = val;
|
||||
|
||||
if (profileService.profile) {
|
||||
go.walletHome();
|
||||
}
|
||||
$timeout(function() {
|
||||
$scope.$digest();
|
||||
}, 1);
|
||||
profileService.create({
|
||||
noWallet: noWallet
|
||||
}, function(err) {
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
$scope.error = err;
|
||||
$scope.$apply();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
@ -142,7 +142,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
var defaults = configService.getDefaults();
|
||||
var config = configService.getSync();
|
||||
|
||||
self.usingCustomBWS = config.bwsFor && config.bwsFor[self.walletId] && (config.bwsFor[self.walletId] != defaults.bws.url);
|
||||
self.usingCustomBWS = config.bwsFor && config.bwsFor[self.walletId] && (config.bwsFor[self.walletId] != defaults.bws.url);
|
||||
};
|
||||
|
||||
self.setTab = function(tab, reset, tries, switchState) {
|
||||
|
@ -807,7 +807,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
return i_cb(null, newTxs);
|
||||
}
|
||||
|
||||
if (walletId == profileService.focusedClient.credentials.walletId)
|
||||
if (walletId == profileService.focusedClient.credentials.walletId)
|
||||
self.txProgress = newTxs.length;
|
||||
|
||||
$timeout(function() {
|
||||
|
@ -822,7 +822,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
var newHistory = lodash.compact(txs.concat(txsFromLocal));
|
||||
$log.debug('Tx History synced. Total Txs: ' + newHistory.length);
|
||||
|
||||
if (walletId == profileService.focusedClient.credentials.walletId) {
|
||||
if (walletId == profileService.focusedClient.credentials.walletId) {
|
||||
self.completeHistory = newHistory;
|
||||
self.txHistory = newHistory.slice(0, self.historyShowLimit);
|
||||
self.historyShowShowAll = newHistory.length >= self.historyShowLimit;
|
||||
|
@ -1295,15 +1295,17 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
$rootScope.$on('Local/NewFocusedWallet', function() {
|
||||
self.setFocusedWallet();
|
||||
self.updateTxHistory();
|
||||
go.walletHome();
|
||||
storageService.getCleanAndScanAddresses(function(err, walletId) {
|
||||
if (walletId && profileService.walletClients[walletId]) {
|
||||
$log.debug('Clear last address cache and Scan ', walletId);
|
||||
addressService.expireAddress(walletId, function(err) {
|
||||
self.startScan(walletId);
|
||||
});
|
||||
storageService.removeCleanAndScanAddresses(function() {});
|
||||
}
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
if (val) go.walletHome();
|
||||
storageService.getCleanAndScanAddresses(function(err, walletId) {
|
||||
if (walletId && profileService.walletClients[walletId]) {
|
||||
$log.debug('Clear last address cache and Scan ', walletId);
|
||||
addressService.expireAddress(walletId, function(err) {
|
||||
self.startScan(walletId);
|
||||
});
|
||||
storageService.removeCleanAndScanAddresses(function() {});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue