Skip to content

Commit

Permalink
MOB-702: Add iovation helper module
Browse files Browse the repository at this point in the history
  • Loading branch information
Casey Kulm committed Aug 14, 2017
1 parent 99127bc commit f633b27
Show file tree
Hide file tree
Showing 42 changed files with 1,389 additions and 1,146 deletions.
7 changes: 4 additions & 3 deletions app/app-dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ ext {
// the version number in one location for those artifacts
demoAppSharedVersions = [
okhttp3Version : '3.2.0',
supportLibraryVersion : '25.0.1',
supportLibraryVersion : '25.2.0',
leakCanaryVersion : '1.5',
bvSdkVersion : VERSION_NAME,
stethoVersion : '1.3.1',
butterknifeVersion : '8.5.0',
daggerVersion: '2.8',
playServicesVersion: '9.8.0'
playServicesVersion: '11.0.0'
]

demoAppBuildDep = [
androidPlugin : 'com.android.tools.build:gradle:2.3.2',
androidPlugin : 'com.android.tools.build:gradle:2.3.3',
crashlyticsPlugin : 'io.fabric.tools:gradle:1.21.6',
]

Expand Down Expand Up @@ -62,6 +62,7 @@ ext {
processPhoenix : "com.jakewharton:process-phoenix:2.0.0",
bvSdkAnalytics : "com.bazaarvoice.bvandroidsdk:analytics:$demoAppSharedVersions.bvSdkVersion",
bvSdkAds : "com.bazaarvoice.bvandroidsdk:advertising:$demoAppSharedVersions.bvSdkVersion",
bvSdkAuthIovation : "com.bazaarvoice.bvandroidsdk:auth-iovation:$demoAppSharedVersions.bvSdkVersion",
bvSdkConversations : "com.bazaarvoice.bvandroidsdk:conversations:$demoAppSharedVersions.bvSdkVersion",
bvSdkCurations : "com.bazaarvoice.bvandroidsdk:curations:$demoAppSharedVersions.bvSdkVersion",
bvSdkRecommendations: "com.bazaarvoice.bvandroidsdk:recommendations:$demoAppSharedVersions.bvSdkVersion",
Expand Down
16 changes: 3 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ buildscript {
classpath demoAppBuildDep.crashlyticsPlugin
// classpath demoAppBuildDep.androidAptPlugin
}
repositories {
flatDir {
dirs 'libs'
}
}
}

repositories {
Expand Down Expand Up @@ -103,6 +98,7 @@ dependencies {
if (useLocalSdk) {
compile project(':bvanalytics')
compile project(':bvadvertising')
compile project(':bvauthiovation')
compile project(':bvrecommendations')
compile project(':bvconversations')
compile project(':bvcurations')
Expand All @@ -114,6 +110,8 @@ dependencies {
} else {
compile demoAppDep.bvSdkAnalytics
compile demoAppDep.bvSdkAds
compile demoAppDep.bvSdkAuthIovation
compile('com.iovation.deviceprint.lib.DevicePrint:deviceprint-lib-release-2.3.3:2.3.3@aar')
compile demoAppDep.bvSdkRecommendations
compile demoAppDep.bvSdkConversations
compile demoAppDep.bvSdkCurations
Expand Down Expand Up @@ -145,14 +143,6 @@ dependencies {
compile demoAppDep.butterknife
compile demoAppDep.processPhoenix
annotationProcessor demoAppDep.butterknifeCompiler
// iovation aar dependency
// Uncomment the following lines to add iovation support
// Make sure the iovation arr is in the app/libs folder
// dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
// compile(name:'deviceprint-release-2.3.0', ext:'aar')
// compile(group:'com.android.support', name:'support-v4', version:'23.0.1')
// }
releaseCompile demoAppDep.leakCanaryNoOp
debugCompile demoAppDep.leakCanary
testCompile demoAppTestDep.junit
Expand Down
Binary file added app/libs/deviceprint-lib-release-2.3.3.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.bazaarvoice.bvandroidsdk.BVSDK;
import com.bazaarvoice.bvandroidsdk.BazaarEnvironment;
import com.bazaarvoice.bvandroidsdk.CurationsImageLoader;
import com.bazaarvoice.bvandroidsdk.IovationFingerprint;
import com.bazaarvoice.bvandroidsdk.PinClient;
import com.bazaarvoice.bvsdkdemoandroid.configs.DemoClientConfigUtils;
import com.bazaarvoice.bvsdkdemoandroid.conversations.DemoConvResponseHandler;
Expand Down Expand Up @@ -58,7 +59,9 @@ BVSDK provideBvSdk(

@Provides @DemoAppScope
BVConversationsClient provideConversationsClient(BVSDK bvsdk) {
return new BVConversationsClient();
return new BVConversationsClient.Builder(bvsdk)
.fingerprintProvider(new IovationFingerprint(bvsdk)) // For North America authentication
.build();
}

@Provides @DemoAppScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,11 @@ private boolean readyForDemo() {
}

private void submitReviewWithPhoto(String productId) {
// For clients non-EU clients, iovation SDK is required!
// String blackbox = getBlackbox(getContext().getApplicationContext());

view.showProgressWithTitle("Submitting Review...");

File localImageFile = demoAssetsUtil.parseImageFileFromAssets("puppy_thumbnail.jpg");

ReviewSubmissionRequest submission = new ReviewSubmissionRequest.Builder(submitAction, productId)
// .fingerPrint(blackbox) // uncomment me when using iovation SDK
.userNickname("shazbat")
.userEmail("foo@bar.com")
.userId("shazbatuser" + Math.random()) // Creating a random user id to avoid duplicated -- FOR TESTING ONLY!!!
Expand Down
4 changes: 0 additions & 4 deletions bvadvertising/src/main/res/values/strings.xml

This file was deleted.

3 changes: 0 additions & 3 deletions bvanalytics/src/main/res/values/strings.xml

This file was deleted.

1 change: 1 addition & 0 deletions bvauthiovation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
30 changes: 30 additions & 0 deletions bvauthiovation/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
buildscript {
dependencies {
classpath sdkBuildDep.androidPlugin
classpath sdkBuildDep.credentialsPlugin
classpath sdkBuildDep.jacocoPlugin
}
}

repositories {
flatDir {
dir 'libs'
}
}

apply from: rootProject.file('gradle/bvsdk-module-android.gradle')

dependencies {
compile('com.iovation.deviceprint.lib.DevicePrint:deviceprint-lib-release-2.3.3:2.3.3@aar')
compile project(':bvconversations')
provided sdkDep.okhttp3

// Dependencies for local unit tests
testCompile sdkTestDep.junit
testCompile sdkTestDep.mockito
testCompile sdkTestDep.mockWebServer
testCompile sdkTestDep.robolectric
}

apply from: rootProject.file('gradle/setup-signing.gradle')
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
3 changes: 3 additions & 0 deletions bvauthiovation/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POM_NAME=Bazaarvoice Authentication Iovation Library
POM_ARTIFACT_ID=auth-iovation
POM_PACKAGING=aar
Binary file not shown.
25 changes: 25 additions & 0 deletions bvauthiovation/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/casey.kulm/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
2 changes: 2 additions & 0 deletions bvauthiovation/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bazaarvoice.bvandroidsdk_authiovation"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.bazaarvoice.bvandroidsdk;

import android.content.Context;

import com.iovation.mobile.android.DevicePrint;

public final class IovationFingerprint implements FingerprintProvider {
private final Context appContext;
private String fingerPrint;
private boolean started = false;

public IovationFingerprint(BVSDK bvsdk) {
this.appContext = bvsdk.getBvUserProvidedData().getAppContext();
}

@Override
public String getFingerprint() throws VerifyError {
if (!started) {
DevicePrint.start(appContext);
fingerPrint = DevicePrint.getBlackbox(appContext);
started = true;
}
return fingerPrint;
}
}
1 change: 0 additions & 1 deletion bvcommon/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="bv_sdk_common">BVSDK Common</string>
<string name="seen_product_onscreen_with_id_set">seen_product_onscreen_with_id_set</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected void modifyPropertiesToInitSDK() {}

protected void afterInitSdk(BVSDK bvsdk) {}

String jsonFileAsString(String fileName) throws IOException {
static String jsonFileAsString(String fileName) throws IOException {
File file = new File("src/test/resources/" + fileName);
return readFile(file);
}
Expand Down
Loading

0 comments on commit f633b27

Please sign in to comment.