Skip to content

Commit 1dea978

Browse files
committed
Updates API naming
- made changes to gradle config - Added other content types of iOS Module
1 parent f174e89 commit 1dea978

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

android/build.gradle

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ def safeExtGet(prop, fallback) {
2323
}
2424

2525
android {
26-
compileSdkVersion safeExtGet('IntercomReactNative_compileSdkVersion', 31)
26+
compileSdkVersion safeExtGet('IntercomReactNative_compileSdkVersion', 33)
2727
defaultConfig {
2828
minSdkVersion safeExtGet('IntercomReactNative_minSdkVersion', 21)
29-
targetSdkVersion safeExtGet('IntercomReactNative_targetSdkVersion', 31)
29+
targetSdkVersion safeExtGet('IntercomReactNative_targetSdkVersion', 33)
3030
versionCode 1
3131
versionName "1.0"
3232
buildConfigField 'String', 'INTERCOM_VERSION_NAME', packageVersion
@@ -60,5 +60,11 @@ dependencies {
6060
//noinspection GradleDynamicVersion
6161
implementation "com.facebook.react:react-native:+" // From node_modules
6262
implementation 'com.google.firebase:firebase-messaging:20.2.+'
63-
implementation 'io.intercom.android:intercom-sdk:12.4.2'
63+
implementation 'io.intercom.android:intercom-sdk:14.0.0'
64+
implementation ("androidx.appcompat:appcompat:1.3.1") {
65+
version {
66+
strictly '1.3.1'
67+
}
68+
}
6469
}
70+

example/src/App.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import Intercom, {
2222

2323
import Button from './Button';
2424
import Input from './Input';
25-
// import type { UserAttributes } from '../../lib/typescript';
2625
import Config from 'react-native-config';
2726
import AsyncStorage from '@react-native-async-storage/async-storage';
2827

@@ -226,7 +225,7 @@ export default function App() {
226225
disabled={!loggedUser}
227226
title="Present Intercom"
228227
onPress={() => {
229-
Intercom.presentIntercom();
228+
Intercom.present();
230229
}}
231230
/>
232231
<Input
@@ -264,15 +263,15 @@ export default function App() {
264263
disabled={!loggedUser}
265264
title="Present Help Center"
266265
onPress={() => {
267-
Intercom.presentIntercomSpace(Space.helpCenter);
266+
Intercom.presentSpace(Space.helpCenter);
268267
}}
269268
/>
270269
<Button
271270
accessibilityLabel="display-help-center"
272271
disabled={!loggedUser}
273272
title="Present Messages"
274273
onPress={() => {
275-
Intercom.presentIntercomSpace(Space.messages);
274+
Intercom.presentSpace(Space.messages);
276275
}}
277276
/>
278277
<Button

ios/IntercomModule.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,16 @@ - (NSData *)dataFromHexString:(NSString *)string {
207207
resolver:(RCTPromiseResolveBlock)resolve
208208
rejecter:(RCTPromiseRejectBlock)reject) {
209209
IntercomContent *intercomContent;
210-
if ([content[@"type"] isEqualToString:@"ARTICLE"]) {
210+
NSString *contentType = content[@"type"];
211+
if ([contentType isEqualToString:@"ARTICLE"]) {
211212
intercomContent = [IntercomContent articleWithId:content[@"id"]];
212-
} else if ([content[@"type"] isEqualToString:@"CAROUSEL"]) {
213+
} else if ([contentType isEqualToString:@"CAROUSEL"]) {
213214
intercomContent = [IntercomContent carouselWithId:content[@"id"]];
215+
} else if ([contentType isEqualToString:@"SURVEY"]) {
216+
intercomContent = [IntercomContent surveyWithId:content[@"id"]];
217+
} else if ([contentType isEqualToString:@"HELP_CENTER_COLLECTIONS"]) {
218+
NSArray<NSString *> *collectionIds = [NSArray arrayWithObjects:content[@"ids"], nil];
219+
intercomContent = [IntercomContent helpCenterCollectionsWithIds:collectionIds];
214220
}
215221
if (intercomContent) {
216222
[Intercom presentContent:intercomContent];

src/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,15 @@ export type IntercomType = {
184184
* Present Intercom as a modal overlay in your app.
185185
* The `Home` space is displayed by default.
186186
*/
187-
presentIntercom(): Promise<boolean>;
187+
present(): Promise<boolean>;
188188

189189
/**
190190
* Present an Intercom `space` as a modal overlay in your app
191191
* @see {@link Space} for a list of valid spaces.
192192
*
193193
* @param space The Intercom space to be presented.
194194
*/
195-
presentIntercomSpace(space: Space): Promise<boolean>;
195+
presentSpace(space: Space): Promise<boolean>;
196196

197197
presentContent(content: Content): Promise<boolean>;
198198

@@ -368,8 +368,8 @@ const Intercom: IntercomType = {
368368
fetchHelpCenterCollection: (id = '') => IntercomModule.fetchHelpCenterCollection(id),
369369
searchHelpCenter: (term = '') => IntercomModule.searchHelpCenter(term),
370370

371-
presentIntercom: () => IntercomModule.presentIntercom(),
372-
presentIntercomSpace: (space) => IntercomModule.presentIntercomSpace(space),
371+
present: () => IntercomModule.presentIntercom(),
372+
presentSpace: (space) => IntercomModule.presentIntercomSpace(space),
373373
presentContent: (content) => IntercomModule.presentContent(content),
374374
presentMessageComposer: (initialMessage = undefined) => IntercomModule.presentMessageComposer(initialMessage),
375375
getUnreadConversationCount: () => IntercomModule.getUnreadConversationCount(),
@@ -449,7 +449,7 @@ interface Survey extends Content {
449449
}
450450

451451
interface HelpCenterCollections extends Content {
452-
ids: [string];
452+
ids: string[];
453453
}
454454

455455
export type IntercomContentType = {

0 commit comments

Comments
 (0)