@@ -7,7 +7,7 @@ var available = function () {
7
7
return new Promise ( function ( resolve , reject ) {
8
8
try {
9
9
resolve (
10
- LAContext . alloc ( ) . init ( ) . canEvaluatePolicyError (
10
+ LAContext . new ( ) . canEvaluatePolicyError (
11
11
LAPolicyDeviceOwnerAuthenticationWithBiometrics , null ) ) ;
12
12
} catch ( ex ) {
13
13
console . log ( "Error in touchid.available: " + ex ) ;
@@ -19,7 +19,7 @@ var available = function () {
19
19
var didFingerprintDatabaseChange = function ( ) {
20
20
return new Promise ( function ( resolve , reject ) {
21
21
try {
22
- var laContext = LAContext . alloc ( ) . init ( ) ;
22
+ var laContext = LAContext . new ( ) ;
23
23
24
24
// we expect the dev to have checked 'isAvailable' already so this should not return an error,
25
25
// we do however need to run canEvaluatePolicy here in order to get a non-nil evaluatedPolicyDomainState
@@ -38,11 +38,12 @@ var didFingerprintDatabaseChange = function () {
38
38
var state = laContext . evaluatedPolicyDomainState ;
39
39
if ( state !== null ) {
40
40
var stateStr = state . base64EncodedStringWithOptions ( 0 ) ;
41
- var storedState = NSUserDefaults . standardUserDefaults ( ) . stringForKey ( FingerprintDatabaseStateKey ) ;
41
+ var standardUserDefaults = utils . ios . getter ( NSUserDefaults , NSUserDefaults . standardUserDefaults ) ;
42
+ var storedState = standardUserDefaults . stringForKey ( FingerprintDatabaseStateKey ) ;
42
43
43
44
// Store enrollment
44
- NSUserDefaults . standardUserDefaults ( ) . setObjectForKey ( stateStr , FingerprintDatabaseStateKey ) ;
45
- NSUserDefaults . standardUserDefaults ( ) . synchronize ( ) ;
45
+ standardUserDefaults . setObjectForKey ( stateStr , FingerprintDatabaseStateKey ) ;
46
+ standardUserDefaults . synchronize ( ) ;
46
47
47
48
// whenever a finger is added/changed/removed the value of the storedState changes,
48
49
// so compare agains a value we previously stored in the context of this app
@@ -64,8 +65,7 @@ var verifyFingerprint = function (arg) {
64
65
try {
65
66
66
67
if ( keychainItemServiceName === null ) {
67
- var bundleID = NSBundle . mainBundle ( ) . infoDictionary . objectForKey ( "CFBundleIdentifier" ) ;
68
- console . log ( bundleID ) ;
68
+ var bundleID = utils . ios . getter ( NSBundle , NSBundle . mainBundle ) . infoDictionary . objectForKey ( "CFBundleIdentifier" ) ;
69
69
keychainItemServiceName = bundleID + ".TouchID" ;
70
70
}
71
71
@@ -75,7 +75,7 @@ var verifyFingerprint = function (arg) {
75
75
}
76
76
77
77
var message = arg !== null && arg . message || "Scan your finger" ;
78
- var query = NSMutableDictionary . alloc ( ) . init ( ) ;
78
+ var query = NSMutableDictionary . new ( ) ;
79
79
query . setObjectForKey ( kSecClassGenericPassword , kSecClass ) ;
80
80
query . setObjectForKey ( keychainItemIdentifier , kSecAttrAccount ) ;
81
81
query . setObjectForKey ( keychainItemServiceName , kSecAttrService ) ;
@@ -102,7 +102,7 @@ var verifyFingerprint = function (arg) {
102
102
var verifyFingerprintWithCustomFallback = function ( arg ) {
103
103
return new Promise ( function ( resolve , reject ) {
104
104
try {
105
- var laContext = LAContext . alloc ( ) . init ( ) ;
105
+ var laContext = LAContext . new ( ) ;
106
106
if ( ! laContext . canEvaluatePolicyError ( LAPolicyDeviceOwnerAuthenticationWithBiometrics , null ) ) {
107
107
reject ( "Not available" ) ;
108
108
return ;
@@ -131,7 +131,7 @@ var verifyFingerprintWithCustomFallback = function (arg) {
131
131
} ;
132
132
133
133
var createKeyChainEntry = function ( ) {
134
- var attributes = NSMutableDictionary . alloc ( ) . init ( ) ;
134
+ var attributes = NSMutableDictionary . new ( ) ;
135
135
attributes . setObjectForKey ( kSecClassGenericPassword , kSecClass ) ;
136
136
attributes . setObjectForKey ( keychainItemIdentifier , kSecAttrAccount ) ;
137
137
attributes . setObjectForKey ( keychainItemServiceName , kSecAttrService ) ;
0 commit comments