Merge pull request #3516 from gabrielbazan7/feat/firstFlow1
Fix disclaimer bug
This commit is contained in:
commit
c9824cd656
13 changed files with 167 additions and 99 deletions
|
|
@ -1,12 +1,19 @@
|
|||
'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, applicationService, gettextCatalog, uxLanguage, go) {
|
||||
self = this;
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
|
||||
$scope.goHome = function() {
|
||||
go.walletHome();
|
||||
$scope.error = "";
|
||||
profileService.storeDisclaimer(function(err) {
|
||||
if (err) {
|
||||
$scope.error = err;
|
||||
$log.warn(err);
|
||||
$scope.$apply();
|
||||
} else go.walletHome();
|
||||
});
|
||||
};
|
||||
|
||||
var create = function() {
|
||||
|
|
@ -14,10 +21,6 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
|||
profileService.create({}, function(err) {
|
||||
|
||||
if (err) {
|
||||
|
||||
if (err == 'EEXISTS')
|
||||
return go.walletHome();
|
||||
|
||||
$log.warn(err);
|
||||
$scope.error = err;
|
||||
$scope.$apply();
|
||||
|
|
@ -32,6 +35,13 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
|||
});
|
||||
};
|
||||
|
||||
create();
|
||||
storageService.getProfile(function(err, profile) {
|
||||
if (!profile) create();
|
||||
else $scope.creatingProfile = false;
|
||||
|
||||
//compatible
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
if (val) go.walletHome();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -138,6 +138,14 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
};
|
||||
|
||||
self.agreeDisclaimer = function() {
|
||||
storageService.getProfile(function(err, profile) {
|
||||
if (profile && profile.agreeDisclaimer)
|
||||
return profile.agreeDisclaimer;
|
||||
return null;
|
||||
});
|
||||
};
|
||||
|
||||
self.setCustomBWSFlag = function() {
|
||||
var defaults = configService.getDefaults();
|
||||
var config = configService.getSync();
|
||||
|
|
@ -729,7 +737,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
_creator = '';
|
||||
|
||||
if (it.actions && it.actions.length > 1) {
|
||||
for (var i = 0; i < it.actions.length; i++) {
|
||||
for (var i = 0; i < it.actions.length; i++) {
|
||||
_copayers += it.actions[i].copayerName + ':' + it.actions[i].type + ' - ';
|
||||
}
|
||||
_creator = (it.creatorName && it.creatorName != 'undefined') ? it.creatorName : '';
|
||||
|
|
@ -1325,14 +1333,17 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
$rootScope.$on('Local/NewFocusedWallet', function() {
|
||||
self.setFocusedWallet();
|
||||
self.updateTxHistory();
|
||||
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.getProfile(function(err, profile) {
|
||||
if (profile && profile.agreeDisclaimer) 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…
Add table
Add a link
Reference in a new issue