fix disclaimer
This commit is contained in:
parent
68f0157d47
commit
f23df02d0b
4 changed files with 89 additions and 74 deletions
|
|
@ -6,7 +6,9 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
||||||
$scope.lang = uxLanguage.currentLanguage;
|
$scope.lang = uxLanguage.currentLanguage;
|
||||||
|
|
||||||
$scope.goHome = function() {
|
$scope.goHome = function() {
|
||||||
|
storageService.setCopayDisclaimerFlag(function(err) {
|
||||||
go.walletHome();
|
go.walletHome();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var create = function() {
|
var create = function() {
|
||||||
|
|
@ -15,9 +17,12 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
||||||
if (err == 'EEXISTS')
|
if (err == 'EEXISTS') {
|
||||||
return go.walletHome();
|
storageService.getCopayDisclaimerFlag(function(val) {
|
||||||
|
if (val) return go.walletHome();
|
||||||
|
$scope.creatingProfile = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
$log.warn(err);
|
$log.warn(err);
|
||||||
$scope.error = err;
|
$scope.error = err;
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
|
|
@ -25,6 +30,7 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
||||||
$log.warn('Retrying to create profile......');
|
$log.warn('Retrying to create profile......');
|
||||||
create();
|
create();
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$scope.error = "";
|
$scope.error = "";
|
||||||
$scope.creatingProfile = false;
|
$scope.creatingProfile = false;
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,6 @@ angular
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.state('preferencesGlidera', {
|
.state('preferencesGlidera', {
|
||||||
url: '/preferencesGlidera',
|
url: '/preferencesGlidera',
|
||||||
walletShouldBeComplete: true,
|
walletShouldBeComplete: true,
|
||||||
|
|
@ -274,7 +273,6 @@ angular
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.state('preferencesAdvanced', {
|
.state('preferencesAdvanced', {
|
||||||
url: '/preferencesAdvanced',
|
url: '/preferencesAdvanced',
|
||||||
templateUrl: 'views/preferencesAdvanced.html',
|
templateUrl: 'views/preferencesAdvanced.html',
|
||||||
|
|
@ -286,7 +284,6 @@ angular
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.state('preferencesColor', {
|
.state('preferencesColor', {
|
||||||
url: '/preferencesColor',
|
url: '/preferencesColor',
|
||||||
templateUrl: 'views/preferencesColor.html',
|
templateUrl: 'views/preferencesColor.html',
|
||||||
|
|
@ -298,7 +295,6 @@ angular
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.state('preferencesAltCurrency', {
|
.state('preferencesAltCurrency', {
|
||||||
url: '/preferencesAltCurrency',
|
url: '/preferencesAltCurrency',
|
||||||
templateUrl: 'views/preferencesAltCurrency.html',
|
templateUrl: 'views/preferencesAltCurrency.html',
|
||||||
|
|
@ -378,7 +374,6 @@ angular
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.state('about', {
|
.state('about', {
|
||||||
url: '/about',
|
url: '/about',
|
||||||
templateUrl: 'views/preferencesAbout.html',
|
templateUrl: 'views/preferencesAbout.html',
|
||||||
|
|
@ -449,7 +444,6 @@ angular
|
||||||
templateUrl: 'views/warning.html',
|
templateUrl: 'views/warning.html',
|
||||||
needProfile: false
|
needProfile: false
|
||||||
})
|
})
|
||||||
|
|
||||||
.state('add', {
|
.state('add', {
|
||||||
url: '/add',
|
url: '/add',
|
||||||
needProfile: true,
|
needProfile: true,
|
||||||
|
|
@ -516,13 +510,15 @@ angular
|
||||||
|
|
||||||
// Give us time to open / create the profile
|
// Give us time to open / create the profile
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
// Try to open local profile
|
// Try to open local profile
|
||||||
profileService.loadAndBindProfile(function(err) {
|
profileService.loadAndBindProfile(function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.message && err.message.match('NOPROFILE')) {
|
if (err.message && err.message.match('NOPROFILE')) {
|
||||||
$log.debug('No profile... redirecting');
|
$log.debug('No profile... redirecting');
|
||||||
$state.transitionTo('disclaimer');
|
$state.transitionTo('disclaimer');
|
||||||
|
} else if (err.message && err.message.match('NONAGREEDDISCLAIMER')) {
|
||||||
|
$log.debug('Display disclaimer... redirecting');
|
||||||
|
$state.transitionTo('disclaimer');
|
||||||
} else {
|
} else {
|
||||||
throw new Error(err); // TODO
|
throw new Error(err); // TODO
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,10 @@ 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) {
|
storageService.getProfile(function(err, profile) {
|
||||||
if (err) {
|
if (err) {
|
||||||
$rootScope.$emit('Local/DeviceError', err);
|
$rootScope.$emit('Local/DeviceError', err);
|
||||||
|
|
@ -153,7 +157,8 @@ angular.module('copayApp.services')
|
||||||
$log.debug('Profile read');
|
$log.debug('Profile read');
|
||||||
return root.bindProfile(profile, cb);
|
return root.bindProfile(profile, cb);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ angular.module('copayApp.services')
|
||||||
return storage.set('profile', text, function(err) {
|
return storage.set('profile', text, function(err) {
|
||||||
return cb(err, text);
|
return cb(err, text);
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
$log.warn('Decrypt error: ', e);
|
$log.warn('Decrypt error: ', e);
|
||||||
return cb('Could not decrypt storage: device ID mismatch');
|
return cb('Could not decrypt storage: device ID mismatch');
|
||||||
};
|
};
|
||||||
|
|
@ -199,6 +199,14 @@ 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