Skip to content

Commit 9317632

Browse files
authored
Merge branch 'main' into dependabot/bundler/sandboxes/NotificationsSandbox/rexml-3.2.8
2 parents 960733b + cde7578 commit 9317632

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+71621
-32315
lines changed

.circleci/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ version: 2.1
33
# Default VM config to be used for macOS builds
44
macos_config: &macos_config
55
macos:
6-
xcode: 14.0.0
7-
resource_class: macos.x86.medium.gen2
6+
xcode: 15.3.0
7+
resource_class: macos.m1.large.gen1
88
shell: /bin/bash --login -eo pipefail
99

1010
setup_env_file: &setup_env_file
@@ -53,6 +53,7 @@ jobs:
5353
- run:
5454
name: Install dependencies
5555
command: |
56+
corepack enable
5657
yarn install --cwd example
5758
yarn install --cwd example/e2e
5859
yarn install

README.md

Lines changed: 94 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ ___
2626
- [Push Notifications](#ios-push-notifications)
2727
- [Push notification deep links support](#ios-push-notification-deep-links-support)
2828
- [Expo](#expo)
29-
- [Limitations](#limitations)
29+
- [Push Notifications](#expo-push-notifications)
30+
- [Push notification deep links support](#expo-push-notification-deep-links-support)
31+
- [Android](#android-deep-link)
32+
- [iOS](#ios-deep-link)
3033
- [Common methods](#methods)
3134
- [Types](#types)
3235
- [Usage](#usage)
@@ -278,7 +281,16 @@ public class MainNotificationService extends FirebaseMessagingService {
278281

279282
```
280283

281-
See the [example app](https://github.com/intercom/intercom-react-native/blob/main/example/src/App.tsx) for an example of how to handle deep linking in your app.
284+
Add the following in your `MainActivity`
285+
286+
```kotlin
287+
override fun onNewIntent(intent: Intent) {
288+
super.onNewIntent(intent)
289+
setIntent(intent)
290+
}
291+
```
292+
293+
See the [example app](https://github.com/intercom/intercom-react-native/blob/main/sandboxes/NotificationsSandbox/App.tsx) for an example of how to handle deep linking in your app.
282294

283295
### IOS
284296

@@ -473,7 +485,7 @@ The plugin provides props for extra customization. Every time you change the pro
473485
}
474486
```
475487

476-
#### Push notifications
488+
#### Expo: Push notifications
477489

478490
Add the following configurations into your `app.json` or `app.config.js`:
479491

@@ -512,10 +524,85 @@ e.g. [react-native-permissions](https://github.com/zoontek/react-native-permissi
512524

513525
Next, rebuild your app as described in the ["Adding custom native code"](https://docs.expo.io/workflow/customizing/) guide.
514526

527+
#### Expo: Push notification deep links support
528+
529+
> **Note**: You can read more on Expo [documentation](https://docs.expo.dev/guides/deep-linking)
530+
531+
#### Android: Deep Link
532+
533+
```json
534+
{
535+
"expo": {
536+
"android": {
537+
"intentFilters": [
538+
{
539+
"action": "VIEW",
540+
"data": [
541+
{
542+
"host": "Your app scheme(app)"
543+
}
544+
],
545+
"category": ["BROWSABLE", "DEFAULT"]
546+
}
547+
]
548+
}
549+
}
550+
}
551+
```
552+
553+
#### Android: App Links
554+
555+
```json
556+
{
557+
"expo": {
558+
"android": {
559+
"intentFilters": [
560+
{
561+
"action": "VIEW",
562+
"autoVerify": true,
563+
"data": [
564+
{
565+
"scheme": "https",
566+
"host": "Your app url(www.app.com)",
567+
"pathPrefix": "Your url prefix e.g. /settings)"
568+
}
569+
],
570+
"category": ["BROWSABLE", "DEFAULT"]
571+
}
572+
]
573+
}
574+
}
575+
}
576+
```
577+
578+
#### iOS: Deep Link
515579

516-
#### Limitations
580+
```json
581+
{
582+
"expo": {
583+
"ios": {
584+
"infoPlist": {
585+
"LSApplicationQueriesSchemes": ["Your app scheme(app)"]
586+
}
587+
}
588+
}
589+
}
590+
```
591+
592+
#### iOS: Universal Link
593+
594+
```json
595+
{
596+
"expo": {
597+
"ios": {
598+
"infoPlist": {
599+
"IntercomUniversalLinkDomains": ["Your app url(www.app.com)"]
600+
}
601+
}
602+
}
603+
}
604+
```
517605

518-
- **No deep links support**: Deep Linking currently is not supported by this config plugin extension. This will be added in the future.
519606

520607

521608
## Methods
@@ -766,7 +853,7 @@ Fetch a list of all Collections.
766853
___
767854
### `Intercom.fetchHelpCenterCollection(collectionId)`
768855

769-
Get a list of sections/articles for a collection.
856+
Get a list of subcollections/articles for a collection.
770857

771858
### Options
772859

@@ -935,11 +1022,6 @@ type HelpCenterArticle = {
9351022
title: string;
9361023
};
9371024

938-
type HelpCenterSection = {
939-
name: string;
940-
articles: HelpCenterArticle;
941-
};
942-
9431025
type HelpCenterCollectionItem = {
9441026
id: string;
9451027
title: string;
@@ -951,7 +1033,7 @@ type HelpCenterCollectionContent = {
9511033
name: string;
9521034
summary: string;
9531035
articles: HelpCenterArticle[];
954-
sections: HelpCenterSection[];
1036+
collections: HelpCenterCollectionItem[];
9551037
};
9561038

9571039
type HelpCenterArticleSearchResult = {

android/build.gradle

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
1-
def packageJsonFile = file('../package.json')
2-
def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text)
3-
def packageVersion = '"' + packageJson.version + '"'
1+
def packageJsonFile = file('../package.json')
2+
def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text)
3+
def packageVersion = '"' + packageJson.version + '"'
44

55

66
buildscript {
7-
if (project == rootProject) {
8-
repositories {
9-
google()
10-
mavenCentral()
11-
}
7+
ext {
8+
buildToolsVersion = "34.0.0"
9+
minSdkVersion = 21
10+
compileSdkVersion = 34
11+
targetSdkVersion = 34
12+
ndkVersion = "25.1.8937393"
13+
kotlinVersion = "1.8.0"
14+
}
15+
if (project == rootProject) {
16+
repositories {
17+
google()
18+
mavenCentral()
19+
}
1220

13-
dependencies {
14-
classpath 'com.android.tools.build:gradle:3.5.3'
15-
}
21+
dependencies {
22+
classpath("com.android.tools.build:gradle")
23+
classpath("com.facebook.react:react-native-gradle-plugin")
24+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
1625
}
26+
}
1727
}
1828

1929
apply plugin: 'com.android.library'
2030

2131
def safeExtGet(prop, fallback) {
22-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
32+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
2333
}
2434

2535
android {
26-
// Compatibility for AGP v. <4.2/Gradle 8
27-
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
28-
if (agpVersion >= 7) {
29-
namespace 'com.intercom.reactnative'
30-
}
36+
namespace 'com.intercom.reactnative'
37+
compileSdk rootProject.ext.compileSdkVersion
38+
buildToolsVersion rootProject.ext.buildToolsVersion
3139

32-
compileSdkVersion safeExtGet('IntercomReactNative_compileSdkVersion', 34)
33-
defaultConfig {
34-
minSdkVersion safeExtGet('IntercomReactNative_minSdkVersion', 21)
35-
targetSdkVersion safeExtGet('IntercomReactNative_targetSdkVersion', 34)
36-
versionCode 1
37-
versionName "1.0"
38-
buildConfigField 'String', 'INTERCOM_VERSION_NAME', packageVersion
39-
}
40+
defaultConfig {
41+
minSdkVersion rootProject.ext.minSdkVersion
42+
targetSdkVersion rootProject.ext.targetSdkVersion
43+
versionCode 1
44+
versionName "1.0"
45+
buildConfigField 'String', 'INTERCOM_VERSION_NAME', packageVersion
46+
}
4047

41-
buildTypes {
42-
release {
43-
minifyEnabled false
44-
}
45-
}
46-
lintOptions {
47-
disable 'GradleCompatible'
48-
}
49-
50-
if (agpVersion < 8) {
51-
compileOptions {
52-
sourceCompatibility JavaVersion.VERSION_1_8
53-
targetCompatibility JavaVersion.VERSION_1_8
54-
}
48+
buildTypes {
49+
release {
50+
minifyEnabled false
5551
}
52+
}
53+
lintOptions {
54+
disable 'GradleCompatible'
55+
}
5656
}
5757

5858
repositories {
59-
mavenCentral()
60-
mavenLocal()
61-
maven {
62-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
63-
url("$rootDir/../node_modules/react-native/android")
64-
}
65-
google()
59+
mavenCentral()
60+
mavenLocal()
61+
maven {
62+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
63+
url("$rootDir/../node_modules/react-native/android")
64+
}
65+
google()
6666
}
6767

6868
dependencies {
69-
//noinspection GradleDynamicVersion
70-
implementation "com.facebook.react:react-native:+" // From node_modules
71-
implementation "com.google.firebase:firebase-messaging:${safeExtGet('firebaseMessagingVersion', '20.2.+')}"
72-
implementation 'io.intercom.android:intercom-sdk:15.8.+'
69+
//noinspection GradleDynamicVersion
70+
implementation "com.facebook.react:react-native:+" // From node_modules
71+
implementation "com.google.firebase:firebase-messaging:${safeExtGet('firebaseMessagingVersion', '20.2.+')}"
72+
implementation 'io.intercom.android:intercom-sdk:15.11.+'
7373
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1+
<manifest package="com.intercom.reactnative" xmlns:android="http://schemas.android.com/apk/res/android">
22

33
</manifest>

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

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import io.intercom.android.sdk.helpcenter.collections.HelpCenterCollection;
1515
import io.intercom.android.sdk.helpcenter.sections.HelpCenterArticle;
1616
import io.intercom.android.sdk.helpcenter.sections.HelpCenterCollectionContent;
17-
import io.intercom.android.sdk.helpcenter.sections.HelpCenterSection;
1817

1918
public class IntercomHelpCenterHelpers {
2019

@@ -59,38 +58,13 @@ public static WritableMap parseHelpCenterCollectionsContentToReadableMap(HelpCen
5958
WritableArray articles = parseArticlesToReadableArray(helpCenterCollectionContent.getHelpCenterArticles());
6059
helpCenterCollection.putArray("articles", articles);
6160

62-
WritableArray sections = parseHelpCenterSectionsToReadableArray(helpCenterCollectionContent.getHelpCenterSections());
63-
helpCenterCollection.putArray("sections", sections);
61+
WritableArray collections = parseHelpCenterCollectionsToReadableArray(helpCenterCollectionContent.getSubCollections());
62+
helpCenterCollection.putArray("collections", collections);
6463

6564

6665
return helpCenterCollection;
6766
}
6867

69-
public static WritableMap parseHelpCenterSectionToReadableMap(HelpCenterSection helpCenterSection) {
70-
WritableMap section = Arguments.createMap();
71-
section.putString("title", helpCenterSection.getTitle());
72-
73-
74-
WritableArray articles = parseArticlesToReadableArray(helpCenterSection.getHelpCenterArticles());
75-
section.putArray("articles", articles);
76-
77-
78-
return section;
79-
}
80-
81-
public static WritableArray parseHelpCenterSectionsToReadableArray(List<HelpCenterSection> helpCenterSectionList) {
82-
WritableArray sections = Arguments.createArray();
83-
84-
HelpCenterSection[] sectionsArray = new HelpCenterSection[helpCenterSectionList.size()];
85-
sectionsArray = helpCenterSectionList.toArray(sectionsArray);
86-
;
87-
88-
for (HelpCenterSection section : sectionsArray) {
89-
sections.pushMap(parseHelpCenterSectionToReadableMap(section));
90-
}
91-
return sections;
92-
}
93-
9468
public static WritableArray parseHelpCenterCollectionsToReadableArray(List<HelpCenterCollection> helpCenterCollections) {
9569
HelpCenterCollection[] collectionsArray = new HelpCenterCollection[helpCenterCollections.size()];
9670
collectionsArray = helpCenterCollections.toArray(collectionsArray);

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import com.facebook.react.bridge.ReadableMap;
77
import com.facebook.react.bridge.ReadableMapKeySetIterator;
88
import com.facebook.react.bridge.ReadableType;
9+
import com.facebook.react.bridge.Arguments;
10+
import com.facebook.react.bridge.WritableMap;
911

1012
import java.util.ArrayList;
1113
import java.util.Date;
@@ -16,6 +18,7 @@
1618
import io.intercom.android.sdk.Company;
1719
import io.intercom.android.sdk.Intercom;
1820
import io.intercom.android.sdk.UserAttributes;
21+
import io.intercom.android.sdk.identity.Registration;
1922

2023
public class IntercomHelpers {
2124

@@ -241,4 +244,15 @@ public static String getValueAsStringForKey(ReadableMap map, String key) {
241244
}
242245
return value;
243246
}
247+
248+
public static WritableMap deconstructRegistration(Registration registration) {
249+
WritableMap registrationMap = Arguments.createMap();
250+
if (registration.getEmail() != null) {
251+
registrationMap.putString("email", registration.getEmail());
252+
}
253+
if (registration.getUserId() != null) {
254+
registrationMap.putString("userId", registration.getUserId());
255+
}
256+
return registrationMap;
257+
}
244258
}

0 commit comments

Comments
 (0)