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
|
|
@ -18,7 +18,7 @@
|
|||
ng-controller="indexController as index"
|
||||
ng-swipe-disable-mouse
|
||||
ng-swipe-left="index.closeMenu()"
|
||||
ng-swipe-right="index.openMenu()">
|
||||
ng-swipe-right="index.agreeDisclaimer() ? index.openMenu() : null">
|
||||
|
||||
<div class="off-canvas-wrap" id="off-canvas-wrap">
|
||||
<div class="inner-wrap">
|
||||
|
|
|
|||
|
|
@ -12,24 +12,11 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="scrollArea">
|
||||
<p class="enable_text_select m0">
|
||||
<div class="size-16 text-gray" translate>Terms of Use</div>
|
||||
<ul>
|
||||
<li translate>The software you are about to use functions as a free, open source, and multi-signature digital wallet.</li>
|
||||
<li translate>The software does not constitute an account where BitPay or other third parties serve as financial intermediaries or custodians of your bitcoin.</li>
|
||||
<li translate>While the software has undergone beta testing and continues to be improved by feedback from the open-source user and developer community, we cannot guarantee that there will be no bugs in the software.</li>
|
||||
<li translate>You acknowledge that your use of this software is at your own discretion and in compliance with all applicable laws.</li>
|
||||
<li translate>You are responsible for safekeeping your passwords, private key pairs, PINs and any other codes you use to access the software.</li>
|
||||
<li translate><b>IF YOU LOSE ACCESS TO YOUR COPAY WALLET OR YOUR ENCRYPTED PRIVATE KEYS AND YOU HAVE NOT SEPARATELY STORED A BACKUP OF YOUR WALLET AND CORRESPONDING PASSWORD, YOU ACKNOWLEDGE AND AGREE THAT ANY BITCOIN YOU HAVE ASSOCIATED WITH THAT COPAY WALLET WILL BECOME INACCESSIBLE.</b></li>
|
||||
<li translate>All transaction requests are irreversible.</li>
|
||||
<li translate>The authors of the software, employees and affiliates of Bitpay, copyright holders, and BitPay, Inc. cannot retrieve your private keys or passwords if you lose or forget them and cannot guarantee transaction confirmation as they do not have control over the Bitcoin network.</li>
|
||||
<li translate>To the fullest extent permitted by law, this software is provided “as is” and no representations or warranties can be made of any kind, express or implied, including but not limited to the warranties of merchantability, fitness or a particular purpose and noninfringement.</li>
|
||||
<li translate>You assume any and all risks associated with the use of the software.</li>
|
||||
<li translate>In no event shall the authors of the software, employees and affiliates of Bitpay, copyright holders, or BitPay, Inc. be held liable for any claim, damages or other liability, whether in an action of contract, tort, or otherwise, arising from, out of or in connection with the software.</li>
|
||||
<li translate>We reserve the right to modify this disclaimer from time to time.</li>
|
||||
</ul>
|
||||
</p>
|
||||
<div class="scrollArea">
|
||||
<p class="enable_text_select m0">
|
||||
<div class="size-16 text-gray" translate>Terms of Use</div>
|
||||
<div ng-include="'views/includes/terms.html'"></div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -47,7 +34,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
|
||||
|
|
|
|||
14
public/views/includes/terms.html
Normal file
14
public/views/includes/terms.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<ul>
|
||||
<li translate>The software you are about to use functions as a free, open source, and multi-signature digital wallet.</li>
|
||||
<li translate>The software does not constitute an account where BitPay or other third parties serve as financial intermediaries or custodians of your bitcoin.</li>
|
||||
<li translate>While the software has undergone beta testing and continues to be improved by feedback from the open-source user and developer community, we cannot guarantee that there will be no bugs in the software.</li>
|
||||
<li translate>You acknowledge that your use of this software is at your own discretion and in compliance with all applicable laws.</li>
|
||||
<li translate>You are responsible for safekeeping your passwords, private key pairs, PINs and any other codes you use to access the software.</li>
|
||||
<li translate><b>IF YOU LOSE ACCESS TO YOUR COPAY WALLET OR YOUR ENCRYPTED PRIVATE KEYS AND YOU HAVE NOT SEPARATELY STORED A BACKUP OF YOUR WALLET AND CORRESPONDING PASSWORD, YOU ACKNOWLEDGE AND AGREE THAT ANY BITCOIN YOU HAVE ASSOCIATED WITH THAT COPAY WALLET WILL BECOME INACCESSIBLE.</b></li>
|
||||
<li translate>All transaction requests are irreversible.</li>
|
||||
<li translate>The authors of the software, employees and affiliates of Bitpay, copyright holders, and BitPay, Inc. cannot retrieve your private keys or passwords if you lose or forget them and cannot guarantee transaction confirmation as they do not have control over the Bitcoin network.</li>
|
||||
<li translate>To the fullest extent permitted by law, this software is provided “as is” and no representations or warranties can be made of any kind, express or implied, including but not limited to the warranties of merchantability, fitness or a particular purpose and noninfringement.</li>
|
||||
<li translate>You assume any and all risks associated with the use of the software.</li>
|
||||
<li translate>In no event shall the authors of the software, employees and affiliates of Bitpay, copyright holders, or BitPay, Inc. be held liable for any claim, damages or other liability, whether in an action of contract, tort, or otherwise, arising from, out of or in connection with the software.</li>
|
||||
<li translate>We reserve the right to modify this disclaimer from time to time.</li>
|
||||
</ul>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<h4></h4>
|
||||
<ul class="no-bullet m0">
|
||||
<li ng-click="$root.go('disclaimer')">
|
||||
<li ng-click="$root.go('termOfUse')">
|
||||
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||
<span translate>Terms of Use</span>
|
||||
</li>
|
||||
|
|
|
|||
16
public/views/termOfUse.html
Normal file
16
public/views/termOfUse.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<div
|
||||
class="topbar-container"
|
||||
ng-include="'views/includes/topbar.html'"
|
||||
ng-init="titleSection='Terms of use'; goBackToState = 'about'; noColor = true">
|
||||
</div>
|
||||
<div class="content">
|
||||
<p class="enable_text_select m0">
|
||||
<div ng-include="'views/includes/terms.html'"></div>
|
||||
</p>
|
||||
<div class="row text-center">
|
||||
<p ng-show="lang != 'en'">
|
||||
<a class="center" ng-click="$root.openExternalLink('https://copay.io/disclaimer')" translate>Official English Disclaimer</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="extra-margin-bottom"></div>
|
||||
|
|
@ -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() {});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -263,43 +263,39 @@ angular
|
|||
},
|
||||
}
|
||||
})
|
||||
|
||||
.state('preferencesGlidera', {
|
||||
url: '/preferencesGlidera',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesGlidera.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
.state('preferencesAdvanced', {
|
||||
url: '/preferencesAdvanced',
|
||||
templateUrl: 'views/preferencesAdvanced.html',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesAdvanced.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
.state('preferencesColor', {
|
||||
url: '/preferencesColor',
|
||||
templateUrl: 'views/preferencesColor.html',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesColor.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
.state('preferencesAltCurrency', {
|
||||
.state('preferencesGlidera', {
|
||||
url: '/preferencesGlidera',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesGlidera.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('preferencesAdvanced', {
|
||||
url: '/preferencesAdvanced',
|
||||
templateUrl: 'views/preferencesAdvanced.html',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesAdvanced.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('preferencesColor', {
|
||||
url: '/preferencesColor',
|
||||
templateUrl: 'views/preferencesColor.html',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesColor.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('preferencesAltCurrency', {
|
||||
url: '/preferencesAltCurrency',
|
||||
templateUrl: 'views/preferencesAltCurrency.html',
|
||||
walletShouldBeComplete: true,
|
||||
|
|
@ -378,8 +374,7 @@ angular
|
|||
},
|
||||
}
|
||||
})
|
||||
|
||||
.state('about', {
|
||||
.state('about', {
|
||||
url: '/about',
|
||||
templateUrl: 'views/preferencesAbout.html',
|
||||
walletShouldBeComplete: true,
|
||||
|
|
@ -443,14 +438,22 @@ angular
|
|||
},
|
||||
}
|
||||
})
|
||||
.state('termOfUse', {
|
||||
url: '/termOfUse',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/termOfUse.html',
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('warning', {
|
||||
url: '/warning',
|
||||
controller: 'warningController',
|
||||
templateUrl: 'views/warning.html',
|
||||
needProfile: false
|
||||
})
|
||||
|
||||
.state('add', {
|
||||
.state('add', {
|
||||
url: '/add',
|
||||
needProfile: true,
|
||||
views: {
|
||||
|
|
@ -516,13 +519,15 @@ angular
|
|||
|
||||
// Give us time to open / create the profile
|
||||
event.preventDefault();
|
||||
|
||||
// Try to open local profile
|
||||
profileService.loadAndBindProfile(function(err) {
|
||||
if (err) {
|
||||
if (err.message && err.message.match('NOPROFILE')) {
|
||||
$log.debug('No profile... redirecting');
|
||||
$state.transitionTo('disclaimer');
|
||||
} else if (err.message && err.message.match('NONAGREEDDISCLAIMER')) {
|
||||
$log.debug('Display disclaimer... redirecting');
|
||||
$state.transitionTo('disclaimer');
|
||||
} else {
|
||||
throw new Error(err); // TODO
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ angular.module('copayApp.services').factory('animationService', function(isCordo
|
|||
paperWallet: 13,
|
||||
logs: 13,
|
||||
information: 13,
|
||||
termOfUse: 13,
|
||||
translators: 13,
|
||||
disclaimer: 13,
|
||||
add: 11,
|
||||
create: 12,
|
||||
join: 12,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('go', function($window, $rootScope, $location, $state, profileService, nodeWebkit) {
|
||||
angular.module('copayApp.services').factory('go', function($window, $rootScope, $location, $state, $timeout, profileService, nodeWebkit) {
|
||||
var root = {};
|
||||
|
||||
var hideSidebars = function() {
|
||||
|
|
@ -32,8 +32,7 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope,
|
|||
root.openExternalLink = function(url, target) {
|
||||
if (nodeWebkit.isDefined()) {
|
||||
nodeWebkit.openExternalLink(url);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
target = target || '_blank';
|
||||
var ref = window.open(url, target, 'location=no');
|
||||
}
|
||||
|
|
@ -53,7 +52,7 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope,
|
|||
toggleSidebar(invert);
|
||||
};
|
||||
|
||||
root.walletHome = function() {
|
||||
root.walletHome = function(delayed) {
|
||||
var fc = profileService.focusedClient;
|
||||
if (fc && !fc.isComplete()) {
|
||||
root.path('copayers');
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ angular.module('copayApp.services')
|
|||
return cb(err);
|
||||
}
|
||||
if (!profile) {
|
||||
// Migration??
|
||||
// Migration??
|
||||
storageService.tryToMigrate(function(err, migratedProfile) {
|
||||
if (err) return cb(err);
|
||||
if (!migratedProfile)
|
||||
|
|
@ -150,10 +150,14 @@ angular.module('copayApp.services')
|
|||
return root.bindProfile(profile, cb);
|
||||
})
|
||||
} else {
|
||||
$log.debug('Profile read');
|
||||
return root.bindProfile(profile, cb);
|
||||
storageService.getCopayDisclaimerFlag(function(err, val) {
|
||||
if (!profile.agreeDisclaimer) {
|
||||
if (!val) return cb(new Error('NONAGREEDDISCLAIMER: Non agreed disclaimer'));
|
||||
}
|
||||
$log.debug('Profile read');
|
||||
return root.bindProfile(profile, cb);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -270,8 +274,8 @@ angular.module('copayApp.services')
|
|||
|
||||
// check if exist
|
||||
if (lodash.find(root.profile.credentials, {
|
||||
'walletId': walletData.walletId
|
||||
})) {
|
||||
'walletId': walletData.walletId
|
||||
})) {
|
||||
return cb(gettext('Cannot join the same wallet more that once'));
|
||||
}
|
||||
} catch (ex) {
|
||||
|
|
@ -375,14 +379,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);
|
||||
|
|
@ -514,6 +518,15 @@ angular.module('copayApp.services')
|
|||
});
|
||||
};
|
||||
|
||||
root.storeDisclaimer = function(cb) {
|
||||
storageService.getProfile(function(err, profile) {
|
||||
profile.agreeDisclaimer = true;
|
||||
storageService.storeProfile(profile, function() {
|
||||
return cb(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
root.importLegacyWallet = function(username, password, blob, cb) {
|
||||
var walletClient = bwcService.getClient();
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ angular.module('copayApp.services')
|
|||
return storage.set('profile', text, function(err) {
|
||||
return cb(err, text);
|
||||
});
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
$log.warn('Decrypt error: ', e);
|
||||
return cb('Could not decrypt storage: device ID mismatch');
|
||||
};
|
||||
|
|
@ -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,6 +198,11 @@ angular.module('copayApp.services')
|
|||
storage.remove('config', cb);
|
||||
};
|
||||
|
||||
//for compatibility
|
||||
root.getCopayDisclaimerFlag = function(cb) {
|
||||
storage.get('agreeDisclaimer', cb);
|
||||
};
|
||||
|
||||
root.setRemotePrefsStoredFlag = function(cb) {
|
||||
storage.set('remotePrefStored', true, cb);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue