Skip to content

Commit

Permalink
feat!: capacitor 6
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Apr 30, 2024
1 parent 9059fd0 commit cfe94d5
Show file tree
Hide file tree
Showing 30 changed files with 1,406 additions and 1,173 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'com.android.tools.build:gradle:8.2.1'
}
}

apply plugin: 'com.android.library'

android {
namespace "ee.forgr.biometric.capacitornativebiometric"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry
.getInstrumentation()
Context appContext = InstrumentationRegistry.getInstrumentation()
.getTargetContext();

assertEquals("com.getcapacitor.android", appContext.getPackageName());
Expand Down
46 changes: 23 additions & 23 deletions android/src/main/java/ee/forgr/biometric/AuthActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,31 @@ protected void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
executor = this.getMainExecutor();
} else {
executor =
new Executor() {
@Override
public void execute(Runnable command) {
new Handler().post(command);
}
};
executor = new Executor() {
@Override
public void execute(Runnable command) {
new Handler().post(command);
}
};
}

BiometricPrompt.PromptInfo.Builder builder = new BiometricPrompt.PromptInfo.Builder()
.setTitle(
getIntent().hasExtra("title")
? getIntent().getStringExtra("title")
: "Authenticate"
)
.setSubtitle(
getIntent().hasExtra("subtitle")
? getIntent().getStringExtra("subtitle")
: null
)
.setDescription(
getIntent().hasExtra("description")
? getIntent().getStringExtra("description")
: null
);
BiometricPrompt.PromptInfo.Builder builder =
new BiometricPrompt.PromptInfo.Builder()
.setTitle(
getIntent().hasExtra("title")
? getIntent().getStringExtra("title")
: "Authenticate"
)
.setSubtitle(
getIntent().hasExtra("subtitle")
? getIntent().getStringExtra("subtitle")
: null
)
.setDescription(
getIntent().hasExtra("description")
? getIntent().getStringExtra("description")
: null
);

boolean useFallback = getIntent().getBooleanExtra("useFallback", false);

Expand Down
29 changes: 14 additions & 15 deletions android/src/main/java/ee/forgr/biometric/NativeBiometric.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ public void isAvailable(PluginCall call) {
}

boolean isAvailable =
(
canAuthenticateResult == BiometricManager.BIOMETRIC_SUCCESS ||
fallbackAvailable
);
(canAuthenticateResult == BiometricManager.BIOMETRIC_SUCCESS ||
fallbackAvailable);
ret.put("isAvailable", isAvailable);

if (!isAvailable) {
Expand Down Expand Up @@ -365,13 +363,14 @@ private Key generateKey(String KEY_ALIAS, boolean isStrongBoxBacked)
KeyProperties.KEY_ALGORITHM_AES,
ANDROID_KEY_STORE
);
KeyGenParameterSpec.Builder paramBuilder = new KeyGenParameterSpec.Builder(
KEY_ALIAS,
KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT
)
.setBlockModes(KeyProperties.BLOCK_MODE_GCM)
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
.setRandomizedEncryptionRequired(false);
KeyGenParameterSpec.Builder paramBuilder =
new KeyGenParameterSpec.Builder(
KEY_ALIAS,
KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT
)
.setBlockModes(KeyProperties.BLOCK_MODE_GCM)
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
.setRandomizedEncryptionRequired(false);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
paramBuilder.setUnlockedDeviceRequired(true);
Expand All @@ -387,8 +386,8 @@ private Key generateKey(String KEY_ALIAS, boolean isStrongBoxBacked)

private Key getKey(String KEY_ALIAS)
throws GeneralSecurityException, IOException {
KeyStore.SecretKeyEntry secretKeyEntry = (KeyStore.SecretKeyEntry) getKeyStore()
.getEntry(KEY_ALIAS, null);
KeyStore.SecretKeyEntry secretKeyEntry =
(KeyStore.SecretKeyEntry) getKeyStore().getEntry(KEY_ALIAS, null);
if (secretKeyEntry != null) {
return secretKeyEntry.getSecretKey();
}
Expand Down Expand Up @@ -428,8 +427,8 @@ private Key getAESKey(String KEY_ALIAS)

private KeyStore.PrivateKeyEntry getPrivateKeyEntry(String KEY_ALIAS)
throws NoSuchProviderException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, CertificateException, KeyStoreException, IOException, UnrecoverableEntryException {
KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) getKeyStore()
.getEntry(KEY_ALIAS, null);
KeyStore.PrivateKeyEntry privateKeyEntry =
(KeyStore.PrivateKeyEntry) getKeyStore().getEntry(KEY_ALIAS, null);

if (privateKeyEntry == null) {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(
Expand Down
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
extends: "@ionic/eslint-config/recommended",
files: ["src/**/*.tss"],
ignore: ["build", "dist", "example"],
};
10 changes: 0 additions & 10 deletions ios/PluginTests/PluginTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ import Capacitor

class PluginTests: XCTestCase {

override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}

func testEcho() {
// This is an example of a functional test case for a plugin.
// Use XCTAssert and related functions to verify your tests produce the correct results.
Expand Down
10 changes: 5 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- Capacitor (5.0.0):
- Capacitor (6.0.0):
- CapacitorCordova
- CapacitorCordova (5.0.0)
- CapacitorCordova (6.0.0)

DEPENDENCIES:
- "Capacitor (from `../node_modules/@capacitor/ios`)"
Expand All @@ -14,9 +14,9 @@ EXTERNAL SOURCES:
:path: "../node_modules/@capacitor/ios"

SPEC CHECKSUMS:
Capacitor: b332cb737d447561e854039fb72195206685dce2
CapacitorCordova: 4ea17670ee562680988a7ce9db68dee5160fe564
Capacitor: 559d073c4ca6c27f8e7002c807eea94c3ba435a9
CapacitorCordova: 8c4bfdf69368512e85b1d8b724dd7546abeb30af

PODFILE CHECKSUM: 1033dea949db4aa66cc0404a8baadac4a30dd025

COCOAPODS: 1.12.1
COCOAPODS: 1.15.2
13 changes: 5 additions & 8 deletions ios/Pods/Local Podspecs/Capacitor.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions ios/Pods/Local Podspecs/CapacitorCordova.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions ios/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cfe94d5

Please sign in to comment.