mirror of https://github.com/BTCPrivate/copay.git
deleting agree disclaimer flag in storage and adding to the storage profile
This commit is contained in:
parent
42aaf515c7
commit
3f7485ca8d
|
@ -1,4 +1,5 @@
|
|||
<div class="splash content text-center"
|
||||
ng-init="init()"
|
||||
ng-controller="disclaimerController">
|
||||
<div>
|
||||
<div class="row">
|
||||
|
@ -30,7 +31,18 @@
|
|||
<div class="text-center size-12 text-warning" ng-show="error">
|
||||
{{(error)|translate}}. <span translate>Retrying...</span>
|
||||
</div>
|
||||
|
||||
<div class="onGoingProcess" ng-show="creatingProfile">
|
||||
<div class="onGoingProcess-content" ng-style="{'background-color':'#222'}">
|
||||
<div class="spinner">
|
||||
<div class="rect1"></div>
|
||||
<div class="rect2"></div>
|
||||
<div class="rect3"></div>
|
||||
<div class="rect4"></div>
|
||||
<div class="rect5"></div>
|
||||
</div>
|
||||
<span translate>Creating Profile...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="start-button columns">
|
||||
<button ng-disabled="creatingProfile" ng-click="goHome()" class="button black expand round size-12 text-spacing" translate>
|
||||
I AGREE. GET STARTED
|
||||
|
|
|
@ -4,9 +4,13 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
|||
function($scope, $timeout, $log, profileService, isCordova, storageService, applicationService, gettextCatalog, uxLanguage, go) {
|
||||
self = this;
|
||||
$scope.lang = uxLanguage.currentLanguage;
|
||||
|
||||
$scope.goHome = function() {
|
||||
storageService.setCopayDisclaimerFlag(function(err) {
|
||||
go.walletHome();
|
||||
storageService.getProfile(function(err, profile) {
|
||||
profile.agreeDisclaimer = true;
|
||||
storageService.storeProfile(profile, function() {
|
||||
go.walletHome();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -17,10 +21,10 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
|||
if (err) {
|
||||
$log.warn(err);
|
||||
if (err == 'EEXISTS') {
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
if (val) return go.walletHome();
|
||||
$scope.creatingProfile = false;
|
||||
});
|
||||
|
||||
if (profileService.profile.agreeDisclaimer) return go.walletHome();
|
||||
$scope.creatingProfile = false;
|
||||
|
||||
} else {
|
||||
$scope.error = err;
|
||||
$scope.$apply();
|
||||
|
@ -36,8 +40,10 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
|||
});
|
||||
};
|
||||
|
||||
if (!profileService.profile)
|
||||
create();
|
||||
else
|
||||
applicationService.restart();
|
||||
storageService.getProfile(function(err, profile) {
|
||||
if (!profile) create();
|
||||
else $scope.creatingProfile = false;
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -135,8 +135,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
self.openWallet();
|
||||
});
|
||||
}
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
self.agreeDisclaimer = val;
|
||||
storageService.getProfile(function(err, profile) {
|
||||
self.agreeDisclaimer = profile.agreeDisclaimer;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -732,7 +732,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 : '';
|
||||
|
@ -1328,8 +1328,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
$rootScope.$on('Local/NewFocusedWallet', function() {
|
||||
self.setFocusedWallet();
|
||||
self.updateTxHistory();
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
if (val) go.walletHome();
|
||||
storageService.getProfile(function(err, val) {
|
||||
if (val.agreeDisclaimer) go.walletHome();
|
||||
storageService.getCleanAndScanAddresses(function(err, walletId) {
|
||||
if (walletId && profileService.walletClients[walletId]) {
|
||||
$log.debug('Clear last address cache and Scan ', walletId);
|
||||
|
|
|
@ -15,15 +15,16 @@ Profile.create = function(opts) {
|
|||
var x = new Profile();
|
||||
x.createdOn = Date.now();
|
||||
x.credentials = opts.credentials || [];
|
||||
x.agreeDisclaimer = false;
|
||||
return x;
|
||||
};
|
||||
|
||||
|
||||
Profile.fromObj = function(obj) {
|
||||
var x = new Profile();
|
||||
|
||||
x.createdOn = obj.createdOn;
|
||||
x.credentials = obj.credentials;
|
||||
x.agreeDisclaimer = obj.agreeDisclaimer;
|
||||
|
||||
if (x.credentials[0] && typeof x.credentials[0] != 'object')
|
||||
throw ("credentials should be an object");
|
||||
|
@ -31,7 +32,6 @@ Profile.fromObj = function(obj) {
|
|||
return x;
|
||||
};
|
||||
|
||||
|
||||
Profile.fromString = function(str) {
|
||||
return Profile.fromObj(JSON.parse(str));
|
||||
};
|
||||
|
@ -39,5 +39,3 @@ Profile.fromString = function(str) {
|
|||
Profile.prototype.toObj = function() {
|
||||
return JSON.stringify(this);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -471,7 +471,7 @@ angular
|
|||
if ($stateParams.status == "pause")
|
||||
return;
|
||||
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
storageService.getProfile(function(err, profile) {
|
||||
|
||||
$log.debug('### State: ', $stateParams.status);
|
||||
switch ($stateParams.status) {
|
||||
|
@ -479,7 +479,7 @@ angular
|
|||
$rootScope.$emit('Local/Resume');
|
||||
break;
|
||||
case 'backbutton':
|
||||
var shouldExit = $stateParams.isHome == 'true' || !val;
|
||||
var shouldExit = $stateParams.isHome == 'true' || !profile.agreeDisclaimer;
|
||||
if (isCordova && shouldExit && !$rootScope.modalOpened) {
|
||||
return navigator.app.exitApp();
|
||||
} else {
|
||||
|
@ -488,7 +488,7 @@ angular
|
|||
break;
|
||||
};
|
||||
|
||||
if (val) {
|
||||
if (profile.agreeDisclaimer) {
|
||||
go.walletHome(true);
|
||||
} else {
|
||||
$state.transitionTo('disclaimer');
|
||||
|
|
|
@ -134,30 +134,27 @@ angular.module('copayApp.services')
|
|||
};
|
||||
|
||||
root.loadAndBindProfile = function(cb) {
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
if (!val) {
|
||||
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
|
||||
} else {
|
||||
storageService.getProfile(function(err, profile) {
|
||||
if (err) {
|
||||
$rootScope.$emit('Local/DeviceError', err);
|
||||
return cb(err);
|
||||
}
|
||||
if (!profile) {
|
||||
// Migration??
|
||||
storageService.tryToMigrate(function(err, migratedProfile) {
|
||||
if (err) return cb(err);
|
||||
if (!migratedProfile)
|
||||
return cb(new Error('NOPROFILE: No profile'));
|
||||
|
||||
profile = migratedProfile;
|
||||
return root.bindProfile(profile, cb);
|
||||
})
|
||||
} else {
|
||||
$log.debug('Profile read');
|
||||
return root.bindProfile(profile, cb);
|
||||
}
|
||||
});
|
||||
storageService.getProfile(function(err, profile) {
|
||||
if (err) {
|
||||
$rootScope.$emit('Local/DeviceError', err);
|
||||
return cb(err);
|
||||
}
|
||||
if (!profile) {
|
||||
// Migration??
|
||||
storageService.tryToMigrate(function(err, migratedProfile) {
|
||||
if (err) return cb(err);
|
||||
if (!migratedProfile)
|
||||
return cb(new Error('NOPROFILE: No profile'));
|
||||
|
||||
profile = migratedProfile;
|
||||
return root.bindProfile(profile, cb);
|
||||
})
|
||||
} else {
|
||||
if (!profile.agreeDisclaimer)
|
||||
return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
|
||||
$log.debug('Profile read');
|
||||
return root.bindProfile(profile, cb);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -380,14 +377,14 @@ angular.module('copayApp.services')
|
|||
|
||||
|
||||
var handleImport = function(cb) {
|
||||
var isImport = opts.mnemonic || opts.externalSource || opts.extendedPrivateKey;
|
||||
var isImport = opts.mnemonic || opts.externalSource || opts.extendedPrivateKey;
|
||||
|
||||
if (!isImport)
|
||||
if (!isImport)
|
||||
return cb();
|
||||
|
||||
$rootScope.$emit('Local/BackupDone', walletId);
|
||||
|
||||
if (!walletClient.isComplete())
|
||||
if (!walletClient.isComplete())
|
||||
return cb();
|
||||
|
||||
storageService.setCleanAndScanAddresses(walletId, cb);
|
||||
|
|
|
@ -120,7 +120,6 @@ angular.module('copayApp.services')
|
|||
|
||||
root.getProfile = function(cb) {
|
||||
storage.get('profile', function(err, str) {
|
||||
|
||||
if (err || !str)
|
||||
return cb(err);
|
||||
|
||||
|
@ -199,14 +198,6 @@ angular.module('copayApp.services')
|
|||
storage.remove('config', cb);
|
||||
};
|
||||
|
||||
root.setCopayDisclaimerFlag = function(cb) {
|
||||
storage.set('agreeDisclaimer', true, cb);
|
||||
};
|
||||
|
||||
root.getCopayDisclaimerFlag = function(cb) {
|
||||
storage.get('agreeDisclaimer', cb);
|
||||
};
|
||||
|
||||
root.setRemotePrefsStoredFlag = function(cb) {
|
||||
storage.set('remotePrefStored', true, cb);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue