deleting agree disclaimer flag in storage and adding to the storage profile
This commit is contained in:
parent
42aaf515c7
commit
3f7485ca8d
7 changed files with 62 additions and 58 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
<div class="splash content text-center"
|
<div class="splash content text-center"
|
||||||
|
ng-init="init()"
|
||||||
ng-controller="disclaimerController">
|
ng-controller="disclaimerController">
|
||||||
<div>
|
<div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -30,7 +31,18 @@
|
||||||
<div class="text-center size-12 text-warning" ng-show="error">
|
<div class="text-center size-12 text-warning" ng-show="error">
|
||||||
{{(error)|translate}}. <span translate>Retrying...</span>
|
{{(error)|translate}}. <span translate>Retrying...</span>
|
||||||
</div>
|
</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">
|
<div class="start-button columns">
|
||||||
<button ng-disabled="creatingProfile" ng-click="goHome()" class="button black expand round size-12 text-spacing" translate>
|
<button ng-disabled="creatingProfile" ng-click="goHome()" class="button black expand round size-12 text-spacing" translate>
|
||||||
I AGREE. GET STARTED
|
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) {
|
function($scope, $timeout, $log, profileService, isCordova, storageService, applicationService, gettextCatalog, uxLanguage, go) {
|
||||||
self = this;
|
self = this;
|
||||||
$scope.lang = uxLanguage.currentLanguage;
|
$scope.lang = uxLanguage.currentLanguage;
|
||||||
|
|
||||||
$scope.goHome = function() {
|
$scope.goHome = function() {
|
||||||
storageService.setCopayDisclaimerFlag(function(err) {
|
storageService.getProfile(function(err, profile) {
|
||||||
go.walletHome();
|
profile.agreeDisclaimer = true;
|
||||||
|
storageService.storeProfile(profile, function() {
|
||||||
|
go.walletHome();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -17,10 +21,10 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
||||||
if (err) {
|
if (err) {
|
||||||
$log.warn(err);
|
$log.warn(err);
|
||||||
if (err == 'EEXISTS') {
|
if (err == 'EEXISTS') {
|
||||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
|
||||||
if (val) return go.walletHome();
|
if (profileService.profile.agreeDisclaimer) return go.walletHome();
|
||||||
$scope.creatingProfile = false;
|
$scope.creatingProfile = false;
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$scope.error = err;
|
$scope.error = err;
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
|
|
@ -36,8 +40,10 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!profileService.profile)
|
storageService.getProfile(function(err, profile) {
|
||||||
create();
|
if (!profile) create();
|
||||||
else
|
else $scope.creatingProfile = false;
|
||||||
applicationService.restart();
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.openWallet();
|
self.openWallet();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
storageService.getProfile(function(err, profile) {
|
||||||
self.agreeDisclaimer = val;
|
self.agreeDisclaimer = profile.agreeDisclaimer;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -732,7 +732,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
_creator = '';
|
_creator = '';
|
||||||
|
|
||||||
if (it.actions && it.actions.length > 1) {
|
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 + ' - ';
|
_copayers += it.actions[i].copayerName + ':' + it.actions[i].type + ' - ';
|
||||||
}
|
}
|
||||||
_creator = (it.creatorName && it.creatorName != 'undefined') ? it.creatorName : '';
|
_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() {
|
$rootScope.$on('Local/NewFocusedWallet', function() {
|
||||||
self.setFocusedWallet();
|
self.setFocusedWallet();
|
||||||
self.updateTxHistory();
|
self.updateTxHistory();
|
||||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
storageService.getProfile(function(err, val) {
|
||||||
if (val) go.walletHome();
|
if (val.agreeDisclaimer) go.walletHome();
|
||||||
storageService.getCleanAndScanAddresses(function(err, walletId) {
|
storageService.getCleanAndScanAddresses(function(err, walletId) {
|
||||||
if (walletId && profileService.walletClients[walletId]) {
|
if (walletId && profileService.walletClients[walletId]) {
|
||||||
$log.debug('Clear last address cache and Scan ', walletId);
|
$log.debug('Clear last address cache and Scan ', walletId);
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,16 @@ Profile.create = function(opts) {
|
||||||
var x = new Profile();
|
var x = new Profile();
|
||||||
x.createdOn = Date.now();
|
x.createdOn = Date.now();
|
||||||
x.credentials = opts.credentials || [];
|
x.credentials = opts.credentials || [];
|
||||||
|
x.agreeDisclaimer = false;
|
||||||
return x;
|
return x;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Profile.fromObj = function(obj) {
|
Profile.fromObj = function(obj) {
|
||||||
var x = new Profile();
|
var x = new Profile();
|
||||||
|
|
||||||
x.createdOn = obj.createdOn;
|
x.createdOn = obj.createdOn;
|
||||||
x.credentials = obj.credentials;
|
x.credentials = obj.credentials;
|
||||||
|
x.agreeDisclaimer = obj.agreeDisclaimer;
|
||||||
|
|
||||||
if (x.credentials[0] && typeof x.credentials[0] != 'object')
|
if (x.credentials[0] && typeof x.credentials[0] != 'object')
|
||||||
throw ("credentials should be an object");
|
throw ("credentials should be an object");
|
||||||
|
|
@ -31,7 +32,6 @@ Profile.fromObj = function(obj) {
|
||||||
return x;
|
return x;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Profile.fromString = function(str) {
|
Profile.fromString = function(str) {
|
||||||
return Profile.fromObj(JSON.parse(str));
|
return Profile.fromObj(JSON.parse(str));
|
||||||
};
|
};
|
||||||
|
|
@ -39,5 +39,3 @@ Profile.fromString = function(str) {
|
||||||
Profile.prototype.toObj = function() {
|
Profile.prototype.toObj = function() {
|
||||||
return JSON.stringify(this);
|
return JSON.stringify(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -471,7 +471,7 @@ angular
|
||||||
if ($stateParams.status == "pause")
|
if ($stateParams.status == "pause")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
storageService.getProfile(function(err, profile) {
|
||||||
|
|
||||||
$log.debug('### State: ', $stateParams.status);
|
$log.debug('### State: ', $stateParams.status);
|
||||||
switch ($stateParams.status) {
|
switch ($stateParams.status) {
|
||||||
|
|
@ -479,7 +479,7 @@ angular
|
||||||
$rootScope.$emit('Local/Resume');
|
$rootScope.$emit('Local/Resume');
|
||||||
break;
|
break;
|
||||||
case 'backbutton':
|
case 'backbutton':
|
||||||
var shouldExit = $stateParams.isHome == 'true' || !val;
|
var shouldExit = $stateParams.isHome == 'true' || !profile.agreeDisclaimer;
|
||||||
if (isCordova && shouldExit && !$rootScope.modalOpened) {
|
if (isCordova && shouldExit && !$rootScope.modalOpened) {
|
||||||
return navigator.app.exitApp();
|
return navigator.app.exitApp();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -488,7 +488,7 @@ angular
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (val) {
|
if (profile.agreeDisclaimer) {
|
||||||
go.walletHome(true);
|
go.walletHome(true);
|
||||||
} else {
|
} else {
|
||||||
$state.transitionTo('disclaimer');
|
$state.transitionTo('disclaimer');
|
||||||
|
|
|
||||||
|
|
@ -134,30 +134,27 @@ angular.module('copayApp.services')
|
||||||
};
|
};
|
||||||
|
|
||||||
root.loadAndBindProfile = function(cb) {
|
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;
|
storageService.getProfile(function(err, profile) {
|
||||||
return root.bindProfile(profile, cb);
|
if (err) {
|
||||||
})
|
$rootScope.$emit('Local/DeviceError', err);
|
||||||
} else {
|
return cb(err);
|
||||||
$log.debug('Profile read');
|
}
|
||||||
return root.bindProfile(profile, cb);
|
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 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();
|
return cb();
|
||||||
|
|
||||||
$rootScope.$emit('Local/BackupDone', walletId);
|
$rootScope.$emit('Local/BackupDone', walletId);
|
||||||
|
|
||||||
if (!walletClient.isComplete())
|
if (!walletClient.isComplete())
|
||||||
return cb();
|
return cb();
|
||||||
|
|
||||||
storageService.setCleanAndScanAddresses(walletId, cb);
|
storageService.setCleanAndScanAddresses(walletId, cb);
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,6 @@ angular.module('copayApp.services')
|
||||||
|
|
||||||
root.getProfile = function(cb) {
|
root.getProfile = function(cb) {
|
||||||
storage.get('profile', function(err, str) {
|
storage.get('profile', function(err, str) {
|
||||||
|
|
||||||
if (err || !str)
|
if (err || !str)
|
||||||
return cb(err);
|
return cb(err);
|
||||||
|
|
||||||
|
|
@ -199,14 +198,6 @@ angular.module('copayApp.services')
|
||||||
storage.remove('config', cb);
|
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) {
|
root.setRemotePrefsStoredFlag = function(cb) {
|
||||||
storage.set('remotePrefStored', true, cb);
|
storage.set('remotePrefStored', true, cb);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue