adding security popups for resume
This commit is contained in:
parent
9b21292a68
commit
8dfc2de01c
6 changed files with 42 additions and 106 deletions
|
|
@ -1,10 +1,10 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.services')
|
||||
.factory('applicationService', function($rootScope, $timeout, $ionicHistory, $ionicModal, platformInfo, $state) {
|
||||
.factory('applicationService', function($rootScope, $timeout, $ionicHistory, $ionicModal, platformInfo, fingerprintService, openURLService, configService, $state) {
|
||||
var root = {};
|
||||
|
||||
root.successfullUnlocked = false;
|
||||
root.pinIsOpen = false;
|
||||
root.pinModalIsOpen = false;
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var isNW = platformInfo.isNW;
|
||||
|
|
@ -36,17 +36,24 @@ angular.module('copayApp.services')
|
|||
}
|
||||
};
|
||||
|
||||
root.pinModal = function(action) {
|
||||
root.fingerprintModal = function() {
|
||||
fingerprintService.check('unlockingApp', function(err) {
|
||||
if (err) {
|
||||
root.fingerprintModal();
|
||||
return;
|
||||
}
|
||||
root.successfullUnlocked = true;
|
||||
});
|
||||
};
|
||||
|
||||
root.pinModal = function(action) {
|
||||
if (root.pinModalIsOpen) return;
|
||||
|
||||
root.pinIsOpen = true;
|
||||
root.successfullUnlocked = false;
|
||||
var scope = $rootScope.$new(true);
|
||||
console.log(action);
|
||||
console.log("###########################111");
|
||||
scope.action = action;
|
||||
$ionicModal.fromTemplateUrl('views/modals/pin.html', {
|
||||
scope: scope,
|
||||
animation: 'slide-in-up',
|
||||
animation: 'none',
|
||||
backdropClickToClose: false,
|
||||
hardwareBackButtonClose: false
|
||||
}).then(function(modal) {
|
||||
|
|
@ -54,22 +61,25 @@ angular.module('copayApp.services')
|
|||
scope.openModal();
|
||||
});
|
||||
scope.openModal = function() {
|
||||
root.pinModalIsOpen = true;
|
||||
scope.pinModal.show();
|
||||
};
|
||||
scope.hideModal = function() {
|
||||
scope.$emit('pinModalClosed');
|
||||
root.pinModalIsOpen = false;
|
||||
scope.pinModal.hide();
|
||||
};
|
||||
// Cleanup the modal when we're done with it!
|
||||
scope.$on('$destroy', function() {
|
||||
scope.modal.remove();
|
||||
});
|
||||
// Execute action on hide modal
|
||||
scope.$on('modal.hidden', function() {
|
||||
// Execute action
|
||||
});
|
||||
// Execute action on remove modal
|
||||
scope.$on('modal.removed', function() {
|
||||
// Execute action
|
||||
};
|
||||
|
||||
root.appLockModal = function(action) {
|
||||
|
||||
configService.whenAvailable(function(config) {
|
||||
var lockMethod = config.lock && config.lock.method;
|
||||
if (!lockMethod || lockMethod == 'none') return;
|
||||
|
||||
if (lockMethod == 'fingerprint' && fingerprintService.isAvailable()) root.fingerprintModal();
|
||||
if (lockMethod == 'pin') root.pinModal(action);
|
||||
|
||||
});
|
||||
}
|
||||
return root;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue