add fingerprint option - add lock app view and options
This commit is contained in:
parent
d4c8576032
commit
824362af7c
7 changed files with 121 additions and 26 deletions
65
src/js/controllers/lockapp.js
Normal file
65
src/js/controllers/lockapp.js
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('lockappController', function($state, $scope, $log, configService, popupService, gettextCatalog, appConfigService) {
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event) {
|
||||
var config = configService.getSync();
|
||||
$scope.fingerprintAvailable = true;
|
||||
// $scope.fingerprintAvailable = fingerprintService.isAvailable();
|
||||
|
||||
$scope.usePincode = {
|
||||
enabled: config.lockapp ? config.lockapp.pincode.enabled : false
|
||||
};
|
||||
$scope.useFingerprint = {
|
||||
enabled: config.lockapp ? config.lockapp.fingerprint.enabled : false
|
||||
};
|
||||
});
|
||||
|
||||
$scope.usePincodeChange = function() {
|
||||
$state.go('tabs.lockapp.pincode', {
|
||||
fromSettings: true,
|
||||
locking: $scope.usePincode.enabled
|
||||
});
|
||||
};
|
||||
|
||||
$scope.useFingerprintChange = function() {
|
||||
if ($scope.usePincode.enabled) {
|
||||
var message = gettextCatalog.getString('{{appName}} is protected by Pin Code. Are you sure you want to disable it?', {
|
||||
appName: appConfigService.nameCase
|
||||
});
|
||||
var okText = gettextCatalog.getString('Yes');
|
||||
var cancelText = gettextCatalog.getString('Cancel');
|
||||
popupService.showConfirm(null, message, okText, cancelText, function(ok) {
|
||||
if (!ok) {
|
||||
$scope.useFingerprint = {
|
||||
enabled: false
|
||||
};
|
||||
return;
|
||||
}
|
||||
saveConfig();
|
||||
});
|
||||
} else
|
||||
saveConfig();
|
||||
|
||||
function saveConfig() {
|
||||
$scope.usePincode = {
|
||||
enabled: false
|
||||
};
|
||||
var opts = {
|
||||
lockapp: {
|
||||
pincode: {
|
||||
enabled: false,
|
||||
value: ''
|
||||
},
|
||||
fingerprint: {
|
||||
enabled: $scope.useFingerprint.enabled
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
configService.set(opts, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue