Skip to content

Commit 39b5702

Browse files
committed
adding scope in custom params via a method putCustomFieldWithScope
1 parent 6a9dfdd commit 39b5702

File tree

9 files changed

+1569
-11141
lines changed

9 files changed

+1569
-11141
lines changed

android/src/main/java/com/reactlibrary/VerloopSdkPackage/RNVerloopSdkModule.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,19 @@ public void putCustomField(String key, String value) {
102102
}
103103
}
104104

105+
@ReactMethod
106+
public void putCustomFieldWithScope(String key, String value, String scope) {
107+
if (verloopConfig != null) {
108+
if (scope.equals("USER")){
109+
verloopConfig.putCustomField(key, value, VerloopConfig.Scope.USER);
110+
}else if (scope.equals("ROOM")){
111+
verloopConfig.putCustomField(key, value, VerloopConfig.Scope.ROOM);
112+
}else{
113+
verloopConfig.putCustomField(key, value);
114+
}
115+
}
116+
}
117+
105118
@ReactMethod
106119
public void setRecipeId(String recipeId) {
107120
if (verloopConfig != null) {
@@ -164,4 +177,4 @@ public void onHostDestroy() {
164177
verloop.onStopChat();
165178
}
166179
}
167-
}
180+
}

ios/RNVerloopSdk.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
A077E707258A3C1100194B88 /* RNVerloopSdk.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNVerloopSdk.m */; };
1011
A08AD79C24AB9C18005E51FB /* VerloopSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A08AD79B24AB9C18005E51FB /* VerloopSDK.framework */; };
1112
A0D2791924A2347100CFD63C /* libRNVerloopSdk.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 134814201AA4EA6300B7C361 /* libRNVerloopSdk.a */; };
12-
B3E7B58A1CC2AC0600A0062D /* RNVerloopSdk.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNVerloopSdk.m */; };
1313
/* End PBXBuildFile section */
1414

1515
/* Begin PBXCopyFilesBuildPhase section */
@@ -119,7 +119,7 @@
119119
isa = PBXSourcesBuildPhase;
120120
buildActionMask = 2147483647;
121121
files = (
122-
B3E7B58A1CC2AC0600A0062D /* RNVerloopSdk.m in Sources */,
122+
A077E707258A3C1100194B88 /* RNVerloopSdk.m in Sources */,
123123
);
124124
runOnlyForDeploymentPostprocessing = 0;
125125
};

ios/RNVerloopSdk/RNVerloopSdk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
@interface RNVerloopSdk : RCTEventEmitter <RCTBridgeModule>
1111

1212
@end
13-
13+

ios/RNVerloopSdk/RNVerloopSdk.m

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,20 @@ - (dispatch_queue_t)methodQueue
7070
}
7171
}
7272

73+
RCT_EXPORT_METHOD(putCustomFieldWithScope:(NSString *)key userId:(NSString *)value scope:(NSString *)scopeValue)
74+
{
75+
if(config != nil){
76+
if ([scopeValue isEqualToString:@"ROOM"]){
77+
[config putCustomFieldWithKey:key value:value scope:SCOPEROOM];
78+
}else if ([scopeValue isEqualToString:@"USER"]){
79+
[config putCustomFieldWithKey:key value:value scope:SCOPEUSER];
80+
}else{
81+
[config putCustomFieldWithKey:key value:value scope:SCOPEUSER];
82+
}
83+
84+
}
85+
}
86+
7387
RCT_EXPORT_METHOD(setRecipeId:(NSString *)recipeId)
7488
{
7589
if(config != nil){
@@ -115,4 +129,4 @@ - (dispatch_queue_t)methodQueue
115129
}
116130

117131
@end
118-
132+

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-verloop-sdk",
33
"title": "React Native Verloop Sdk",
4-
"version": "1.0.68",
4+
"version": "1.0.70",
55
"description": "TODO",
66
"main": "index.js",
77
"scripts": {

sample/SampleProject/VerloopLivechat.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export default class VerloopLiveChat extends Component {
2626

2727
//optional
2828
// VerloopSdk.putCustomField(key, value);
29+
//optional
30+
VerloopSdk.putCustomFieldWithScope("test", "value", "USER");
2931
// //optional
3032
// VerloopSdk.setRecipeId(recipeId);
3133
// //optional

0 commit comments

Comments
 (0)