@@ -20,7 +20,16 @@ import Intercom, {
2020 IntercomContent ,
2121} from '@intercom/intercom-react-native' ;
2222
23- import { CAROUSEL_ID , SURVEY_ID , EVENT_NAME , ARTICLE_ID , USER_NAME , COLLECTION_ID , SEARCH_TERM , TOKEN } from './constants'
23+ import {
24+ CAROUSEL_ID ,
25+ SURVEY_ID ,
26+ EVENT_NAME ,
27+ ARTICLE_ID ,
28+ USER_NAME ,
29+ COLLECTION_ID ,
30+ SEARCH_TERM ,
31+ TOKEN
32+ } from './constants'
2433
2534import Button from './components/Button' ;
2635import Input from './components/Input' ;
@@ -62,7 +71,7 @@ export default function App() {
6271
6372 const showIncorrectFieldMessage = ( field : string ) => {
6473 Alert . alert ( field , `Provided ${ field } is not of correct format` ) ;
65- }
74+ } ;
6675
6776 const validateEmail = ( email : string | undefined ) => {
6877 return String ( email )
@@ -72,7 +81,21 @@ export default function App() {
7281 ) ;
7382 } ;
7483
75-
84+ const resetAttributes = ( ) => {
85+ setCount ( 0 ) ;
86+ Intercom . setBottomPadding ( 0 ) . then ( ( ) =>
87+ setBottomPadding ( 0 )
88+ ) ;
89+ Intercom . setLauncherVisibility ( Visibility . GONE ) . then ( ( ) => setLauncherVisibility ( false ) ) ;
90+ Intercom . setInAppMessageVisibility ( Visibility . VISIBLE ) . then ( ( ) => setInAppMessageVisibility ( true ) ) ;
91+ setArticleId ( ARTICLE_ID ) ;
92+ setCarouselId ( CAROUSEL_ID ) ;
93+ setSurveyId ( SURVEY_ID ) ;
94+ setEventName ( EVENT_NAME ) ;
95+ setCollectionId ( COLLECTION_ID ) ;
96+ setSearchTerm ( SEARCH_TERM ) ;
97+ setUserName ( USER_NAME )
98+ }
7699
77100 useEffect ( ( ) => {
78101 /**
@@ -484,6 +507,14 @@ export default function App() {
484507 Intercom . sendTokenToIntercom ( TOKEN ) ;
485508 } }
486509 />
510+ < Button
511+ intercom_accessibilityLabel = "reset-attributes"
512+ intercom_disabled = { ! loggedUser }
513+ intercom_title = "Reset Attributes"
514+ intercom_onPress = { ( ) => {
515+ resetAttributes ( )
516+ } }
517+ />
487518 < Button
488519 intercom_accessibilityLabel = "logout"
489520 intercom_disabled = { ! loggedUser }
0 commit comments