Skip to content

Commit

Permalink
Merge pull request #162 from BlinkID/feature/rename/IOS-946
Browse files Browse the repository at this point in the history
Feature/rename/ios 946
  • Loading branch information
matvidako authored Sep 15, 2020
2 parents df3a4df + cb76e7f commit 725e886
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 20 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ build/
xcuserdata
xcshareddata

#Demo App
/BlinkIDReactNative
node_modules
.idea

/Sample
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.

<p align="center" >
<a href="https://vimeo.com/289850200" target="_blank">
Expand All @@ -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

Expand Down
27 changes: 21 additions & 6 deletions initReactNativeDemoApp.sh → initReactNativeSampleApp.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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"
12 changes: 6 additions & 6 deletions demoApp/index.js → sample_files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);

Expand Down Expand Up @@ -293,4 +293,4 @@ const styles = StyleSheet.create({
},
});

AppRegistry.registerComponent('BlinkIDReactNative', () => BlinkIDReactNativeApp);
AppRegistry.registerComponent('Sample', () => Sample);

0 comments on commit 725e886

Please sign in to comment.