Skip to content

Commit 1931f05

Browse files
authored
Merge pull request #43 from zanechua/android-prechat-form
Update build.gradle and add prechat form
2 parents 95d1074 + 095ffe5 commit 1931f05

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

android/build.gradle

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
apply plugin: 'com.android.library'
2+
13
def safeExtGet(prop, fallback) {
2-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
4+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
35
}
46

57
buildscript {
@@ -8,30 +10,31 @@ buildscript {
810
}
911

1012
dependencies {
11-
classpath 'com.android.tools.build:gradle:1.2.3'
13+
google()
14+
classpath 'com.android.tools.build:gradle:3.2.1'
1215
}
1316
}
1417

15-
apply plugin: 'com.android.library'
16-
1718
android {
18-
compileSdkVersion safeExtGet('compileSdkVersion', 23)
19-
buildToolsVersion safeExtGet('buildToolsVersion', "23.0.1")
19+
compileSdkVersion safeExtGet('compileSdkVersion', 28)
20+
buildToolsVersion safeExtGet('buildToolsVersion', "28.0.3")
2021

2122
defaultConfig {
22-
minSdkVersion safeExtGet('minSdkVersion', 16)
23-
targetSdkVersion safeExtGet('targetSdkVersion', 22)
24-
versionCode 1
25-
versionName "1.0"
23+
minSdkVersion safeExtGet('minSdkVersion', 16)
24+
targetSdkVersion safeExtGet('targetSdkVersion', 28)
25+
versionCode 1
26+
versionName "1.0"
2627
}
2728
}
2829

2930
repositories {
3031
mavenCentral()
31-
maven { url 'https://zendesk.artifactoryonline.com/zendesk/repo' }
32+
jcenter()
33+
google()
34+
maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
3235
}
3336

3437
dependencies {
35-
compile "com.facebook.react:react-native:+"
36-
compile group: 'com.zopim.android', name: 'sdk', version: '1.4.2'
38+
implementation "com.facebook.react:react-native:+"
39+
implementation group: 'com.zopim.android', name: 'sdk', version: '1.4.8'
3740
}

android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.taskrabbit.zendesk.RNZendeskChat" >
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.taskrabbit.zendesk" >
33
</manifest>

android/src/main/java/com/taskrabbit/zendesk/RNZendeskChatModule.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.facebook.react.bridge.ReactMethod;
1010
import com.facebook.react.bridge.ReadableMap;
1111
import com.zopim.android.sdk.api.ZopimChat;
12+
import com.zopim.android.sdk.prechat.PreChatForm;
1213
import com.zopim.android.sdk.model.VisitorInfo;
1314
import com.zopim.android.sdk.prechat.ZopimChatActivity;
1415

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

4950
@ReactMethod
5051
public void init(String key) {
51-
ZopimChat.init(key);
52+
PreChatForm defaultPreChat = new PreChatForm.Builder()
53+
.name(PreChatForm.Field.REQUIRED)
54+
.email(PreChatForm.Field.REQUIRED)
55+
.phoneNumber(PreChatForm.Field.REQUIRED)
56+
.department(PreChatForm.Field.REQUIRED_EDITABLE)
57+
.message(PreChatForm.Field.REQUIRED)
58+
.build();
59+
ZopimChat.init(key)
60+
.preChatForm(defaultPreChat)
61+
.build();
5262
}
5363

5464
@ReactMethod

0 commit comments

Comments
 (0)