Skip to content

Commit 1c2c375

Browse files
authored
Merge branch 'main' into task/update-types
2 parents e529ab2 + 8dacc4f commit 1c2c375

39 files changed

+1198
-38034
lines changed

.circleci/config.yml

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

@@ -20,7 +20,8 @@ executors:
2020
working_directory: ~/project
2121

2222
orbs:
23-
android: circleci/[email protected]
23+
android: circleci/[email protected]
24+
node: circleci/[email protected]
2425

2526
# Always run job
2627
run_always: &run_always
@@ -54,18 +55,14 @@ jobs:
5455
name: Install dependencies
5556
command: |
5657
corepack enable
57-
yarn install --cwd example
58-
yarn install --cwd example/e2e
59-
yarn install
58+
yarn install --cwd example --ignore-engines
59+
yarn install --ignore-engines
6060
- save_cache:
6161
key: dependencies-{{ checksum "package.json" }}
6262
paths: node_modules
6363
- save_cache:
6464
key: dependencies-example-{{ checksum "example/package.json" }}
6565
paths: example/node_modules
66-
- save_cache:
67-
key: dependencies-example-e2e-{{ checksum "example/package.json" }}
68-
paths: example/e2e/node_modules
6966
- persist_to_workspace:
7067
root: .
7168
paths: .
@@ -115,18 +112,25 @@ jobs:
115112
JAVA_OPTS: '-Xms512m -Xmx1024m'
116113
executor:
117114
name: android/android-machine
115+
tag: default
118116
working_directory: ~/project
119117
steps:
120118
- checkout:
121119
path: ~/project
120+
- node/install:
121+
node-version: 18.17.0
122122

123123
- attach_workspace:
124124
at: ~/project
125125

126126
- <<: *setup_env_file
127127

128128
- run:
129-
working_directory: example/e2e
129+
name: Install Maestro
130+
command: curl -Ls "https://get.maestro.mobile.dev" | bash
131+
132+
- run:
133+
working_directory: example/test
130134
name: Build android
131135
command: npm run build:android
132136

@@ -141,10 +145,19 @@ jobs:
141145
post-emulator-launch-assemble-command: echo Emulator Started
142146

143147
- run:
144-
working_directory: example/e2e
148+
name: Install app on emulator
149+
command: |
150+
adb install -r ~/project/example/android/app/build/outputs/apk/release/app-release.apk
151+
152+
- run:
153+
working_directory: example/test
145154
name: Run UI Tests
146155
command: npm run test:android
147156

157+
- store_artifacts:
158+
path: ~/.maestro/tests
159+
destination: maestro-tests
160+
148161
# Build the Test App used for UI Testing and save is to the workspace. This allows it to be used by other jobs.
149162
ios-e2e-test:
150163
<<: *macos_config
@@ -155,28 +168,49 @@ jobs:
155168

156169
- <<: *setup_env_file
157170

171+
- run:
172+
working_directory: example/e2e
173+
name: Install Maestro
174+
command: curl -Ls "https://get.maestro.mobile.dev" | bash
175+
158176
- restore_cache:
159177
keys:
160178
- pod-dependencies-{{ checksum "~/project/example/ios/Podfile" }}
161179
- run:
162180
working_directory: example/ios
163181
name: Install Pods
164182
command: pod install
183+
165184
- save_cache:
166185
key: pod-dependencies-{{ checksum "~/project/example/ios/Podfile" }}
167186
paths:
168187
- ~/project/example/ios/Pods
169188

170189
- run:
171-
working_directory: example/e2e
190+
working_directory: example/test
172191
name: Build
173192
command: npm run build:ios
174193

175194
- run:
176-
working_directory: example/e2e
195+
name: Create and boot iPhone 15 simulator
196+
command: |
197+
echo "Creating iPhone 15 simulator with runtime $RUNTIME"
198+
xcrun simctl create "iPhone 15" com.apple.CoreSimulator.SimDeviceType.iPhone-15 $RUNTIME
199+
xcrun simctl boot "iPhone 15" || true
200+
201+
- run:
202+
name: Install app on simulator
203+
command: |
204+
xcrun simctl install booted ~/project/example/test/build/Build/Products/Release-iphonesimulator/IntercomReactNativeExampleUI.app
205+
206+
- run:
207+
working_directory: example/test
177208
name: Run UI Tests
178209
command: npm run test:ios
179210

211+
- store_artifacts:
212+
path: ~/.maestro/tests
213+
destination: maestro-tests
180214

181215
release-to-npm:
182216
executor: default
@@ -195,7 +229,7 @@ jobs:
195229
- run:
196230
name: Install dependencies
197231
command: |
198-
yarn install
232+
yarn install --ignore-engines
199233
200234
- run:
201235
name: Publish the package
@@ -224,6 +258,7 @@ workflows:
224258
<<: *run_always
225259
requires:
226260
- install-dependencies
261+
# Temporarily disabled Maestro e2e tests
227262
# - android-e2e-test:
228263
# <<: *run_always
229264
# requires:
@@ -240,6 +275,7 @@ workflows:
240275
# - typescript
241276
# - unit-tests
242277
# - build-package
278+
243279
- release-to-npm:
244280
<<: *run_on_release
245281
context:
@@ -250,5 +286,6 @@ workflows:
250286
- typescript
251287
- unit-tests
252288
- build-package
289+
# Temporarily removed e2e test dependencies
253290
# - ios-e2e-test
254291
# - android-e2e-test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ node_modules/
4646
npm-debug.log
4747
yarn-debug.log
4848
yarn-error.log
49+
yarn.lock
50+
package-lock.json
4951

5052
# BUCK
5153
buck-out/

.refactorer/config.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Checks
2+
3+
### yarn lint
4+
5+
`yarn lint` failed with the following output:
6+
7+
<output>
8+
{output}
9+
</output>
10+
11+
Your task is to understand and fix all linting errors. Do run `yarn lint` again when you're done to be sure that everything is fixed.

README.md

Lines changed: 70 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -173,31 +173,61 @@ apply from: file("../../node_modules/@react-native-community/cli-platform-androi
173173
- Create `MainNotificationService.java` inside your app directory(`com.example.app`) with below content:
174174

175175
***Remember to replace `package com.example.app;`, with your app package name***
176+
- Default Notification Behavior (Goes back to the parent default launcher activity when the user taps the notification):
176177

177-
```java
178-
package com.example.app;
178+
```java
179+
package com.example.app;
179180

180-
import com.google.firebase.messaging.FirebaseMessagingService;
181-
import com.google.firebase.messaging.RemoteMessage;
182-
import com.intercom.reactnative.IntercomModule;
181+
import com.google.firebase.messaging.FirebaseMessagingService;
182+
import com.google.firebase.messaging.RemoteMessage;
183+
import com.intercom.reactnative.IntercomModule;
183184

184-
public class MainNotificationService extends FirebaseMessagingService {
185+
public class MainNotificationService extends FirebaseMessagingService {
185186

186-
@Override
187-
public void onNewToken(String refreshedToken) {
188-
IntercomModule.sendTokenToIntercom(getApplication(), refreshedToken);
189-
//DO LOGIC HERE
190-
}
187+
@Override
188+
public void onNewToken(String refreshedToken) {
189+
IntercomModule.sendTokenToIntercom(getApplication(), refreshedToken);
190+
//DO LOGIC HERE
191+
}
191192

192-
public void onMessageReceived(RemoteMessage remoteMessage) {
193-
if (IntercomModule.isIntercomPush(remoteMessage)) {
194-
IntercomModule.handleRemotePushMessage(getApplication(), remoteMessage);
195-
} else {
196-
// HANDLE NON-INTERCOM MESSAGE
193+
public void onMessageReceived(RemoteMessage remoteMessage) {
194+
if (IntercomModule.isIntercomPush(remoteMessage)) {
195+
IntercomModule.handleRemotePushMessage(getApplication(), remoteMessage);
196+
} else {
197+
// HANDLE NON-INTERCOM MESSAGE
198+
}
199+
}
197200
}
198-
}
199-
}
200-
```
201+
```
202+
203+
- Custom Stack:
204+
205+
```java
206+
package com.example.app;
207+
208+
import com.google.firebase.messaging.FirebaseMessagingService;
209+
import com.google.firebase.messaging.RemoteMessage;
210+
import com.intercom.reactnative.IntercomModule;
211+
212+
public class MainNotificationService extends FirebaseMessagingService {
213+
214+
@Override
215+
public void onNewToken(String refreshedToken) {
216+
IntercomModule.sendTokenToIntercom(getApplication(), refreshedToken);
217+
//DO LOGIC HERE
218+
}
219+
220+
public void onMessageReceived(RemoteMessage remoteMessage) {
221+
if (IntercomModule.isIntercomPush(remoteMessage)) {
222+
TaskStackBuilder customStack = TaskStackBuilder.create(getApplication());
223+
customStack.addNextIntent(new Intent(getApplication(), MainActivity.class)); // Replace with your custom activity
224+
IntercomModule.handleRemotePushWithCustomStack(getApplication(), remoteMessage, customStack);
225+
} else {
226+
// HANDLE NON-INTERCOM MESSAGE
227+
}
228+
}
229+
}
230+
```
201231

202232
- Edit `AndroidManifest.xml`. Add below content inside `<application>` below `<activity/>`
203233

@@ -222,10 +252,6 @@ public class MainNotificationService extends FirebaseMessagingService {
222252
</intent-filter>
223253
</service>
224254

225-
<receiver
226-
android:name="com.intercom.reactnative.RNIntercomPushBroadcastReceiver"
227-
tools:replace="android:exported"
228-
android:exported="true"/>
229255
<!-- END: Add this-->
230256

231257
</application>
@@ -1092,6 +1118,27 @@ ___
10921118
10931119
___
10941120
1121+
### `Intercom.setUserJwt(JWT)`
1122+
1123+
Sets a JWT token for the user, necessary for using the Messenger when Messenger Security is enforced. This is an
1124+
improvement to Identity Verification.
1125+
1126+
Secure your Messenger to make sure that bad actors can't impersonate your users, see their conversation history or make
1127+
unauthorized updates to data.
1128+
1129+
This should be called before any user login takes place.
1130+
1131+
### Options
1132+
1133+
| Type | Type | Required |
1134+
|------|--------|----------|
1135+
| JWT | string | yes |
1136+
1137+
### Returns
1138+
1139+
`Promise<boolean>`
1140+
___
1141+
10951142
## Author
10961143
10971144
👤 **Intercom (https://www.intercom.com/)**

0 commit comments

Comments
 (0)