Skip to content

Commit

Permalink
Merge pull request #121 from intercom/vr/add-present-conversation-but…
Browse files Browse the repository at this point in the history
…ton-to-sample-app

Present conversation with id
  • Loading branch information
theVinesh committed Aug 1, 2023
2 parents 3d0c3ee + 458eebf commit b222b52
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
10 changes: 5 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ PODS:
- FlipperKit/FlipperKitNetworkPlugin
- fmt (6.2.1)
- glog (0.3.5)
- Intercom (15.0.2)
- intercom-react-native (5.1.2):
- Intercom (~> 15.0.2)
- Intercom (15.1.3)
- intercom-react-native (5.2.0):
- Intercom (~> 15.1.3)
- React-Core
- libevent (2.1.12)
- OpenSSL-Universal (1.1.1100)
Expand Down Expand Up @@ -533,8 +533,8 @@ SPEC CHECKSUMS:
FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
Intercom: bb499c2bdeacaabb498c94572afa5fcfd74294eb
intercom-react-native: 00d89b6267abc4470949a071bfac4550fbeb6deb
Intercom: 9148ad2d563bbe0715f81df4ee153988f425c145
intercom-react-native: b11b963bc80cac98f4ef6267c8b57f11fe3cbe93
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda
Expand Down
29 changes: 28 additions & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
COLLECTION_ID,
SEARCH_TERM,
TOKEN,
CONVERSATION_ID,
} from './constants';

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

const [conversationId, setConversationId] = useState<string | undefined>(
CONVERSATION_ID
);
const [articleId, setArticleId] = useState<string | undefined>(ARTICLE_ID);
const [carouselId, setCarouselId] = useState<string | undefined>(CAROUSEL_ID);
const [surveyId, setSurveyId] = useState<string | undefined>(SURVEY_ID);
Expand Down Expand Up @@ -90,6 +94,7 @@ export default function App() {
Intercom.setInAppMessageVisibility(Visibility.VISIBLE).then(() =>
setInAppMessageVisibility(true)
);
setConversationId(CONVERSATION_ID);
setArticleId(ARTICLE_ID);
setCarouselId(CAROUSEL_ID);
setSurveyId(SURVEY_ID);
Expand Down Expand Up @@ -282,7 +287,29 @@ export default function App() {
});
}}
/>

<Input
title="Conversation Id"
accessibilityLabel="conversation-id"
value={conversationId}
onChangeText={(val) => {
setConversationId(val);
}}
placeholder="Conversation Id"
/>
<Button
intercom_accessibilityLabel="present-conversation"
intercom_disabled={!loggedUser}
intercom_title="Display Conversation"
intercom_onPress={() => {
if (conversationId) {
let conversationContent =
IntercomContent.conversationWithConversationId(conversationId);
Intercom.presentContent(conversationContent);
} else {
showEmptyAlertMessage('Conversation Id');
}
}}
/>
<Input
title="Article Id"
accessibilityLabel="article-id"
Expand Down
1 change: 1 addition & 0 deletions example/src/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Platform } from 'react-native';
export const CAROUSEL_ID = Config.CAROUSEL_ID;
export const SURVEY_ID = Config.SURVEY_ID;
export const EVENT_NAME = Config.EVENT_NAME;
export const CONVERSATION_ID = Config.CONVERSATION_ID;
export const ARTICLE_ID = Config.ARTICLE_ID;
export const USER_NAME = Config.USER_NAME;
export const COLLECTION_ID = Config.COLLECTION_ID;
Expand Down

0 comments on commit b222b52

Please sign in to comment.