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
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $timeout, $state, $log, $window, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService, storageService, $ionicHistory, $ionicScrollDelegate) {
|
||||
angular.module('copayApp.controllers').controller('advancedSettingsController', function($scope, $log, configService, platformInfo) {
|
||||
|
||||
var updateConfig = function() {
|
||||
var config = configService.getSync();
|
||||
|
|
@ -52,13 +52,6 @@ angular.module('copayApp.controllers').controller('advancedSettingsController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.usePincodeChange = function() {
|
||||
$state.go('tabs.pincode', {
|
||||
fromSettings: true,
|
||||
locking: $scope.usePincode.enabled
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
updateConfig();
|
||||
|
|
|
|||
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);
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $ionicHistory, $timeout, $scope, $log, $window, configService) {
|
||||
angular.module('copayApp.controllers').controller('pincodeController', function($state, $stateParams, $ionicHistory, $timeout, $scope, $log, configService) {
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event) {
|
||||
$scope.currentPincode = $scope.newPincode = '';
|
||||
|
|
@ -35,7 +35,7 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
|
|||
$scope.save = function() {
|
||||
if (!isComplete()) return;
|
||||
var config = configService.getSync();
|
||||
var match = config.pincode.value == $scope.currentPincode ? true : false;
|
||||
var match = config.lockapp.pincode.value == $scope.currentPincode ? true : false;
|
||||
|
||||
if (!$scope.locking) {
|
||||
if (match) {
|
||||
|
|
@ -61,9 +61,14 @@ angular.module('copayApp.controllers').controller('pincodeController', function(
|
|||
|
||||
function saveSettings(enabled, value) {
|
||||
var opts = {
|
||||
pincode: {
|
||||
enabled: enabled,
|
||||
value: value
|
||||
lockapp: {
|
||||
pincode: {
|
||||
enabled: enabled,
|
||||
value: value
|
||||
},
|
||||
fingerprint: {
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue