Skip to content

Commit ac5326f

Browse files
authored
Merge branch 'main' into patch-1
2 parents 2afdd95 + 8f0da34 commit ac5326f

File tree

15 files changed

+266
-1817
lines changed

15 files changed

+266
-1817
lines changed

.circleci/config.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,26 @@ setup_env_file: &setup_env_file
1616
executors:
1717
default:
1818
docker:
19-
- image: circleci/node:12
19+
- image: circleci/node:14
2020
working_directory: ~/project
2121

2222
orbs:
2323
android: circleci/[email protected]
2424

25-
run_on_master: &run_on_master
25+
# Always run job
26+
run_always: &run_always
2627
filters:
28+
tags:
29+
only: /.*/
30+
31+
# Only run on release
32+
run_on_release: &run_on_release
33+
filters:
34+
tags:
35+
only: /.*/
2736
branches:
28-
only: main
37+
ignore: /.*/
38+
2939

3040
commands:
3141
attach_project:
@@ -220,42 +230,50 @@ jobs:
220230
yarn install
221231
222232
- run:
223-
name: Release package
224-
command: npm run release --ci
233+
name: Publish the package
234+
command: npm publish
225235

226236

227237
workflows:
238+
version: 2.1
228239
build-and-test:
229240
jobs:
230-
- install-dependencies
241+
- install-dependencies:
242+
<<: *run_always
231243
- lint:
244+
<<: *run_always
232245
requires:
233246
- install-dependencies
234247
- typescript:
248+
<<: *run_always
235249
requires:
236250
- install-dependencies
237251
- unit-tests:
252+
<<: *run_always
238253
requires:
239254
- install-dependencies
240255
- build-package:
256+
<<: *run_always
241257
requires:
242258
- install-dependencies
243259
- android-e2e-test:
260+
<<: *run_always
244261
requires:
245262
- install-dependencies
246263
- lint
247264
- typescript
248265
- unit-tests
249266
- build-package
250267
- ios-e2e-test:
268+
<<: *run_always
251269
requires:
252270
- install-dependencies
253271
- lint
254272
- typescript
255273
- unit-tests
256274
- build-package
257275
- release-to-npm:
258-
<<: *run_on_master
276+
<<: *run_on_release
259277
context:
260278
- react-native-context
261279
requires:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# More information on this workflow can be found here: https://stackoverflow.com/c/intercom/questions/1270
2+
3+
name: FOSSA License Scan
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
fossa:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
- name: Attempt build
17+
uses: intercom/attempt-build-action@main
18+
continue-on-error: true
19+
- name: Run FOSSA
20+
uses: intercom/fossa-action@main
21+
with:
22+
fossa-api-key: ${{ secrets.FOSSA_API_KEY }}
23+
fossa-event-receiver-token: ${{ secrets.FOSSA_EVENT_RECEIVER_TOKEN }}
24+
datadog-api-key: ${{ secrets.DATADOG_API_KEY }}

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ implementation project(':intercom-react-native')
6969

7070
#### Android: Setup
7171

72-
- Add below lines to `MainApplication.java` inside `onCreate` method, replacing `apiKey` and `appId` which can be found in your [workspace settings](https://app.intercom.com/a/apps/_/settings/android).
72+
- Add below lines to `android/app/src/main/java/com/YOUR_APP/app/MainApplication.java` inside `onCreate` method, replacing `apiKey` and `appId` which can be found in your [workspace settings](https://app.intercom.com/a/apps/_/settings/android).
7373

7474
```java
7575
import com.intercom.reactnative.IntercomModule; // <-- Add this line
@@ -89,16 +89,16 @@ public void onCreate() {
8989
}
9090
```
9191

92-
- Open `android/build.gradle` and change `minSdkVersion` to **21**
92+
- Open `android/build.gradle` and change `minSdkVersion` to **21**, `compileSdkVersion` and `targetSdkVersion` to at least **31**
9393

9494
```Gradle
9595
buildscript {
9696
// ...
9797
ext {
9898
buildToolsVersion = "29.0.2"
9999
minSdkVersion = 21 // <-- Here
100-
compileSdkVersion = 29
101-
targetSdkVersion = 29
100+
compileSdkVersion = 31 // <-- Here
101+
targetSdkVersion = 31 // <-- Here
102102
}
103103
// ...
104104
}
@@ -115,7 +115,7 @@ dependencies {
115115

116116
#### Android: Permissions
117117

118-
You will need to include the [READ\_EXTERNAL\_STORAGE](http://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE) permission if you have enabled attachments:
118+
You will need to include the [READ\_EXTERNAL\_STORAGE](http://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE) permission in `android/app/src/main/AndroidManifest.xml` if you have enabled attachments:
119119

120120
```xml
121121
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
@@ -177,6 +177,12 @@ import com.intercom.reactnative.IntercomModule;
177177

178178
public class MainNotificationService extends FirebaseMessagingService {
179179

180+
@Override
181+
public void onNewToken(String refreshedToken) {
182+
IntercomModule.sendTokenToIntercom(getApplication(), refreshedToken);
183+
//DO LOGIC HERE
184+
}
185+
180186
public void onMessageReceived(RemoteMessage remoteMessage) {
181187
if (IntercomModule.isIntercomPush(remoteMessage)) {
182188
IntercomModule.handleRemotePushMessage(getApplication(), remoteMessage);
@@ -347,7 +353,7 @@ Notifications.events().registerRemoteNotificationsRegistered(({ deviceToken }: R
347353
#import <UserNotifications/UserNotifications.h>
348354
```
349355

350-
- Request notification permissions when app launches by adding the folloowing to `didFinishLaunchingWithOptions` before `return YES;`:
356+
- Request notification permissions when app launches by adding the following to `didFinishLaunchingWithOptions` before `return YES;`:
351357

352358
```Objective-C
353359
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@@ -897,6 +903,14 @@ ___
897903
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha03'
898904
```
899905
906+
907+
- #### When tests with Jest fail mentioning "Cannot read property 'UNREAD_CHANGE_NOTIFICATION' of undefined"
908+
- Make a `jest.mock` function with the library:
909+
```
910+
// jest/setup.ts
911+
jest.mock('@intercom/intercom-react-native', () => jest.fn());
912+
```
913+
900914
___
901915
902916
## Author

android/build.gradle

Lines changed: 3 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', 30)
26+
compileSdkVersion safeExtGet('IntercomReactNative_compileSdkVersion', 31)
2727
defaultConfig {
2828
minSdkVersion safeExtGet('IntercomReactNative_minSdkVersion', 21)
29-
targetSdkVersion safeExtGet('IntercomReactNative_targetSdkVersion', 30)
29+
targetSdkVersion safeExtGet('IntercomReactNative_targetSdkVersion', 31)
3030
versionCode 1
3131
versionName "1.0"
3232
buildConfigField 'String', 'INTERCOM_VERSION_NAME', packageVersion
@@ -60,5 +60,5 @@ 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:10.3.+'
63+
implementation 'io.intercom.android:intercom-sdk:12.2.1'
6464
}

example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<activity
1515
android:name=".MainActivity"
1616
android:label="@string/app_name"
17+
android:exported="true"
1718
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
1819
android:launchMode="singleTask"
1920
android:windowSoftInputMode="adjustResize">

example/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ buildscript {
77
ext {
88
buildToolsVersion = "30.0.2"
99
minSdkVersion = 21
10-
compileSdkVersion = 30
11-
targetSdkVersion = 30
10+
compileSdkVersion = 31
11+
targetSdkVersion = 31
1212
ndkVersion = "20.1.5948944"
1313
}
1414
repositories {

example/e2e/helpers.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,17 @@ const closeOverlay = async (customCloseButtonId?: string) => {
4545
await closeButton.waitForDisplayed({ timeout: 22000 });
4646
await closeButton.click();
4747
};
48+
49+
const closeModalOverlay = async (customCloseButtonId?: string) => {
50+
const buttonId = browser.isAndroid ? `~Close` : customCloseButtonId || `~intercom modal close button`;
51+
52+
const closeButton = await $(buttonId);
53+
await closeButton.waitForDisplayed({ timeout: 22000 });
54+
await closeButton.click();
55+
};
56+
4857
browser.addCommand('closeOverlay', closeOverlay);
58+
browser.addCommand('closeModalOverlay', closeModalOverlay);
4959

5060
const closeArticleOverlay = async () => {
5161
if (browser.isAndroid) {
@@ -55,7 +65,7 @@ const closeArticleOverlay = async () => {
5565
await closeButton.waitForDisplayed({ timeout: 22000 });
5666
await closeButton.click();
5767
} else {
58-
await closeOverlay();
68+
await closeModalOverlay();
5969
}
6070
};
6171
browser.addCommand('closeArticleOverlay', closeArticleOverlay);

example/e2e/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
"@wdio/cli": "^7.7.2",
1717
"appium": "^1.21.0",
1818
"chai": "^4.3.4",
19+
"webdriver": "^7.16.13",
1920
"webdriverio": "^7.7.2"
2021
},
2122
"devDependencies": {
22-
"@wdio/appium-service": "^7.7.3",
23+
"@wdio/appium-service": "^7.16.13",
2324
"@wdio/local-runner": "^7.7.3",
2425
"@wdio/mocha-framework": "^7.7.3",
2526
"@wdio/spec-reporter": "^7.7.3",

example/e2e/tests/mainIntercom.e2e.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('Intercom E2E', () => {
7070
it('Should display carousel', async () => {
7171
await driver.scrollToElementByAccessibilityLabel('display-carousel');
7272
await (await $('~display-carousel')).click();
73-
await driver.closeOverlay();
73+
await driver.closeModalOverlay();
7474
});
7575

7676
it('Should get unread messages count', async () => {
@@ -135,9 +135,9 @@ describe('Intercom E2E', () => {
135135
await (await $('~authenticated')).waitForDisplayed({ timeout: 12000 });
136136
});
137137

138-
it('Should set logout ', async () => {
138+
/* it('Should set logout ', async () => {
139139
await driver.scrollToElementByAccessibilityLabel('logout');
140140
await (await $('~logout')).click();
141141
await (await $('~unauthenticated')).waitForDisplayed({ timeout: 12000 });
142-
});
142+
}); */
143143
});

0 commit comments

Comments
 (0)