diff --git a/.gitignore b/.gitignore index b064738..4a7047b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,7 @@ build/ xcuserdata xcshareddata -#Demo App -/BlinkIDReactNative \ No newline at end of file +node_modules +.idea + +/Sample \ No newline at end of file diff --git a/README.md b/README.md index 16340bd..f2ce7ea 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ BlinkID React Native was built and tested with [React Native v0.62.2](https://gi First generate an empty project if needed: ```shell -react-native init --version="0.61.5" NameOfYourProject +react-native init --version="0.62.2" NameOfYourProject ``` Add the **blinkid-react-native** module to your project: @@ -81,16 +81,16 @@ allprojects { } ``` -## Demo +## Sample -This repository contains **initReactNativeDemoApp.sh** script that will create React Native project and download all of its dependencies. You can run this script with following command: +This repository contains **initReactNativeSampleApp.sh** script that will create React Native project and download all of its dependencies. You can run this script with following command: ```shell -./initReactNativeDemoApp.sh +./initReactNativeSampleApp.sh ``` ## Video tutorial -Step by step guide how to start blinkid-reactnative demo app. A tutorial flows from cloning repository via git clone to successfully deployed demo application on Android and iOS device with real-time screen mirroring. Application demo contains the simple use of USDL recognizer with Ontario drivers license card. +Step by step guide how to start blinkid-reactnative sample app. A tutorial flows from cloning repository via git clone to successfully deployed sample application on Android and iOS device with real-time screen mirroring. Application sample contains the simple use of USDL recognizer with Ontario drivers license card.

