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