Skip to content

Commit

Permalink
Merge pull request #7 from ConnectedHomes/fix/android-build-2022
Browse files Browse the repository at this point in the history
Merge main repo v6.0.0 + additional changes till 7th March 2022 into forked branch
  • Loading branch information
udaisshekhawat authored May 19, 2022
2 parents df79be1 + 88aae88 commit ab19d16
Show file tree
Hide file tree
Showing 16 changed files with 24,116 additions and 2,367 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# React Native Fingerprint Scanner

# Looking for Maintainers

This project is no longer actively maintained by the previous maintainers.
If you would like to propose a PR we can merge it though, it needs your effort to continue!

----


[![React Native Version](https://img.shields.io/badge/react--native-latest-blue.svg?style=flat-square)](http://facebook.github.io/react-native/releases)
[![Version](https://img.shields.io/npm/v/react-native-fingerprint-scanner.svg)](https://www.npmjs.com/package/react-native-fingerprint-scanner)
[![NPM](https://img.shields.io/npm/dm/react-native-fingerprint-scanner.svg)](https://www.npmjs.com/package/react-native-fingerprint-scanner)
Expand Down
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
if (project == rootProject) {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}

dependencies {
Expand Down Expand Up @@ -37,17 +37,17 @@ android {

repositories {
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}

dependencies {
implementation 'com.facebook.react:react-native:+'
// androidx:biometric now supports fingerprint back to Android v23
implementation "androidx.biometric:biometric:1.0.1"
implementation "androidx.biometric:biometric:1.1.0"

// retain fingerprintScanner lib for compat with Android v16-23 device-specific drivers (Samsung & MeiZu)
// 1.2.3 is the minimum version compatible with androidx.
// See https://github.com/uccmawei/FingerprintIdentify/issues/74
// (translation https://translate.google.com/translate?sl=zh-CN&tl=en&u=https://github.com/uccmawei/FingerprintIdentify/issues/74)
implementation "com.wei.android.lib:fingerprintidentify:${safeExtGet("fingerprintidentify", "1.2.6")}"
implementation "com.github.uccmawei:fingerprintidentify:${safeExtGet("fingerprintidentify", "1.2.6")}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationRes
}
}

public BiometricPrompt getBiometricPrompt(final Promise promise) {
public BiometricPrompt getBiometricPrompt(final FragmentActivity fragmentActivity, final Promise promise) {
// memoize so can be accessed to cancel
if (biometricPrompt != null) {
return biometricPrompt;
Expand All @@ -104,7 +104,6 @@ public BiometricPrompt getBiometricPrompt(final Promise promise) {
mReactContext.addLifecycleEventListener(this);

AuthCallback authCallback = new AuthCallback(promise);
FragmentActivity fragmentActivity = (FragmentActivity) getCurrentActivity();
Executor executor = Executors.newSingleThreadExecutor();
biometricPrompt = new BiometricPrompt(
fragmentActivity,
Expand All @@ -120,7 +119,11 @@ private void biometricAuthenticate(final String title, final String subtitle, fi
new Runnable() {
@Override
public void run() {
BiometricPrompt bioPrompt = getBiometricPrompt(promise);
FragmentActivity fragmentActivity = (FragmentActivity) mReactContext.getCurrentActivity();

if(fragmentActivity == null) return;

BiometricPrompt bioPrompt = getBiometricPrompt(fragmentActivity, promise);

PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder()
.setDeviceCredentialAllowed(false)
Expand Down Expand Up @@ -207,7 +210,7 @@ public void authenticate(String title, String subtitle, String description, Stri
}

@ReactMethod
public void release() {
public synchronized void release() {
if (requiresLegacyAuthentication()) {
getFingerprintIdentify().cancelIdentify();
mFingerprintIdentify = null;
Expand Down
1 change: 1 addition & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ yarn-error.log
buck-out/
\.buckd/
*.keystore
!debug.keystore

# fastlane
#
Expand Down
219 changes: 219 additions & 0 deletions examples/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation. If none specified and
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
* // default. Can be overridden with ENTRY_FILE environment variable.
* entryFile: "index.android.js",
*
* // https://reactnative.dev/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/

project.ext.react = [
enableHermes: false, // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"

/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false

/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false

/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'

/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);

android {
compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId "com.examples"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}

}
}
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
Binary file added examples/android/app/debug.keystore
Binary file not shown.
9 changes: 3 additions & 6 deletions examples/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ buildscript {
}
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.1")
Expand All @@ -36,6 +32,7 @@ allprojects {
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
3 changes: 3 additions & 0 deletions examples/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@

android.useAndroidX=true
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.101.0
12 changes: 6 additions & 6 deletions examples/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ PODS:
- React-cxxreact (= 0.60.0)
- React-jsi (= 0.60.0)
- React-jsinspector (0.60.0)
- react-native-fingerprint-scanner (2.6.1):
- react-native-fingerprint-scanner (6.0.0):
- React
- React-RCTActionSheet (0.60.0):
- React-Core (= 0.60.0)
Expand Down Expand Up @@ -97,7 +97,7 @@ DEPENDENCIES:
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- react-native-fingerprint-scanner (from `/Users/phillip/Development/react-native-fingerprint-scanner`)
- react-native-fingerprint-scanner (from `../..`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
Expand All @@ -111,7 +111,7 @@ DEPENDENCIES:
- yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
trunk:
- boost-for-react-native

EXTERNAL SOURCES:
Expand All @@ -138,7 +138,7 @@ EXTERNAL SOURCES:
React-jsinspector:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
react-native-fingerprint-scanner:
:path: "/Users/phillip/Development/react-native-fingerprint-scanner"
:path: "../.."
React-RCTActionSheet:
:path: "../node_modules/react-native/Libraries/ActionSheetIOS"
React-RCTAnimation:
Expand Down Expand Up @@ -175,7 +175,7 @@ SPEC CHECKSUMS:
React-jsi: 8e128c4d0d8febc2977ef617d1c09bb54326069c
React-jsiexecutor: 7a3554f703a58963ec80b860144ea0f0e9b910e1
React-jsinspector: d4ed52225912efe0019bb7f1a225aec20f23049a
react-native-fingerprint-scanner: ab4321df8bc1c490da412d05ad39bfc00fb29ea5
react-native-fingerprint-scanner: ac6656f18c8e45a7459302b84da41a44ad96dbbe
React-RCTActionSheet: b27ff3cf3a68f917c46d2b94abf938b625b96570
React-RCTAnimation: 9e4708e5bd65fca8285ce7c0aa076f3f4fa5c2f8
React-RCTBlob: 6eafcc3a24f33785692a7be24918ade607bc8719
Expand All @@ -190,4 +190,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 593715dded8bf0be25016da035dba44a463c1886

COCOAPODS: 1.7.3
COCOAPODS: 1.11.2
Loading

0 comments on commit ab19d16

Please sign in to comment.