Skip to content

Commit

Permalink
Update Example Compatibility to RN 0.70.9 + biometric-alpha05
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-sam committed Apr 24, 2023
1 parent 5531f6d commit d0b49bf
Show file tree
Hide file tree
Showing 15 changed files with 15,314 additions and 297 deletions.
51 changes: 44 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,26 @@ Updated this README to give the fork version
# React Native Touch ID (Forked version)
# FORK version details

[![react-native version](https://img.shields.io/badge/react--native-0.66.3-green.svg?style=flat-square)](https://github.com/facebook/react-native)
[![react-native version](https://img.shields.io/badge/react--native-0.70.9-yellowgreen)](https://github.com/facebook/react-native)
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/joe-sam/react-native-touch-id)


This fork of the library replaces the deprecated android fingerprint lib for the new android biometric X
and replaces the old examples with react native 0.66.3 compatible samples.
and replaces the old examples with react native 0.70.9 compatible samples.

This MAY require an additional step
**gradle wrapper --gradle-version 6.9**
as I do not use the wrapper.
It is included in source control merely for convenience.

The included examples may need the gradle wrapper upgraded. To upgrade or use your gradle wrapper
~~~
./gradlew wrapper --gradle-version=7.5.1
~~~
See the script file to know how to build the examples without fetching or cloning the package again, (useful for local builds).

Script workflow using npm
~~~
# remove the old package version
rm react-native-touch-id-4.4.7.tgz
rm react-native-touch-id-4.4.8.tgz
# rebuild the android version
cd android
gradle clean build
Expand All @@ -32,20 +35,54 @@ See the script file to know how to build the examples without fetching or clonin
# remove and reinclude local version from examples
cd examples/AndroidXBiometricAuthExample
npm uninstall react-native-touch-id
npm install ../../react-native-touch-id-4.4.7.tgz
npm install ../../react-native-touch-id-4.4.8.tgz
cd android
gradle clean build
cd ..
# remove and reinclude local version from examples
cd ../AndroidXTouchIDExample
npm uninstall react-native-touch-id
npm install ../../react-native-touch-id-4.4.7.tgz
npm install ../../react-native-touch-id-4.4.8.tgz
cd android
gradle clean build
cd ..
# launch example from current folder
react-native run-android
~~~

Using yarn has a similar workflow
~~~
# remove the old package version
rm react-native-touch-id-4.4.8.tgz
# rebuild the android version
cd android
./gradlew clean --info
cd ..
# repackage the local version
yarn pack
# example packs to a default NAME + VERSION react-native-touch-id-v4.4.8.tgz **Note the 'v' prefix added by yarn if shifting from npm to yarn**
# remove the old local version and reinclude new local version from examples
cd examples/AndroidXBiometricAuthExample
yarn remove react-native-touch-id
yarn add ../../react-native-touch-id-v4.4.8.tgz
cd android
gradle clean build
cd ..
# launch example from current folder
yarn android
# remove old local version and reinclude new local version from examples
cd ../AndroidXTouchIDExample
yarn remove react-native-touch-id
yarn add ../../react-native-touch-id-v4.4.8.tgz
cd android
./gradlew clean --info
cd ..
# launch example from current folder
yarn android
~~~
## Original Documentation

- [Install](https://github.com/naoufal/react-native-touch-id#install)
Expand Down
37 changes: 9 additions & 28 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,28 @@ buildscript {
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
if (project == rootProject) {

repositories {
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
maven { url 'https://www.jitpack.io' }
}

dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
classpath("com.android.tools.build:gradle:7.2.1")
}
}
}

apply plugin: 'com.android.library'


android {
compileSdkVersion safeExtGet('compileSdkVersion', 31)
buildToolsVersion safeExtGet('buildToolsVersion', '30.0.3')
compileSdkVersion safeExtGet('compileSdkVersion', 33)
buildToolsVersion safeExtGet('buildToolsVersion', '33.0.2')

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 31)
targetSdkVersion safeExtGet('targetSdkVersion', 33)
versionCode 1
versionName "1.0"
}
Expand All @@ -49,23 +41,12 @@ android {
}

repositories {
mavenCentral()
mavenLocal()

maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral()
google()
maven { url 'https://www.jitpack.io' }

}

dependencies {
api 'com.facebook.react:react-native:+'
api 'androidx.biometric:biometric:1.2.0-alpha04'
implementation 'com.facebook.react:react-native'
implementation 'androidx.biometric:biometric:1.2.0-alpha05'
}
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ android.useAndroidX=true
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.99.0
FLIPPER_VERSION=0.125.0
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
8 changes: 4 additions & 4 deletions examples/AndroidXBiometricAuthExample/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

buildscript {
ext {
buildToolsVersion = "30.0.3"
buildToolsVersion = "33.0.2"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
compileSdkVersion = 33
targetSdkVersion = 33
ndkVersion = "21.4.7075529"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
classpath("com.android.tools.build:gradle:7.2.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ android.useAndroidX=true
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.99.0
FLIPPER_VERSION=0.125.0
org.gradle.daemon=true
#org.gradle.jvmargs=-Xmx4096m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 5 additions & 5 deletions examples/AndroidXBiometricAuthExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"lint": "eslint ."
},
"dependencies": {
"react": "17.0.2",
"react-native": "0.66.3",
"react-native-touch-id": "file:../../react-native-touch-id-4.4.7.tgz",
"react": "18.1.0",
"react-native": "0.70.9",
"react-native-touch-id": "file:../../react-native-touch-id-v4.4.8.tgz",
"uuid": "^8.3.2"
},
"devDependencies": {
Expand All @@ -23,10 +23,10 @@
"babel-jest": "26.6.3",
"eslint": "^7.0.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "0.66.2",
"node-notifier": "^9.0.0",
"prettier": "^2.4.1",
"react-test-renderer": "17.0.2",
"metro-react-native-babel-preset": "0.72.3",
"react-test-renderer": "18.1.0",
"typescript": "^4.5.2"
},
"jest": {
Expand Down
Loading

0 comments on commit d0b49bf

Please sign in to comment.