Bug/select wallet incomplete / Refactor wallet Services (#4159)
* Addressbook: display error if select an incomplete wallet * Check if wallet is complete/needs_backup for Glidera and Coinbase * Ref/create a walletService * Ref. walletService * Fix Glidera and Coinbase * Removes txService * Fix glidera connection for mobile. Fix bitcode for xcode * Fix duplicated entry * Revert "Bump bwc version 2.3.1" * adds karma-mocha * Refactor * Refactor lock function * Refactor reject, remove and broadcast tx * add walletService tests WIP * add walletService tests WIP 2 * merge * update tests to mocha * fix tests. Angular 1.5? * Fix test * Generate angular-bwc before testing * Rever gitignore * Wording
This commit is contained in:
parent
aee30ec151
commit
98471e952a
27 changed files with 698 additions and 628 deletions
40
src/js/services/fingerprintService.js
Normal file
40
src/js/services/fingerprintService.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('fingerprintService', function(gettextCatalog, configService) {
|
||||
var root = {};
|
||||
|
||||
var requestTouchId = function(cb) {
|
||||
try {
|
||||
window.plugins.touchid.verifyFingerprint(
|
||||
gettextCatalog.getString('Scan your fingerprint please'),
|
||||
function(msg) {
|
||||
$log.debug('Touch ID OK');
|
||||
return cb();
|
||||
},
|
||||
function(msg) {
|
||||
$log.debug('Touch ID Failed:' + JSON.stringify(msg));
|
||||
return cb(gettextCatalog.getString('Touch ID Failed') + ': ' + msg.localizedDescription);
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
$log.debug('Touch ID Failed:' + JSON.stringify(e));
|
||||
return cb(gettextCatalog.getString('Touch ID Failed'));
|
||||
};
|
||||
};
|
||||
|
||||
root.isAvailable = function(client) {
|
||||
var config = configService.getSync();
|
||||
config.touchIdFor = config.touchIdFor || {};
|
||||
return (window.touchidAvailable && config.touchIdFor[client.credentials.walletId]);
|
||||
};
|
||||
|
||||
root.check = function(client, cb) {
|
||||
if (root.isAvailable()) {
|
||||
requestTouchId(cb);
|
||||
} else {
|
||||
return cb();
|
||||
}
|
||||
};
|
||||
|
||||
return root;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue