Skip to content

Commit

Permalink
update: PassiveFaceLiveness version 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kikogassen committed Aug 1, 2020
1 parent 5f32778 commit 78eaf65
Show file tree
Hide file tree
Showing 32 changed files with 136 additions and 150 deletions.
4 changes: 3 additions & 1 deletion .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 21 additions & 11 deletions .idea/libraries/Dart_SDK.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 7 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

* Internet connection
* A valid [combateafraude](https://combateafraude.com) Mobile token. To get one, please mail to [Frederico Gassen](mailto:frederico.gassen@combateafraude.com)
* A physical device (how to scan a real document with a simulator?)

Add this configuration in your app-level `build.gradle`:

Expand Down Expand Up @@ -63,26 +62,9 @@ When working on Android API 23+, you'll have to request the runtime permissions

You need to add this rules in your Proguard/R8 file. If not exits, it's necessary create:

```java
``` pro
# Keep the classes that are deserialized by GSON
-keep class com.combateafraude.helpers.server.api.** { <fields>; }

# Keep - Library. Keep all public and protected classes, fields, and methods.
-keep public class * {
public protected <fields>;
public protected <methods>;
}

# Keep all enums. Removing this causes a crash in the Document enum
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

# Keep native methos. Removing this causes a crash
-keepclasseswithmembernames,includedescriptorclasses class * {
native <methods>;
}
-keep class com.combateafraude.helpers.server.model.** { <fields>; }
```

### iOS environment
Expand All @@ -92,11 +74,10 @@ You need to add this rules in your Proguard/R8 file. If not exits, it's necessar

| Deployment Info | iOS Version |
|-----------------|--------------|
| `Target` | iOS 12.0 + |
| `Target` | iOS 11.0 + |

* Internet connection
* A valid [combateafraude](https://combateafraude.com) Mobile token. To get one, please mail to [Frederico Gassen](mailto:frederico.gassen@combateafraude.com)
* A physical device (how to scan a real document with a simulator?)

#### Podfile

Expand All @@ -112,10 +93,10 @@ Add this to your `pubspec.yaml`:

```yml
dependencies:
passiveface_liveness_sdk:
passive_face_liveness:
git:
url: https://github.com/combateafraude/Flutter.git
ref: passive-face-liveness-v.0.3.0
ref: passive-face-liveness-v0.4.0
```
## Usage
Expand All @@ -129,8 +110,7 @@ dependencies:

### Optional parameters

* `setAndroidMask(String drawableGreenName, String drawableWhiteName, String drawableRedName)` - replace the default SDK's masks in Android. Enter the name of the drawable to be used
* `setAndroidLayout(String layoutName)` - replace the SDK layout in Android with yours with the respectively [template](https://gist.github.com/kikogassen/62068b6e5bc7988d28594d833b125519)
* `setAndroidLayout(String layoutName, String drawableGreenName, String drawableWhiteName, String drawableRedName)` - replace the SDK layout and masks in Android with yours with the respectively [template](https://gist.github.com/kikogassen/62068b6e5bc7988d28594d833b125519)
* `setAndroidStyle(String styleName)` - set the SDK color style in Android. [Template](https://github.com/combateafraude/Mobile/wiki/Common#styles)

* `setIOSColorTheme(Color color)` - set the SDK color style for iOS.
Expand All @@ -151,7 +131,7 @@ Example:
```
- Note: Necessary add images in Assets Catalog Document on Xcode project

* `hasSound(bool hasSound)` - enable/disable the SDK sound
* `enableSound(bool enableSound)` - enable/disable the SDK sound
* `setRequestTimeout(int requestTimeout)` - set the server calls request timeout

### SDK Result
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group 'com.combateafraude.passiveface_liveness_sdk'
group 'com.combateafraude.passive_face_liveness'
version '1.0'

buildscript {
Expand Down Expand Up @@ -45,7 +45,7 @@ android {
}

dependencies {
implementation 'com.combateafraude.sdk:passive-face-liveness:1.+'
implementation 'com.combateafraude.sdk:passive-face-liveness:3.2.3'
}

}
3 changes: 1 addition & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.combateafraude.passiveface_liveness_sdk">
package="com.combateafraude.passive_face_liveness">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />

</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.combateafraude.passiveface_liveness_sdk;
package com.combateafraude.passive_face_liveness;

import android.app.Activity;
import android.content.Context;
Expand Down Expand Up @@ -35,9 +35,9 @@
import static android.app.Activity.RESULT_OK;

/**
* PassivefaceLivenessSdkPlugin
* PassiveFaceLivenessPlugin
*/
public class PassivefaceLivenessSdkPlugin implements FlutterPlugin, MethodCallHandler, ActivityAware, PluginRegistry.ActivityResultListener {
public class PassiveFaceLivenessPlugin implements FlutterPlugin, MethodCallHandler, ActivityAware, PluginRegistry.ActivityResultListener {
private static final String DEBUG_NAME = "PassiveFaceSdk";
private Activity activity;
private Context context;
Expand All @@ -46,7 +46,7 @@ public class PassivefaceLivenessSdkPlugin implements FlutterPlugin, MethodCallHa
private MethodChannel methodChannel;
private MethodChannel.Result pendingResult;

private static final String MESSAGE_CHANNEL = "com.combateafraude.passiveface_liveness_sdk/message";
private static final String MESSAGE_CHANNEL = "com.combateafraude.passive_face_liveness/message";

private static final int REQUEST_CODE_PASSIVEFACE_LIVENESS = 20950;

Expand All @@ -71,7 +71,7 @@ public static void registerWith(Registrar registrar) {
return;
}

PassivefaceLivenessSdkPlugin plugin = new PassivefaceLivenessSdkPlugin();
PassiveFaceLivenessPlugin plugin = new PassiveFaceLivenessPlugin();
plugin.setupChannels(registrar.messenger(), registrar.activity().getApplicationContext());
plugin.setActivity(registrar.activity());
registrar.addActivityResultListener(plugin);
Expand Down Expand Up @@ -149,7 +149,7 @@ private void getDocuments(MethodCall call, final Result result) {
}

String mobileToken = (String) argsMap.get("mobileToken");
Boolean hasSound = (Boolean) argsMap.get("hasSound");
Boolean enableSound = (Boolean) argsMap.get("enableSound");
Integer requestTimeout = (Integer) argsMap.get("requestTimeout");

Integer idRedMask = null;
Expand Down Expand Up @@ -188,9 +188,8 @@ private void getDocuments(MethodCall call, final Result result) {
}

PassiveFaceLiveness mPassiveFaceLiveness = new PassiveFaceLiveness.Builder(mobileToken)
.setMask(idGreenMask, idWhiteMask, idRedMask)
.setLayout(idLayout)
.hasSound(hasSound)
.setLayout(idLayout, idGreenMask, idWhiteMask, idRedMask)
.enableSound(enableSound)
.setStyle(idStyle)
.setRequestTimeout(requestTimeout)
.build();
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.combateafraude.passiveface_liveness_example"
applicationId "com.combateafraude.passive_face_liveness_example"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.combateafraude.passiveface_liveness_example">
package="com.combateafraude.passive_face_liveness_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.combateafraude.passiveface_liveness_example">
package="com.combateafraude.passive_face_liveness_example">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.combateafraude.passiveface_liveness_example;
package com.combateafraude.passive_face_liveness_example;

import io.flutter.embedding.android.FlutterActivity;

Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.combateafraude.passiveface_liveness_example">
package="com.combateafraude.passive_face_liveness_example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
5 changes: 2 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:passiveface_liveness_sdk/passiveface_liveness_sdk.dart';
import 'package:passive_face_liveness/passive_face_liveness.dart';
import 'package:permission_handler/permission_handler.dart';

void main() {
Expand All @@ -16,7 +16,7 @@ class _MyAppState extends State<MyApp> {
PassiveFaceLivenessResult passiveFaceLivenessResult =
PassiveFaceLivenessResult();

final mobileToken = 'mobileToken';
final mobileToken = '';

@override
void initState() {
Expand All @@ -28,7 +28,6 @@ class _MyAppState extends State<MyApp> {
void requestPermissions() async {
await [
Permission.camera,
Permission.storage,
].request();
}

Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
passiveface_liveness_sdk:
passive_face_liveness:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.3.0"
version: "0.4.0"
path:
dependency: transitive
description:
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: passiveface_liveness_example
description: Demonstrates how to use the passiveface_liveness plugin.
name: passive_face_liveness_example
description: Demonstrates how to use the passive_face_liveness plugin.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
Expand All @@ -12,7 +12,7 @@ dependencies:
flutter:
sdk: flutter

passiveface_liveness_sdk:
passive_face_liveness:
# When depending on this package from a real application you should use:
# passiveface_liveness: ^x.y.z
# See https://dart.dev/tools/pub/dependencies#version-constraints
Expand Down
2 changes: 1 addition & 1 deletion example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:passiveface_liveness_example/main.dart';
import 'package:passive_face_liveness_example/main.dart';

void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
Expand Down
4 changes: 4 additions & 0 deletions ios/Classes/PassiveFaceLivenessPlugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#import <Flutter/Flutter.h>

@interface PassiveFaceLivenessPlugin : NSObject<FlutterPlugin>
@end
15 changes: 15 additions & 0 deletions ios/Classes/PassiveFaceLivenessPlugin.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#import "PassiveFaceLivenessPlugin.h"
#if __has_include(<passive_face_liveness/passive_face_liveness-Swift.h>)
#import <passive_face_liveness/passive_face_liveness-Swift.h>
#else
// Support project import fallback if the generated compatibility header
// is not copied when this plugin is created as a library.
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
#import "passive_face_liveness-Swift.h"
#endif

@implementation PassiveFaceLivenessPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
[SwiftPassiveFaceLivenessPlugin registerWithRegistrar:registrar];
}
@end
4 changes: 0 additions & 4 deletions ios/Classes/PassivefaceLivenessSdkPlugin.h

This file was deleted.

15 changes: 0 additions & 15 deletions ios/Classes/PassivefaceLivenessSdkPlugin.m

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import Flutter
import UIKit
import PassiveFaceLiveness

let MESSAGE_CHANNEL = "com.combateafraude.passiveface_liveness_sdk/message"
let MESSAGE_CHANNEL = "com.combateafraude.passive_face_liveness/message"
let ERROR_CODE = "PASSIVE_FACE_LIVENESS_SDK_ERROR"

public class SwiftPassivefaceLivenessSdkPlugin: NSObject, FlutterPlugin, PassiveFaceLivenessControllerDelegate {
public class SwiftPassiveFaceLivenessPlugin: NSObject, FlutterPlugin, PassiveFaceLivenessControllerDelegate {
var methodChannel: FlutterMethodChannel?
var flutterResult: FlutterResult?

public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: MESSAGE_CHANNEL, binaryMessenger: registrar.messenger())
let instance = SwiftPassivefaceLivenessSdkPlugin()
let instance = SwiftPassiveFaceLivenessPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
}

Expand Down Expand Up @@ -118,7 +118,7 @@ public class SwiftPassivefaceLivenessSdkPlugin: NSObject, FlutterPlugin, Passive

let passiveFacelivenessConfiguration = PassiveFaceLivenessBuilder(apiToken: mobileToken)
.setRequestTimeout(seconds: TimeInterval(requestTimeout))
.setHasSound(hasSound: hasSound)
.setHasSound(hasSound: enableSound)
.showStepLabel(show: showStepLabel)
.showStatusLabel(show: showStatusLabel)
.setColorTheme(color: colorTheme)
Expand Down
Loading

0 comments on commit 78eaf65

Please sign in to comment.