@@ -113,7 +113,7 @@ DocumentVerificationOverlay is overlay for RecognizerRunnerFragment best suited ## Usage -To use the module you call it in your index.android.js or index.ios.js file like in the [example app](demoApp/index.js). Available recognizers and API documentation is available in [JS API files](BlinkID). +To use the module you call it in your index.android.js or index.ios.js file like in the [sample app](SampleFiles/index.js). Available recognizers and API documentation is available in [JS API files](BlinkID). ## FAQ diff --git a/initReactNativeDemoApp.sh b/initReactNativeSampleApp.sh similarity index 65% rename from initReactNativeDemoApp.sh rename to initReactNativeSampleApp.sh index 3a173a5..f4a0b56 100755 --- a/initReactNativeDemoApp.sh +++ b/initReactNativeSampleApp.sh @@ -1,16 +1,17 @@ #!/bin/bash blink_id_plugin_path=`pwd`/BlinkID +appName=Sample # remove any existing code -rm -rf BlinkIDReactNative +rm -rf $appName # create a sample application # https://github.com/react-native-community/cli#using-npx-recommended -npx react-native init --version="0.62.2" BlinkIDReactNative || exit 1 +npx react-native init $appName --version="0.62.2" || exit 1 # enter into demo project folder -pushd BlinkIDReactNative +pushd $appName IS_LOCAL_BUILD=false || exit 1 if [ "$IS_LOCAL_BUILD" = true ]; then @@ -36,6 +37,17 @@ pushd android # patch the build.gradle to add "maven { url https://maven.microblink.com }"" repository perl -i~ -pe "BEGIN{$/ = undef;} s/maven \{/maven \{ url 'https:\\/\\/maven.microblink.com' }\n maven {/" build.gradle +# change package name +# adb uninstall "com.microblink.sample" +mkdir -p app/src/main/java/com/microblink/sample +mkdir -p app/src/debug/java/com/microblink/sample +mv app/src/main/java/com/sample/* app/src/main/java/com/microblink/sample/ +mv app/src/debug/java/com/sample/* app/src/debug/java/com/microblink/sample/ +rmdir app/src/main/java/com/sample +rmdir app/src/debug/java/com/sample +grep -rl com.sample . | xargs sed -i '' s/com.sample/com.microblink.sample/g +./gradlew clean + popd # enter into ios project folder @@ -55,6 +67,9 @@ if [ "$IS_LOCAL_BUILD" = true ]; then #popd fi +# change bundle id +sed -i '' s/\$\(PRODUCT_BUNDLE_IDENTIFIER\)/com.microblink.sample/g $appName/Info.plist + # go to react native root project popd @@ -67,12 +82,12 @@ rm -f index.ios.js # remove index.android.js rm -f index.android.js -cp ../demoApp/index.js ./ +cp ../sample_files/index.js ./ # use the same index.js file for Android and iOS cp index.js index.ios.js cp index.js index.android.js -echo "Go to React Native project folder: cd BlinkIDReactNative" +echo "Go to React Native project folder: cd $appName" echo "To run on Android execute: react-native run-android" -echo "To run on iOS: go to BlinkIDReactNative/ios and open BlinkIDReactNative.xcworkspace; set your development team and add Privacy - Camera Usage Description key to Your info.plist file and press run" +echo "To run on iOS: go to $appName/ios and open $appName.xcworkspace; set your development team and add Privacy - Camera Usage Description key to Your info.plist file and press run" diff --git a/demoApp/index.js b/sample_files/index.js similarity index 92% rename from demoApp/index.js rename to sample_files/index.js index 5a81847..7d6f526 100644 --- a/demoApp/index.js +++ b/sample_files/index.js @@ -17,10 +17,10 @@ import { } from 'react-native'; const licenseKey = Platform.select({ - // iOS license key for applicationID: org.reactjs.native.example.BlinkIDReactNative - ios: 'sRwAAAEtb3JnLnJlYWN0anMubmF0aXZlLmV4YW1wbGUuQmxpbmtJRFJlYWN0TmF0aXZlt67qu61k2vMma/ITqdz0Hw5VrGUGzgJ2tHeM9IxCzR0zl3+SIAzPW69yDvGXRrQlkT7ByFgTINRtu2FoNbYOrUCLxq37Y3npcDj4yaElrr8rM0b2q+FOnmD9gu4wCoMjKV5CJ14JJsmwP+naiIcVqmuv+tQ8hWgAKM8L616owzG1UYp+h2ZdTOMWSX/AkwDXguj8z5zx/iE10KE2iTrcU1Iu5AANV02VHUmeAHoOOTloMJJuBsBbwWFgS+pke73YmTfnmbUxCQ==', - // android license key for applicationID: com.blinkidreactnative - android: 'sRwAAAAWY29tLmJsaW5raWRyZWFjdG5hdGl2ZYouOuuUS2CbdVuoF2lsSqeObkzyko/0kah+gpMcK/G18fQtB1vAoiuyDojRyY6xOLlJYAFwGuepBKDJPqdsQh11RxKSLANRLDH0lWJzgo3EKRae9NXAoKPUJ0nqUy7uIP8eAVkFelNILVRy3pkWJjY5o/vRLn7sf2cNsdmt/ZvzUw1545pLHgT7LqOxSRg+81p0/koApvVMnJ+yI9QJgHNwa9AFNDOYEKCiow/J1dJjx+yGL1crnvfaOLv7ndLUisX496v+w9k=' + // iOS license key for applicationID: com.microblink.sample + ios: 'sRwAAAEVY29tLm1pY3JvYmxpbmsuc2FtcGxl1BIcP+dpSuS/38LVOOaNNacdy5kvOjARlS+ZYUJequcG+Hqo27AnV1Dsb+chCYtaeZSdPijWBCYJ51tohlnyZoEVBy/6a1OH/bRSNy8cPbh6GEjWK5XsLOJGggpwhNMoId3hXJpEJisHYvwiArC5tvWBUZzgr5rmupFObXTd67RaHytuIBa1ENEiLqT9RRHho05ftVuEcfE0Qk/eKv1vbL+LyowK80VS2pZNoOCd/g8K7iHW5XhGdeCqu0C7izVQ+kROfheTZf8I', + // android license key for applicationID: com.microblink.sample + android: 'sRwAAAAVY29tLm1pY3JvYmxpbmsuc2FtcGxlU9kJdf5ZkGlTu9W3OMtlz473rOYXXInzJ8snv7nxCLN17zjcm+suA4KjMpE2dFZXWX8BduxrLbWtOYVI7H3P3lFjc30uqRa8ikxwUJM+6JuKs1dLFNQw80KBHE3OymtkC0tpOKtNbEZzzlpJSjZn8AfP2PofMEuJvM3tohOnYAtGIY6tNG4k4pMivgzZF4C6FfhlV/h5PJKcwxlYWUEIUUc5yzzsYyNApK/dvRHpdPHaup1XJML8nTQjvXTAkiuiIjMRdQ/9Uew=' }) var renderIf = function(condition, content) { @@ -46,7 +46,7 @@ function buildDateResult(result, key) { return "" } -export default class BlinkIDReactNativeApp extends Component { +export default class Sample extends Component { constructor(props) { super(props); @@ -293,4 +293,4 @@ const styles = StyleSheet.create({ }, }); -AppRegistry.registerComponent('BlinkIDReactNative', () => BlinkIDReactNativeApp); +AppRegistry.registerComponent('Sample', () => Sample);