diff --git a/README.md b/README.md index fed3123..a37d56c 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Due the issue with pod & asset catalogs https://github.com/CocoaPods/CocoaPods/i #### Android 1. Open up `android/app/src/main/java/[...]/MainActivity.java` - - Add `import com.omni.misnap.RNMisnapPackage;` to the imports at the top of the file + - Add `import com.wink.misnap.RNMisnapPackage;` to the imports at the top of the file - Add `new RNMisnapPackage()` to the list returned by the `getPackages()` method 2. Append the following lines to `android/settings.gradle`: ``` diff --git a/RNMisnap.podspec b/RNMisnap.podspec index 62bdde4..5b4be2c 100644 --- a/RNMisnap.podspec +++ b/RNMisnap.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.name = "RNMisnap" - s.version = "1.0.1" + s.version = "1.2.8" s.summary = "RNMisnap" s.description = <<-DESC RNMisnap, https://www.miteksystems.com/mobile-capture react-native wrapper aroud native framework. @@ -16,26 +16,24 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/author/RNMisnap.git", :tag => "master" } s.ios.deployment_target = '9.0' - s.source_files = 'ios/*.{h,m}','ios/MiSnapSDK/classes/*.{h,m}' + s.source_files = 'ios/*.{h,m}', + 'ios/MiSnapSDK/classes/*.{h,m}' + s.public_header_files = 'ios/*.{h}','ios/MiSnapSDK/classes/*.{h}' s.frameworks = 'UIKit', 'AudioToolbox', 'AVFoundation', 'CoreGraphics', 'CoreMedia', 'CoreVideo', 'MobileCoreServices', 'OpenGLES', 'QuartzCore', 'Security', 'ImageIO' # s.resources = ['ios/MiSnapSDK/resources/*'] - s.vendored_frameworks = 'ios/MiSnapSDK/MiSnapSDK.framework', + s.vendored_frameworks = + 'ios/MiSnapSDK/MiSnapBarcodeScanner.framework', + 'ios/MiSnapSDK/MiSnapLiveness.framework', + 'ios/MiSnapSDK/MiSnapSDK.framework', 'ios/MiSnapSDK/MiSnapSDKCamera.framework', 'ios/MiSnapSDK/MiSnapSDKMibiData.framework', 'ios/MiSnapSDK/MiSnapSDKScience.framework', - 'ios/MiSnapSDK/MobileFlow.framework', - 'ios/MiSnapSDK/MiSnapBarcodeScanner.framework', - 'ios/MiSnapSDK/MiSnapLiveness.framework', - 'ios/MiSnapSDK/DaonFaceLiveness.framework', - 'ios/MiSnapSDK/DaonFaceLivenessBlink.framework', - 'ios/MiSnapSDK/DaonFaceQuality.framework', - 'ios/MiSnapSDK/DaonFaceSDK.framework' + 'ios/MiSnapSDK/MobileFlow.framework' s.requires_arc = true s.dependency "React" #s.dependency "others" end - \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index c92187e..bc192bf 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,4 +1,3 @@ - buildscript { repositories { jcenter() @@ -6,24 +5,33 @@ buildscript { flatDir { dirs 'libs' } + mavenLocal() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' + classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21' } } apply plugin: 'com.android.library' +apply plugin: 'maven' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-parcelize' android { - compileSdkVersion 23 - buildToolsVersion "23.0.3" + compileSdkVersion 30 + buildToolsVersion = "29.0.3" defaultConfig { - minSdkVersion 16 - targetSdkVersion 26 + minSdkVersion 19 + targetSdkVersion 30 versionCode 1 - versionName "1.0.1" + versionName "3.0" + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } lintOptions { abortOnError false @@ -36,7 +44,7 @@ android { } repositories { - mavenCentral() + mavenLocal() google() flatDir { dirs 'libs' @@ -45,15 +53,56 @@ repositories { dependencies { implementation 'com.facebook.react:react-native:+' - implementation fileTree(include: ['*.aar'], dir: 'libs') + // implementation fileTree(include: ['*.aar'], dir: 'libs') + + implementation (name: 'api-release', ext: 'aar') + implementation (name: 'barcode-release', ext: 'aar') + implementation (name: 'barcodecontroller-release', ext: 'aar') + + implementation (name: 'cardio-release', ext: 'aar') + implementation (name: 'creditcardcontroller-release', ext: 'aar') + + implementation (name: 'facialcapturecontroller-release', ext: 'aar') + implementation (name: 'facialcapturescience-release', ext: 'aar') + implementation (name: 'facialcapturesciencecrypto-release', ext: 'aar') + implementation (name: 'facialcapturescienceface-release', ext: 'aar') + implementation (name: 'facialcapturescienceliveness-release', ext: 'aar') + implementation (name: 'facialcapturesciencequality-release', ext: 'aar') + implementation (name: 'facialcaptureworkflow-release', ext: 'aar') + + implementation (name: 'imageutils-release', ext: 'aar') + implementation (name: 'mibidata-release', ext: 'aar') + implementation (name: 'misnapcamera-release', ext: 'aar') + + implementation (name: 'misnapcontroller-release', ext: 'aar') + implementation (name: 'misnaphybridcontroller-release', ext: 'aar') + implementation (name: 'misnapscience-release', ext: 'aar') + + implementation (name: 'misnapworkflow_UX2-release', ext: 'aar') + implementation (name: 'misnapworkflow-release', ext: 'aar') + implementation (name: 'sanselan-release', ext: 'aar') + implementation "com.android.support:appcompat-v7:28.0.0" implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta4" implementation 'org.greenrobot:eventbus:3.1.1' - implementation 'com.android.support:appcompat-v7:23.2.1' implementation 'de.greenrobot:eventbus:2.4.0' implementation 'com.android.support:percent:23.3.0' implementation 'commons-io:commons-io:2.5' implementation 'org.slf4j:slf4j-android:1.7.12' - implementation "org.apache.commons:commons-imaging:1.0-alpha2" -} - \ No newline at end of file + implementation "org.apache.commons:commons-imaging:1.0-alpha2" + + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.21" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.0" + implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0" + + implementation "androidx.fragment:fragment:1.2.5" + implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0" + implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0" + implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0" + implementation "androidx.databinding:viewbinding:4.1.3" + + implementation "com.google.android.material:material:1.3.0" + + implementation 'com.microsoft.appcenter:appcenter-crashes:3.2.2' + implementation "androidx.multidex:multidex:2.0.1" +} \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..da9702f --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/android/gradlew b/android/gradlew new file mode 100755 index 0000000..4f906e0 --- /dev/null +++ b/android/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/android/gradlew.bat b/android/gradlew.bat new file mode 100644 index 0000000..ac1b06f --- /dev/null +++ b/android/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/android/libs/api-release.aar b/android/libs/api-release.aar index 00864d2..a4cbe73 100644 Binary files a/android/libs/api-release.aar and b/android/libs/api-release.aar differ diff --git a/android/libs/facialcapturecontroller-release.aar b/android/libs/facialcapturecontroller-release.aar index 684346b..793ff96 100644 Binary files a/android/libs/facialcapturecontroller-release.aar and b/android/libs/facialcapturecontroller-release.aar differ diff --git a/android/libs/facialcapturescience-release.aar b/android/libs/facialcapturescience-release.aar index 2566262..2e3b76e 100644 Binary files a/android/libs/facialcapturescience-release.aar and b/android/libs/facialcapturescience-release.aar differ diff --git a/android/libs/facialcaptureworkflow-release.aar b/android/libs/facialcaptureworkflow-release.aar index 4be1624..1f5e8c8 100644 Binary files a/android/libs/facialcaptureworkflow-release.aar and b/android/libs/facialcaptureworkflow-release.aar differ diff --git a/android/libs/misnapcamera-release.aar b/android/libs/misnapcamera-release.aar index aa38043..4bbb048 100644 Binary files a/android/libs/misnapcamera-release.aar and b/android/libs/misnapcamera-release.aar differ diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 2b7305c..1317d7f 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="com.wink.misnap"> \ No newline at end of file diff --git a/android/src/main/java/com/omni/misnap/RNMisnapModule.java b/android/src/main/java/com/wink/misnap/RNMisnapModule.java similarity index 76% rename from android/src/main/java/com/omni/misnap/RNMisnapModule.java rename to android/src/main/java/com/wink/misnap/RNMisnapModule.java index a9d4326..07d99ca 100644 --- a/android/src/main/java/com/omni/misnap/RNMisnapModule.java +++ b/android/src/main/java/com/wink/misnap/RNMisnapModule.java @@ -1,10 +1,11 @@ -package com.omni.misnap; +package com.wink.misnap; import android.app.Activity; import android.content.Intent; import android.util.Base64; import android.util.Log; +import android.os.Bundle; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; @@ -18,12 +19,8 @@ import static android.app.Activity.RESULT_OK; - -import com.miteksystems.facialcapture.science.api.params.FacialCaptureApi; import com.miteksystems.facialcapture.workflow.FacialCaptureWorkflowActivity; -import com.miteksystems.facialcapture.workflow.params.FacialCaptureWorkflowParameters; -import com.miteksystems.misnap.params.CameraApi; -import com.miteksystems.misnap.params.MiSnapApi; + import com.miteksystems.misnap.params.ScienceApi; import com.miteksystems.misnap.utils.Utils; @@ -33,6 +30,11 @@ import com.miteksystems.misnap.params.CameraApi; import com.miteksystems.misnap.params.MiSnapApi; +// Facial resources +import com.miteksystems.facialcapture.workflow.params.FacialCaptureWorkflowApi; +import com.miteksystems.facialcapture.workflow.api.FacialCaptureResult; +// ... /// + import org.json.JSONException; import org.json.JSONObject; @@ -62,16 +64,17 @@ public String getName() { @ReactMethod public void greet(Promise promise) { - promise.resolve("HELLO FROM ANDROID NATIVE CODE (1.0.5)"); + promise.resolve("HELLO FROM ANDROID NATIVE CODE (3.0.0)"); } @ReactMethod public void capture(ReadableMap config, Promise promise) { - Activity currentActivity = getCurrentActivity(); + Activity currentActivity = getCurrentActivity(); currentPromise = promise; - String captureType = config.hasKey("captureType") ? - config.getString("captureType") : "idFront"; + String captureType = config.hasKey("captureType") + ? config.getString("captureType") + : "idFront"; // Config parameters String licenseKey = config.hasKey("livenessLicenseKey") ? config.getString("livenessLicenseKey") : ""; @@ -108,21 +111,14 @@ public void capture(ReadableMap config, Promise promise) { intentMiSnap.putExtra(MiSnapApi.JOB_SETTINGS, misnapParams.toString()); if(intentMiSnap != null ){ - currentActivity.startActivityForResult(intentMiSnap, MiSnapApi.RESULT_PICTURE_CODE); + currentActivity.startActivityForResult(intentMiSnap, MiSnapApi.RESULT_PICTURE_CODE); } - // HashMap hm = new HashMap<>(); - // hm.put("base64encodedImage", "Hello From Native"); - // WritableMap map = new WritableNativeMap(); - // for (Map.Entry entry : hm.entrySet()) { - // map.putString(entry.getKey(), entry.getValue()); - // } - // promise.resolve(map); - } else if (captureType.equals("face")) { JSONObject faceCaptureParams = new JSONObject(); try { - faceCaptureParams.put(FacialCaptureApi.FacialCaptureLicenseKey, licenseKey); + // Comment line, was deprecated on version 3.* of misnap sdk + // faceCaptureParams.put(FacialCaptureApi.FacialCaptureLicenseKey, licenseKey); faceCaptureParams.put(CameraApi.MiSnapAllowScreenshots, 1); } catch (JSONException e) { e.printStackTrace(); @@ -140,27 +136,46 @@ public void onNewIntent(Intent intent) {} public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent intent) { if (MiSnapApi.RESULT_PICTURE_CODE == requestCode) { if (RESULT_OK == resultCode) { - byte[] image = intent.getByteArrayExtra(MiSnapApi.RESULT_PICTURE_DATA); + FacialCaptureResult result = this.getResultFacialCapture(intent); + + byte[] image = result instanceof FacialCaptureResult.Success + ? this.getFacialImage(result) + : intent.getByteArrayExtra(MiSnapApi.RESULT_PICTURE_DATA); + String encoded = Base64.encodeToString(image, Base64.DEFAULT); String mibiData = intent.getStringExtra(MiSnapApi.RESULT_MIBI_DATA); - // // Log - // try { - // this.storeImageToDocumentsDirectory(encoded); - // } catch (IOException e) { - // e.printStackTrace(); - // } + HashMap hm = new HashMap<>(); hm.put("base64encodedImage", encoded); hm.put("metadata", mibiData); WritableMap map = new WritableNativeMap(); for (Map.Entry entry : hm.entrySet()) { - map.putString(entry.getKey(), entry.getValue()); + map.putString(entry.getKey(), entry.getValue()); } currentPromise.resolve(map); } } } + // Get facial capture result + // This will be handle what type of validation could be make + protected FacialCaptureResult getResultFacialCapture (Intent intent) { + Bundle extras = intent.getExtras(); + FacialCaptureResult result = extras.getParcelable(FacialCaptureWorkflowApi.FACIAL_CAPTURE_RESULT); + return result; + } + + // Method to get image face captured for FacilCpatureWorkflowApi + // Create since android sdk 3.0 + protected byte[] getFacialImage(FacialCaptureResult result) { + byte[] image = null; + + if (result instanceof FacialCaptureResult.Success) { + image = ((FacialCaptureResult.Success) result).getImage(); + } + return image; + } + @ReactMethod public void getResults(Promise promise) { currentPromise = promise; diff --git a/android/src/main/java/com/omni/misnap/RNMisnapPackage.java b/android/src/main/java/com/wink/misnap/RNMisnapPackage.java similarity index 97% rename from android/src/main/java/com/omni/misnap/RNMisnapPackage.java rename to android/src/main/java/com/wink/misnap/RNMisnapPackage.java index 45914ff..b3e5d15 100644 --- a/android/src/main/java/com/omni/misnap/RNMisnapPackage.java +++ b/android/src/main/java/com/wink/misnap/RNMisnapPackage.java @@ -1,5 +1,5 @@ -package com.omni.misnap; +package com.wink.misnap; import java.util.Arrays; import java.util.Collections; diff --git a/android/src/main/res/values-es/facialcapture_workflow_attrs.xml b/android/src/main/res/values-es/facialcapture_workflow_attrs.xml new file mode 100644 index 0000000..a18f932 --- /dev/null +++ b/android/src/main/res/values-es/facialcapture_workflow_attrs.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/android/src/main/res/values-es/facialcapture_workflow_colors.xml b/android/src/main/res/values-es/facialcapture_workflow_colors.xml new file mode 100644 index 0000000..18bbeb4 --- /dev/null +++ b/android/src/main/res/values-es/facialcapture_workflow_colors.xml @@ -0,0 +1,34 @@ + + + #FF1C37 + #E1E1E2 + #FF1C37 + #E1E1E2 + #FFFFFF + #111111 + #FFFFFF + #212121 + + #59FFFFFF + #55FFFFFF + + #FFFFFF + #777777 + #111111 + #777777 + @color/colorPrimary + @color/colorPrimary + #FFFFFF + @color/colorPrimary + #111111 + + #FF1C37 + #1CFF37 + + @color/colorOvalNoError + + #717B8A + #0B1B2B + #E6E7E8 + #626D7C + \ No newline at end of file diff --git a/android/src/main/res/values-es/facialcapture_workflow_dimens.xml b/android/src/main/res/values-es/facialcapture_workflow_dimens.xml new file mode 100644 index 0000000..42140ea --- /dev/null +++ b/android/src/main/res/values-es/facialcapture_workflow_dimens.xml @@ -0,0 +1,11 @@ + + + 16dp + 16dp + + 8dp + 8dp + + 32dp + 32dp + diff --git a/android/src/main/res/values-es/facialcapture_workflow_strings.xml b/android/src/main/res/values-es/facialcapture_workflow_strings.xml new file mode 100644 index 0000000..c5ebb41 --- /dev/null +++ b/android/src/main/res/values-es/facialcapture_workflow_strings.xml @@ -0,0 +1,74 @@ + + + Motivo de Solicitud + Se necesita acceso a la cámara del dispositivo para capturar una foto de su rostro. + + + Prepárese para centrar su rostro en el óvalo + Continuar + + + Cancelar + Ayuda + + + Se acabó el tiempo, no tomamos su foto… ¿Quisiera intentar de nuevo con Captura Automática o Captura Manual? + Se acabó el tiempo, no tomamos su foto… + Quisiera intentar de nuevo? + Captura Automática + Captura Manual + Automática + Manual + + + Por Favor: Colóquese frente a un fondo uniforme. Centre Su Rostro. Sonría Cuando Esté Listo. No oculte su cara con gorras, anteojos, bufandas, cabello… sin máscaras. + Por Favor: Colóquese frente a un fondo uniforme. Centre Su Rostro. Manténgase quieto cuando esté listo. No oculte su cara con gorras, anteojos, bufandas, cabello… sin máscaras. + Por Favor: + Centre Su Rostro + Colóquese frente a un fondo uniforme + Sonría Cuando Este Listo + Manténgase quieto cuando esté listo + También: + No oculte su cara con gorras, anteojos, bufandas, cabello… + Sin máscaras + Continuar + Cancelar + + + Por Favor: Colóquese frente a un fondo uniforme. Centre Su Rostro. No oculte su cara con gorras, anteojos, bufandas, cabello… sin máscaras + Por Favor: + Colóquese frente a un fondo uniforme + Centre Su Rostro + También: + No oculte su cara con gorras, anteojos, bufandas, cabello… + Sin máscaras + Continuar + + + ¿Está conforme con el resultado? ¿Quiere volver a tomarla? + ¿Está conforme con el resultado? + Se ve bien + Volver a tomar + + + Rostro No Detectado + Solo se permite un rostro + Enderece su rostro + Retírese + Acérquese + Sonría Ahora + Presione el botón cuando esté listo + No lo mueva + Pare de sonreir + + + Gracias, hemos tomado su foto. + Flujo de Captura Facial + + + 3 + 2 + 1 + + + \ No newline at end of file diff --git a/android/src/main/res/values-es/facialcapture_workflow_styles.xml b/android/src/main/res/values-es/facialcapture_workflow_styles.xml new file mode 100644 index 0000000..4f952fe --- /dev/null +++ b/android/src/main/res/values-es/facialcapture_workflow_styles.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/src/main/res/values-night/facialcapture_workflow_colors.xml b/android/src/main/res/values-night/facialcapture_workflow_colors.xml new file mode 100644 index 0000000..9658421 --- /dev/null +++ b/android/src/main/res/values-night/facialcapture_workflow_colors.xml @@ -0,0 +1,34 @@ + + + #FF1C37 + #E1E1E2 + #FF1C37 + #E1E1E2 + #202020 + #E1E1E2 + #000000 + #E1E1E2 + + #59FFFFFF + #55000000 + + #FFFFFF + #777777 + #111111 + #777777 + @color/colorPrimary + @color/colorPrimary + #FFFFFF + @color/colorPrimary + #111111 + + #FF1C37 + #1CFF37 + + @color/colorOvalNoError + + #39424D + #0B1B2B + #667587 + #3F4A59 + \ No newline at end of file diff --git a/android/src/main/res/values-notnight/facialcapture_workflow_colors.xml b/android/src/main/res/values-notnight/facialcapture_workflow_colors.xml new file mode 100644 index 0000000..18bbeb4 --- /dev/null +++ b/android/src/main/res/values-notnight/facialcapture_workflow_colors.xml @@ -0,0 +1,34 @@ + + + #FF1C37 + #E1E1E2 + #FF1C37 + #E1E1E2 + #FFFFFF + #111111 + #FFFFFF + #212121 + + #59FFFFFF + #55FFFFFF + + #FFFFFF + #777777 + #111111 + #777777 + @color/colorPrimary + @color/colorPrimary + #FFFFFF + @color/colorPrimary + #111111 + + #FF1C37 + #1CFF37 + + @color/colorOvalNoError + + #717B8A + #0B1B2B + #E6E7E8 + #626D7C + \ No newline at end of file diff --git a/android/src/main/res/values/facialcapture_workflow_attrs.xml b/android/src/main/res/values/facialcapture_workflow_attrs.xml new file mode 100644 index 0000000..a18f932 --- /dev/null +++ b/android/src/main/res/values/facialcapture_workflow_attrs.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/android/src/main/res/values/facialcapture_workflow_colors.xml b/android/src/main/res/values/facialcapture_workflow_colors.xml new file mode 100644 index 0000000..05df672 --- /dev/null +++ b/android/src/main/res/values/facialcapture_workflow_colors.xml @@ -0,0 +1,36 @@ + + + #FF1C37 + #E1E1E2 + #FF1C37 + #E1E1E2 + #FFFFFF + #111111 + #FFFFFF + #212121 + + #59FFFFFF + #55FFFFFF + + #FFFFFF + #777777 + #111111 + #777777 + @color/colorPrimary + @color/colorPrimary + #FFFFFF + @color/colorPrimary + #111111 + + #FF1C37 + #1CFF37 + + @color/colorOvalNoError + + #717B8A + #0B1B2B + #E6E7E8 + #626d7C + + #FFFFFF + \ No newline at end of file diff --git a/android/src/main/res/values/facialcapture_workflow_dimens.xml b/android/src/main/res/values/facialcapture_workflow_dimens.xml new file mode 100644 index 0000000..42140ea --- /dev/null +++ b/android/src/main/res/values/facialcapture_workflow_dimens.xml @@ -0,0 +1,11 @@ + + + 16dp + 16dp + + 8dp + 8dp + + 32dp + 32dp + diff --git a/android/src/main/res/values/facialcapture_workflow_strings.xml b/android/src/main/res/values/facialcapture_workflow_strings.xml new file mode 100644 index 0000000..7555045 --- /dev/null +++ b/android/src/main/res/values/facialcapture_workflow_strings.xml @@ -0,0 +1,73 @@ + + Permission reason + Camera access is required to snap a photo of your face. + + + Get ready to center your face in the oval and smile + Continue + + + Cancel + Help + + + "Time's up, we couldn't take your photo…". How would you like to try again, auto capture or take manual capture? + "Time's up, we couldn't take your photo…" + How would you like to try again? + Auto Capture + Take Manual Capture + Auto + Manual + + + Please do: Stand against a plain background, center your face, smile when ready. Also no hats, glasses, scarfs, hair covering face… no masks + Please do: Stand against a plain background, center your face, hold still when ready. Also no hats, glasses, scarfs, hair covering face… no masks + Please DO: + Center your face + Stand against a plain background + Smile when ready + Hold still when ready + Also: + No hats, glasses, scarfs, hair covering face… + No masks + Continue + Cancel + + + Please do: Stand against a plain background, center your face, also, no hats, glasses, scarfs, hair covering face… no masks + Please DO: + Stand against a plain background + Center your face + Also: + No hats, glasses, scarfs, hair covering face… + No masks + Continue + + + Are you happy with your selfie or would you like to retake it? + Are you happy with your selfie? + Looks Good + Retake + + + Face not detected + Only one face is allowed + Straighten your face + Move farther away + Get closer + Smile now + Stop smiling + Press button when ready + Hold Still + + + Thank you,\nwe just took your photo. + Facial Capture Workflow + + + 3 + 2 + 1 + + + diff --git a/android/src/main/res/values/facialcapture_workflow_styles.xml b/android/src/main/res/values/facialcapture_workflow_styles.xml new file mode 100644 index 0000000..4f952fe --- /dev/null +++ b/android/src/main/res/values/facialcapture_workflow_styles.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ios/RNMisnap.xcodeproj/project.pbxproj b/ios/RNMisnap.xcodeproj/project.pbxproj index d1a168d..caa0f51 100644 --- a/ios/RNMisnap.xcodeproj/project.pbxproj +++ b/ios/RNMisnap.xcodeproj/project.pbxproj @@ -3,11 +3,12 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ B3E7B58A1CC2AC0600A0062D /* RNMisnap.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNMisnap.m */; }; + E2E5D5832731A9AA002C3004 /* libRNMisnap.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 134814201AA4EA6300B7C361 /* libRNMisnap.a */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -33,6 +34,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + E2E5D5832731A9AA002C3004 /* libRNMisnap.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -66,6 +68,7 @@ 58B511D71A9E6C8500147676 /* Sources */, 58B511D81A9E6C8500147676 /* Frameworks */, 58B511D91A9E6C8500147676 /* CopyFiles */, + E23ADB572733097500BF18D3 /* ShellScript */, ); buildRules = ( ); @@ -82,20 +85,24 @@ 58B511D31A9E6C8500147676 /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftUpdateCheck = 1240; LastUpgradeCheck = 0830; ORGANIZATIONNAME = Facebook; TargetAttributes = { 58B511DA1A9E6C8500147676 = { CreatedOnToolsVersion = 6.1.1; + LastSwiftMigration = 1240; }; }; }; buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNMisnap" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 11.0"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, + es, ); mainGroup = 58B511D21A9E6C8500147676; productRefGroup = 58B511D21A9E6C8500147676; @@ -107,6 +114,26 @@ }; /* End PBXProject section */ +/* Begin PBXShellScriptBuildPhase section */ + E23ADB572733097500BF18D3 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n# target directory is Project root directory\ntarget_dir=${SRCROOT}/include/\n# Ensure the target include path exists\nmkdir -p ${target_dir}\n# Copy any file that looks like a Swift generated header to the include path\ncp ${DERIVED_SOURCES_DIR}/*-Swift.h ${target_dir}\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 58B511D71A9E6C8500147676 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -139,6 +166,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEFINES_MODULE = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -156,10 +184,15 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + HEADER_SEARCH_PATHS = "${SRCROOT}/include"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MODULEMAP_FILE = "$(SRCROOT)/RNMisnap.modulemap"; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; + SWIFT_OBJC_BRIDGING_HEADER = "RNMisnap-Bridging-Header.h"; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "RNMisnap-Swift.h"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -183,6 +216,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; + DEFINES_MODULE = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -193,9 +227,14 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + HEADER_SEARCH_PATHS = "${SRCROOT}/include"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MODULEMAP_FILE = "$(SRCROOT)/RNMisnap.modulemap"; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_OBJC_BRIDGING_HEADER = "RNMisnap-Bridging-Header.h"; + SWIFT_OBJC_INTERFACE_HEADER_NAME = "RNMisnap-Swift.h"; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -203,32 +242,57 @@ 58B511F01A9E6C8500147676 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_ENABLE_MODULES = YES; + DEFINES_MODULE = YES; HEADER_SEARCH_PATHS = ( - "$(inherited)", + "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../../../React/**", "$(SRCROOT)/../../react-native/React/**", + "${SRCROOT}/include", + ); + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = RNMisnap; SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = ""; + SWIFT_OBJC_INTERFACE_HEADER_NAME = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; 58B511F11A9E6C8500147676 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_ENABLE_MODULES = YES; + DEFINES_MODULE = YES; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../../../React/**", "$(SRCROOT)/../../react-native/React/**", + "${SRCROOT}/include", + ); + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = RNMisnap; SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = ""; + SWIFT_OBJC_INTERFACE_HEADER_NAME = ""; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/package.json b/package.json index 80ae085..9ba2176 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "react-native-misnap", - "version": "1.0.7", - "description": "Private react-native wrapper library around MiSnap + MiSnap liveness frameworks for iOS & Adndroid.", + "version": "3.0.0", + "description": "Private react-native wrapper library around MiSnap + MiSnap liveness frameworks for iOS & Android.", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"