add dead view (wip) - fix last/current state
This commit is contained in:
parent
824362af7c
commit
014995fd36
5 changed files with 79 additions and 13 deletions
13
src/js/controllers/deadview.js
Normal file
13
src/js/controllers/deadview.js
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('deadviewController', function($state, $scope, $ionicHistory, fingerprintService) {
|
||||||
|
|
||||||
|
$scope.requestFingerprint = function() {
|
||||||
|
fingerprintService.check('unlockingApp', function(err) {
|
||||||
|
if (err) return;
|
||||||
|
$state.transitionTo('tabs.home').then(function() {
|
||||||
|
$ionicHistory.clearHistory();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('lockappController', function($state, $scope, $log, configService, popupService, gettextCatalog, appConfigService) {
|
angular.module('copayApp.controllers').controller('lockappController', function($state, $scope, $timeout, $log, configService, popupService, gettextCatalog, appConfigService) {
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event) {
|
$scope.$on("$ionicView.beforeEnter", function(event) {
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
|
|
@ -34,6 +34,9 @@ angular.module('copayApp.controllers').controller('lockappController', function(
|
||||||
$scope.useFingerprint = {
|
$scope.useFingerprint = {
|
||||||
enabled: false
|
enabled: false
|
||||||
};
|
};
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$apply();
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
@ -45,6 +48,9 @@ angular.module('copayApp.controllers').controller('lockappController', function(
|
||||||
$scope.usePincode = {
|
$scope.usePincode = {
|
||||||
enabled: false
|
enabled: false
|
||||||
};
|
};
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$apply();
|
||||||
|
});
|
||||||
var opts = {
|
var opts = {
|
||||||
lockapp: {
|
lockapp: {
|
||||||
pincode: {
|
pincode: {
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,18 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
templateUrl: 'views/pincode.html',
|
templateUrl: 'views/pincode.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Dead state - locked
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
.state('deadview', {
|
||||||
|
url: '/deadview/',
|
||||||
|
controller: 'deadviewController',
|
||||||
|
templateUrl: 'views/deadview.html',
|
||||||
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* URI
|
* URI
|
||||||
|
|
@ -1122,7 +1134,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.run(function($rootScope, $state, $location, $log, $timeout, startupService, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) {
|
.run(function($rootScope, $state, $location, $log, $timeout, startupService, fingerprintService, $ionicHistory, $ionicPlatform, $window, appConfigService, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService, configService, /* plugins START HERE => */ coinbaseService, glideraService, amazonService, bitpayCardService) {
|
||||||
|
|
||||||
uxLanguage.init();
|
uxLanguage.init();
|
||||||
|
|
||||||
|
|
@ -1185,9 +1197,22 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
|
|
||||||
$ionicPlatform.on('resume', function() {
|
$ionicPlatform.on('resume', function() {
|
||||||
configService.whenAvailable(function(config) {
|
configService.whenAvailable(function(config) {
|
||||||
if (platformInfo.isCordova && config.pincode && config.pincode.enabled) {
|
var nextView;
|
||||||
$state.go('pincode');
|
var lockapp = config.lockapp;
|
||||||
}
|
if (fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) {
|
||||||
|
fingerprintService.check('unlockingApp', function(err) {
|
||||||
|
if (err) nextView = 'deadview';
|
||||||
|
else nextView = $ionicHistory.currentStateName();
|
||||||
|
goTo(nextView);
|
||||||
|
});
|
||||||
|
} else if (platformInfo.isCordova && lockapp.pincode && lockapp.pincode.enabled) {
|
||||||
|
goTo('pincode');
|
||||||
|
} else
|
||||||
|
goTo('tabs.home');
|
||||||
|
|
||||||
|
function goTo(nextView) {
|
||||||
|
$state.go(nextView);
|
||||||
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1232,16 +1257,23 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
historyRoot: true
|
historyRoot: true
|
||||||
});
|
});
|
||||||
configService.whenAvailable(function(config) {
|
configService.whenAvailable(function(config) {
|
||||||
|
var lockapp = config.lockapp;
|
||||||
startupService.ready();
|
startupService.ready();
|
||||||
if (platformInfo.isCordova && config.lockapp.pincode && config.lockapp.pincode.enabled) {
|
if (fingerprintService.isAvailable() && lockapp.fingerprint && lockapp.fingerprint.enabled) {
|
||||||
$state.transitionTo('pincode').then(function() {
|
fingerprintService.check('unlockingApp', function(err) {
|
||||||
|
if (err) goTo('deadview');
|
||||||
|
else goTo('tabs.home');
|
||||||
|
});
|
||||||
|
} else if (platformInfo.isCordova && lockapp.pincode && lockapp.pincode.enabled) {
|
||||||
|
goTo('pincode');
|
||||||
|
} else
|
||||||
|
goTo('tabs.home');
|
||||||
|
|
||||||
|
function goTo(nextView) {
|
||||||
|
$state.transitionTo(nextView).then(function() {
|
||||||
$ionicHistory.clearHistory();
|
$ionicHistory.clearHistory();
|
||||||
});
|
});
|
||||||
} else {
|
};
|
||||||
$state.transitionTo('tabs.home').then(function() {
|
|
||||||
$ionicHistory.clearHistory();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ angular.module('copayApp.services').factory('fingerprintService', function($log,
|
||||||
function(msg) {
|
function(msg) {
|
||||||
FingerprintAuth.isAvailable(function(result) {
|
FingerprintAuth.isAvailable(function(result) {
|
||||||
|
|
||||||
if (result.isAvailable)
|
if (result.isAvailable)
|
||||||
_isAvailable = 'ANDROID';
|
_isAvailable = 'ANDROID';
|
||||||
|
|
||||||
}, function() {
|
}, function() {
|
||||||
|
|
@ -71,6 +71,7 @@ angular.module('copayApp.services').factory('fingerprintService', function($log,
|
||||||
|
|
||||||
var isNeeded = function(client) {
|
var isNeeded = function(client) {
|
||||||
if (!_isAvailable) return false;
|
if (!_isAvailable) return false;
|
||||||
|
if (client === 'unlockingApp') return true;
|
||||||
|
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
config.touchIdFor = config.touchIdFor || {};
|
config.touchIdFor = config.touchIdFor || {};
|
||||||
|
|
@ -84,7 +85,7 @@ angular.module('copayApp.services').factory('fingerprintService', function($log,
|
||||||
|
|
||||||
root.check = function(client, cb) {
|
root.check = function(client, cb) {
|
||||||
if (isNeeded(client)) {
|
if (isNeeded(client)) {
|
||||||
$log.debug('FingerPrint Service:', _isAvailable);
|
$log.debug('FingerPrint Service:', _isAvailable);
|
||||||
if (_isAvailable == 'IOS')
|
if (_isAvailable == 'IOS')
|
||||||
return requestTouchId(cb);
|
return requestTouchId(cb);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
14
www/views/deadview.html
Normal file
14
www/views/deadview.html
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<ion-view>
|
||||||
|
<ion-nav-bar class="bar-royal">
|
||||||
|
<ion-nav-title>{{'App Locked' | translate}}</ion-nav-title>
|
||||||
|
</ion-nav-bar>
|
||||||
|
|
||||||
|
<ion-content>
|
||||||
|
<div class="">
|
||||||
|
APP LOCKED
|
||||||
|
</div>
|
||||||
|
<div class="" ng-click="requestFingerprint()">
|
||||||
|
Request Fingerprint Authentication
|
||||||
|
</div>
|
||||||
|
</ion-content>
|
||||||
|
</ion-view>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue