Skip to content

Commit 3d0c3ee

Browse files
authored
Merge pull request #118 from intercom/uv/add_new_content_type_support
Added conversation content type support
2 parents c1cfa56 + f31214a commit 3d0c3ee

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

android/src/main/java/com/intercom/reactnative/IntercomModule.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ public void presentContent(ReadableMap params, Promise promise) {
325325
List<String> collectionIds = IntercomHelpers.readableArrayToStringList(params.getArray("ids"));
326326
content = new IntercomContent.HelpCenterCollections(collectionIds);
327327
break;
328+
case "CONVERSATION":
329+
content = new IntercomContent.Conversation(params.getString("id"));
330+
break;
328331
}
329332
if (content != null) {
330333
Intercom.client().presentContent(content);

intercom-react-native.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ Pod::Spec.new do |s|
1717
s.resource_bundles = { 'IntercomFramework' => ['ios/assets/*'] }
1818

1919
s.dependency "React-Core"
20-
s.dependency "Intercom", '~> 15.0.2'
20+
s.dependency "Intercom", '~> 15.1.3'
2121
end

ios/IntercomModule.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ - (NSData *)dataFromHexString:(NSString *)string {
221221
} else if ([contentType isEqualToString:@"HELP_CENTER_COLLECTIONS"]) {
222222
NSArray<NSString *> *collectionIds = content[@"ids"];
223223
intercomContent = [IntercomContent helpCenterCollectionsWithIds:collectionIds];
224+
} else if ([contentType isEqualToString:@"CONVERSATION"]) {
225+
intercomContent = [IntercomContent conversationWithId:content[@"id"]];
224226
}
225227
if (intercomContent) {
226228
[Intercom presentContent:intercomContent];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@intercom/intercom-react-native",
3-
"version": "5.1.2",
3+
"version": "5.2.0",
44
"description": "React Native wrapper to bridge our iOS and Android SDK",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

src/index.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ export enum ContentType {
459459
Carousel = 'CAROUSEL',
460460
Survey = 'SURVEY',
461461
HelpCenterCollections = 'HELP_CENTER_COLLECTIONS',
462+
Conversation = 'CONVERSATION',
462463
}
463464

464465
export interface Content {
@@ -481,6 +482,10 @@ interface HelpCenterCollections extends Content {
481482
ids: string[];
482483
}
483484

485+
interface Conversation extends Content {
486+
id: string;
487+
}
488+
484489
export type IntercomContentType = {
485490
/**
486491
* Create
@@ -491,6 +496,7 @@ export type IntercomContentType = {
491496
helpCenterCollectionsWithIds: (
492497
collectionIds: string[]
493498
) => HelpCenterCollections;
499+
conversationWithConversationId: (conversationId: string) => Conversation;
494500
};
495501

496502
export const IntercomContent: IntercomContentType = {
@@ -521,4 +527,11 @@ export const IntercomContent: IntercomContentType = {
521527
helpCenterCollectionsContent.ids = collectionIds;
522528
return helpCenterCollectionsContent;
523529
},
530+
531+
conversationWithConversationId(conversationId) {
532+
let conversationContent = {} as Conversation;
533+
conversationContent.type = ContentType.Conversation;
534+
conversationContent.id = conversationId;
535+
return conversationContent;
536+
},
524537
};

0 commit comments

Comments
 (0)