Skip to content

Commit 8f15f0b

Browse files
committed
Present conversation with id
1 parent f31214a commit 8f15f0b

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

example/ios/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ PODS:
7373
- FlipperKit/FlipperKitNetworkPlugin
7474
- fmt (6.2.1)
7575
- glog (0.3.5)
76-
- Intercom (15.0.2)
77-
- intercom-react-native (5.1.2):
78-
- Intercom (~> 15.0.2)
76+
- Intercom (15.1.3)
77+
- intercom-react-native (5.2.0):
78+
- Intercom (~> 15.1.3)
7979
- React-Core
8080
- libevent (2.1.12)
8181
- OpenSSL-Universal (1.1.1100)
@@ -533,8 +533,8 @@ SPEC CHECKSUMS:
533533
FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86
534534
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
535535
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
536-
Intercom: bb499c2bdeacaabb498c94572afa5fcfd74294eb
537-
intercom-react-native: 00d89b6267abc4470949a071bfac4550fbeb6deb
536+
Intercom: 9148ad2d563bbe0715f81df4ee153988f425c145
537+
intercom-react-native: b11b963bc80cac98f4ef6267c8b57f11fe3cbe93
538538
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
539539
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
540540
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda

example/src/App.tsx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
COLLECTION_ID,
3030
SEARCH_TERM,
3131
TOKEN,
32+
CONVERSATION_ID,
3233
} from './constants';
3334

3435
import Button from './components/Button';
@@ -48,6 +49,9 @@ export default function App() {
4849
const [launcherVisibility, setLauncherVisibility] = useState<boolean>(false);
4950
const [user, setUser] = useState<UserAttributes>({ email: '' });
5051

52+
const [conversationId, setConversationId] = useState<string | undefined>(
53+
CONVERSATION_ID
54+
);
5155
const [articleId, setArticleId] = useState<string | undefined>(ARTICLE_ID);
5256
const [carouselId, setCarouselId] = useState<string | undefined>(CAROUSEL_ID);
5357
const [surveyId, setSurveyId] = useState<string | undefined>(SURVEY_ID);
@@ -90,6 +94,7 @@ export default function App() {
9094
Intercom.setInAppMessageVisibility(Visibility.VISIBLE).then(() =>
9195
setInAppMessageVisibility(true)
9296
);
97+
setConversationId(CONVERSATION_ID);
9398
setArticleId(ARTICLE_ID);
9499
setCarouselId(CAROUSEL_ID);
95100
setSurveyId(SURVEY_ID);
@@ -282,7 +287,29 @@ export default function App() {
282287
});
283288
}}
284289
/>
285-
290+
<Input
291+
title="Conversation Id"
292+
accessibilityLabel="conversation-id"
293+
value={conversationId}
294+
onChangeText={(val) => {
295+
setConversationId(val);
296+
}}
297+
placeholder="Conversation Id"
298+
/>
299+
<Button
300+
intercom_accessibilityLabel="present-conversation"
301+
intercom_disabled={!loggedUser}
302+
intercom_title="Present Conversation"
303+
intercom_onPress={() => {
304+
if (conversationId) {
305+
let conversationContent =
306+
IntercomContent.conversationWithConversationId(conversationId);
307+
Intercom.presentContent(conversationContent);
308+
} else {
309+
showEmptyAlertMessage('Conversation Id');
310+
}
311+
}}
312+
/>
286313
<Input
287314
title="Article Id"
288315
accessibilityLabel="article-id"

example/src/constants.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Platform } from 'react-native';
44
export const CAROUSEL_ID = Config.CAROUSEL_ID;
55
export const SURVEY_ID = Config.SURVEY_ID;
66
export const EVENT_NAME = Config.EVENT_NAME;
7+
export const CONVERSATION_ID = Config.CONVERSATION_ID;
78
export const ARTICLE_ID = Config.ARTICLE_ID;
89
export const USER_NAME = Config.USER_NAME;
910
export const COLLECTION_ID = Config.COLLECTION_ID;

0 commit comments

Comments
 (0)