Fix setting touchId

This commit is contained in:
Gustavo Maximiliano Cortez 2016-01-22 01:59:20 -03:00
commit b38e2f6ef3
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
2 changed files with 15 additions and 7 deletions

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $timeout, $log, configService, profileService) {
function($scope, $rootScope, $timeout, $log, configService, profileService, txSignService) {
var fc = profileService.focusedClient;
$scope.deleted = false;
@ -75,7 +75,7 @@ angular.module('copayApp.controllers').controller('preferencesController',
};
opts.touchIdFor[walletId] = newVal;
$rootScope.$emit('Local/RequestTouchid', function(err) {
txSignService.setTouchId(function(err) {
if (err) {
$log.debug(err);
$timeout(function() {

View file

@ -2,7 +2,6 @@
angular.module('copayApp.services').factory('txSignService', function($rootScope, profileService, gettextCatalog, lodash, trezor, ledger, configService, bwsError, $log) {
var root = {};
var config = configService.getSync();
var reportSigningStatus = function(opts) {
if (!opts.reporterFn) return;
@ -41,17 +40,26 @@ angular.module('copayApp.services').factory('txSignService', function($rootScope
return cb();
},
function(msg) {
$log.debug('Touch ID Failed:' + msg);
return cb(gettext('Touch ID Failed:') + 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:' + e);
return cb(gettext('Touch ID Failed:') + e);
$log.debug('Touch ID Failed:' + JSON.stringify(e));
return cb(gettextCatalog.getString('Touch ID Failed'));
};
};
root.setTouchId = function(cb) {
if (window.touchidAvailable) {
requestTouchId(cb);
} else {
return cb();
}
};
root.checkTouchId = function(cb) {
var config = configService.getSync();
var fc = profileService.focusedClient;
config.touchIdFor = config.touchIdFor || {};
if (window.touchidAvailable && config.touchIdFor[fc.credentials.walletId]) {