@capgo/capacitor-native-biometric 5.1.0 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,15 +2,16 @@ ext {
2
2
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
3
  androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
4
4
  androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
5
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
5
6
  }
6
7
 
7
8
  buildscript {
8
9
  repositories {
9
10
  google()
10
- jcenter()
11
+ mavenCentral()
11
12
  }
12
13
  dependencies {
13
- classpath 'com.android.tools.build:gradle:8.0.0'
14
+ classpath 'com.android.tools.build:gradle:8.0.2'
14
15
  }
15
16
  }
16
17
 
@@ -39,20 +40,19 @@ android {
39
40
 
40
41
  repositories {
41
42
  google()
42
- jcenter()
43
43
  mavenCentral()
44
44
  }
45
45
 
46
46
 
47
47
  dependencies {
48
- implementation 'androidx.biometric:biometric:1.0.1'
48
+ implementation 'androidx.biometric:biometric:1.1.0'
49
49
  implementation fileTree(dir: 'libs', include: ['*.jar'])
50
50
  implementation project(':capacitor-android')
51
- implementation 'androidx.appcompat:appcompat:1.1.0'
52
- implementation 'com.google.android.material:material:1.1.0'
53
- implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
54
- implementation 'androidx.navigation:navigation-fragment:2.0.0'
55
- implementation 'androidx.navigation:navigation-ui:2.0.0'
51
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
52
+ implementation 'com.google.android.material:material:1.9.0'
53
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
54
+ implementation 'androidx.navigation:navigation-fragment:2.5.3'
55
+ implementation 'androidx.navigation:navigation-ui:2.5.3'
56
56
  testImplementation "junit:junit:$junitVersion"
57
57
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
58
58
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
@@ -4,15 +4,9 @@ import android.content.Intent;
4
4
  import android.os.Build;
5
5
  import android.os.Bundle;
6
6
  import android.os.Handler;
7
- import android.util.Log;
8
- import android.view.View;
9
7
  import androidx.annotation.NonNull;
10
8
  import androidx.appcompat.app.AppCompatActivity;
11
- import androidx.appcompat.widget.Toolbar;
12
- import androidx.biometric.BiometricConstants;
13
9
  import androidx.biometric.BiometricPrompt;
14
- import com.google.android.material.floatingactionbutton.FloatingActionButton;
15
- import com.google.android.material.snackbar.Snackbar;
16
10
  import ee.forgr.biometric.capacitornativebiometric.R;
17
11
  import java.util.concurrent.Executor;
18
12
 
@@ -136,29 +130,29 @@ public class AuthActivity extends AppCompatActivity {
136
130
  * Convert Auth Error Codes to plugin expected Biometric Auth Errors (in README.md)
137
131
  * This way both iOS and Android return the same error codes for the same authentication failure reasons.
138
132
  * !!IMPORTANT!!: Whenever this is modified, check if similar function in iOS Plugin.swift needs to be modified as well
139
- * @see https://developer.android.com/reference/androidx/biometric/BiometricPrompt#constants
133
+ * @see <a href="https://developer.android.com/reference/androidx/biometric/BiometricPrompt#constants">...</a>
140
134
  * @return BiometricAuthError
141
135
  */
142
136
  public static int convertToPluginErrorCode(int errorCode) {
143
137
  switch (errorCode) {
144
- case BiometricConstants.ERROR_HW_UNAVAILABLE:
145
- case BiometricConstants.ERROR_HW_NOT_PRESENT:
138
+ case BiometricPrompt.ERROR_HW_UNAVAILABLE:
139
+ case BiometricPrompt.ERROR_HW_NOT_PRESENT:
146
140
  return 1;
147
- case BiometricConstants.ERROR_LOCKOUT_PERMANENT:
141
+ case BiometricPrompt.ERROR_LOCKOUT_PERMANENT:
148
142
  return 2;
149
- case BiometricConstants.ERROR_NO_BIOMETRICS:
143
+ case BiometricPrompt.ERROR_NO_BIOMETRICS:
150
144
  return 3;
151
- case BiometricConstants.ERROR_LOCKOUT:
145
+ case BiometricPrompt.ERROR_LOCKOUT:
152
146
  return 4;
153
147
  // Authentication Failure (10) Handled by `onAuthenticationFailed`.
154
148
  // App Cancel (11), Invalid Context (12), and Not Interactive (13) are not valid error codes for Android.
155
- case BiometricConstants.ERROR_NO_DEVICE_CREDENTIAL:
149
+ case BiometricPrompt.ERROR_NO_DEVICE_CREDENTIAL:
156
150
  return 14;
157
- case BiometricConstants.ERROR_TIMEOUT:
158
- case BiometricConstants.ERROR_CANCELED:
151
+ case BiometricPrompt.ERROR_TIMEOUT:
152
+ case BiometricPrompt.ERROR_CANCELED:
159
153
  return 15;
160
- case BiometricConstants.ERROR_USER_CANCELED:
161
- case BiometricConstants.ERROR_NEGATIVE_BUTTON:
154
+ case BiometricPrompt.ERROR_USER_CANCELED:
155
+ case BiometricPrompt.ERROR_NEGATIVE_BUTTON:
162
156
  return 16;
163
157
  default:
164
158
  return 0;
@@ -14,7 +14,6 @@ import android.security.keystore.KeyProperties;
14
14
  import android.security.keystore.StrongBoxUnavailableException;
15
15
  import android.util.Base64;
16
16
  import androidx.activity.result.ActivityResult;
17
- import androidx.biometric.BiometricConstants;
18
17
  import androidx.biometric.BiometricManager;
19
18
  import com.getcapacitor.JSObject;
20
19
  import com.getcapacitor.Plugin;
@@ -124,7 +123,7 @@ public class NativeBiometric extends Plugin {
124
123
  // @see https://developer.android.com/reference/androidx/biometric/BiometricManager#canAuthenticate(int)
125
124
  boolean fallbackAvailable = useFallback && this.deviceHasCredentials();
126
125
  if (useFallback && !fallbackAvailable) {
127
- canAuthenticateResult = BiometricConstants.ERROR_NO_DEVICE_CREDENTIAL;
126
+ canAuthenticateResult = BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE;
128
127
  }
129
128
 
130
129
  boolean isAvailable =
@@ -496,6 +495,10 @@ public class NativeBiometric extends Plugin {
496
495
  KeyguardManager keyguardManager = (KeyguardManager) getActivity()
497
496
  .getSystemService(Context.KEYGUARD_SERVICE);
498
497
  // Can only use fallback if the device has a pin/pattern/password lockscreen.
499
- return keyguardManager.isDeviceSecure();
498
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
499
+ return keyguardManager.isDeviceSecure();
500
+ } else {
501
+ return keyguardManager.isKeyguardSecure();
502
+ }
500
503
  }
501
504
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-native-biometric",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "This plugin gives access to the native biometric apis for android and iOS",
5
5
  "main": "dist/esm/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -1,58 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "1300"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "YES"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "0ECF3D6BFCC08377AE23B027EE1D4371"
18
- BuildableName = "Capacitor.framework"
19
- BlueprintName = "Capacitor"
20
- ReferencedContainer = "container:Pods.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- </BuildActionEntries>
24
- </BuildAction>
25
- <TestAction
26
- buildConfiguration = "Debug"
27
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
- shouldUseLaunchSchemeArgsEnv = "YES">
30
- <Testables>
31
- </Testables>
32
- </TestAction>
33
- <LaunchAction
34
- buildConfiguration = "Debug"
35
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
- launchStyle = "0"
38
- useCustomWorkingDirectory = "NO"
39
- ignoresPersistentStateOnLaunch = "NO"
40
- debugDocumentVersioning = "YES"
41
- debugServiceExtension = "internal"
42
- allowLocationSimulation = "YES">
43
- </LaunchAction>
44
- <ProfileAction
45
- buildConfiguration = "Release"
46
- shouldUseLaunchSchemeArgsEnv = "YES"
47
- savedToolIdentifier = ""
48
- useCustomWorkingDirectory = "NO"
49
- debugDocumentVersioning = "YES">
50
- </ProfileAction>
51
- <AnalyzeAction
52
- buildConfiguration = "Debug">
53
- </AnalyzeAction>
54
- <ArchiveAction
55
- buildConfiguration = "Release"
56
- revealArchiveInOrganizer = "YES">
57
- </ArchiveAction>
58
- </Scheme>
@@ -1,58 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "1300"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "YES"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "400AE44335852A2D8D746557E21E8EB0"
18
- BuildableName = "Cordova.framework"
19
- BlueprintName = "CapacitorCordova"
20
- ReferencedContainer = "container:Pods.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- </BuildActionEntries>
24
- </BuildAction>
25
- <TestAction
26
- buildConfiguration = "Debug"
27
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
- shouldUseLaunchSchemeArgsEnv = "YES">
30
- <Testables>
31
- </Testables>
32
- </TestAction>
33
- <LaunchAction
34
- buildConfiguration = "Debug"
35
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
- launchStyle = "0"
38
- useCustomWorkingDirectory = "NO"
39
- ignoresPersistentStateOnLaunch = "NO"
40
- debugDocumentVersioning = "YES"
41
- debugServiceExtension = "internal"
42
- allowLocationSimulation = "YES">
43
- </LaunchAction>
44
- <ProfileAction
45
- buildConfiguration = "Release"
46
- shouldUseLaunchSchemeArgsEnv = "YES"
47
- savedToolIdentifier = ""
48
- useCustomWorkingDirectory = "NO"
49
- debugDocumentVersioning = "YES">
50
- </ProfileAction>
51
- <AnalyzeAction
52
- buildConfiguration = "Debug">
53
- </AnalyzeAction>
54
- <ArchiveAction
55
- buildConfiguration = "Release"
56
- revealArchiveInOrganizer = "YES">
57
- </ArchiveAction>
58
- </Scheme>
@@ -1,58 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "1300"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "YES"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "10467BF5021453A5297325418ACC4E64"
18
- BuildableName = "Pods_Plugin.framework"
19
- BlueprintName = "Pods-Plugin"
20
- ReferencedContainer = "container:Pods.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- </BuildActionEntries>
24
- </BuildAction>
25
- <TestAction
26
- buildConfiguration = "Debug"
27
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
- shouldUseLaunchSchemeArgsEnv = "YES">
30
- <Testables>
31
- </Testables>
32
- </TestAction>
33
- <LaunchAction
34
- buildConfiguration = "Debug"
35
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
- launchStyle = "0"
38
- useCustomWorkingDirectory = "NO"
39
- ignoresPersistentStateOnLaunch = "NO"
40
- debugDocumentVersioning = "YES"
41
- debugServiceExtension = "internal"
42
- allowLocationSimulation = "YES">
43
- </LaunchAction>
44
- <ProfileAction
45
- buildConfiguration = "Release"
46
- shouldUseLaunchSchemeArgsEnv = "YES"
47
- savedToolIdentifier = ""
48
- useCustomWorkingDirectory = "NO"
49
- debugDocumentVersioning = "YES">
50
- </ProfileAction>
51
- <AnalyzeAction
52
- buildConfiguration = "Debug">
53
- </AnalyzeAction>
54
- <ArchiveAction
55
- buildConfiguration = "Release"
56
- revealArchiveInOrganizer = "YES">
57
- </ArchiveAction>
58
- </Scheme>
@@ -1,58 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "1300"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "YES"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "401C34F4B17A319A7086C93431C92B42"
18
- BuildableName = "Pods_PluginTests.framework"
19
- BlueprintName = "Pods-PluginTests"
20
- ReferencedContainer = "container:Pods.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- </BuildActionEntries>
24
- </BuildAction>
25
- <TestAction
26
- buildConfiguration = "Debug"
27
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
- shouldUseLaunchSchemeArgsEnv = "YES">
30
- <Testables>
31
- </Testables>
32
- </TestAction>
33
- <LaunchAction
34
- buildConfiguration = "Debug"
35
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
- launchStyle = "0"
38
- useCustomWorkingDirectory = "NO"
39
- ignoresPersistentStateOnLaunch = "NO"
40
- debugDocumentVersioning = "YES"
41
- debugServiceExtension = "internal"
42
- allowLocationSimulation = "YES">
43
- </LaunchAction>
44
- <ProfileAction
45
- buildConfiguration = "Release"
46
- shouldUseLaunchSchemeArgsEnv = "YES"
47
- savedToolIdentifier = ""
48
- useCustomWorkingDirectory = "NO"
49
- debugDocumentVersioning = "YES">
50
- </ProfileAction>
51
- <AnalyzeAction
52
- buildConfiguration = "Debug">
53
- </AnalyzeAction>
54
- <ArchiveAction
55
- buildConfiguration = "Release"
56
- revealArchiveInOrganizer = "YES">
57
- </ArchiveAction>
58
- </Scheme>
@@ -1,31 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>SchemeUserState</key>
6
- <dict>
7
- <key>Capacitor.xcscheme</key>
8
- <dict>
9
- <key>isShown</key>
10
- <false/>
11
- </dict>
12
- <key>CapacitorCordova.xcscheme</key>
13
- <dict>
14
- <key>isShown</key>
15
- <false/>
16
- </dict>
17
- <key>Pods-Plugin.xcscheme</key>
18
- <dict>
19
- <key>isShown</key>
20
- <false/>
21
- </dict>
22
- <key>Pods-PluginTests.xcscheme</key>
23
- <dict>
24
- <key>isShown</key>
25
- <false/>
26
- </dict>
27
- </dict>
28
- <key>SuppressBuildableAutocreation</key>
29
- <dict/>
30
- </dict>
31
- </plist>