Skip to content

Update build.gradle and add prechat form #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: 'com.android.library'

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

buildscript {
Expand All @@ -8,30 +10,31 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
google()
classpath 'com.android.tools.build:gradle:3.2.1'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion safeExtGet('compileSdkVersion', 23)
buildToolsVersion safeExtGet('buildToolsVersion', "23.0.1")
compileSdkVersion safeExtGet('compileSdkVersion', 28)
buildToolsVersion safeExtGet('buildToolsVersion', "28.0.3")

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 22)
versionCode 1
versionName "1.0"
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 1
versionName "1.0"
}
}

repositories {
mavenCentral()
maven { url 'https://zendesk.artifactoryonline.com/zendesk/repo' }
jcenter()
google()
maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
}

dependencies {
compile "com.facebook.react:react-native:+"
compile group: 'com.zopim.android', name: 'sdk', version: '1.4.2'
implementation "com.facebook.react:react-native:+"
implementation group: 'com.zopim.android', name: 'sdk', version: '1.4.8'
}
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.taskrabbit.zendesk.RNZendeskChat" >
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.taskrabbit.zendesk" >
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.zopim.android.sdk.api.ZopimChat;
import com.zopim.android.sdk.prechat.PreChatForm;
import com.zopim.android.sdk.model.VisitorInfo;
import com.zopim.android.sdk.prechat.ZopimChatActivity;

Expand Down Expand Up @@ -48,7 +49,16 @@ public void setVisitorInfo(ReadableMap options) {

@ReactMethod
public void init(String key) {
ZopimChat.init(key);
PreChatForm defaultPreChat = new PreChatForm.Builder()
.name(PreChatForm.Field.REQUIRED)
.email(PreChatForm.Field.REQUIRED)
.phoneNumber(PreChatForm.Field.REQUIRED)
.department(PreChatForm.Field.REQUIRED_EDITABLE)
.message(PreChatForm.Field.REQUIRED)
.build();
ZopimChat.init(key)
.preChatForm(defaultPreChat)
.build();
}

@ReactMethod
Expand Down