Skip to content

Commit 8b013fc

Browse files
authored
Merge branch 'main' into uv/refactor_example_app
2 parents 5f91681 + fdd72b3 commit 8b013fc

File tree

5 files changed

+60
-15
lines changed

5 files changed

+60
-15
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,16 @@ public void loginUserWithUserAttributes(ReadableMap params, Promise promise) {
136136
Boolean hasEmail = params.hasKey("email") && IntercomHelpers.getValueAsStringForKey(params, "email").length() > 0;
137137
Boolean hasUserId = params.hasKey("userId") && IntercomHelpers.getValueAsStringForKey(params, "userId").length() > 0;
138138
Registration registration = null;
139-
String userId = IntercomHelpers.getValueAsStringForKey(params, "userId");
140-
if (hasEmail) {
139+
if (hasEmail && hasUserId) {
141140
String email = IntercomHelpers.getValueAsStringForKey(params, "email");
142-
if (hasUserId) {
143-
registration = new Registration().withEmail(email).withUserId(userId);
144-
} else {
145-
registration = Registration.create().withEmail(email);
146-
}
141+
String userId = IntercomHelpers.getValueAsStringForKey(params, "userId");
142+
registration = new Registration().withEmail(email).withUserId(userId);
143+
} else if (hasEmail) {
144+
String email = IntercomHelpers.getValueAsStringForKey(params, "email");
145+
registration = new Registration().withEmail(email);
147146
} else if (hasUserId) {
148-
registration = Registration.create().withUserId(userId);
147+
String userId = IntercomHelpers.getValueAsStringForKey(params, "userId");
148+
registration = new Registration().withUserId(userId);
149149
} else {
150150
Log.e(NAME, "loginUserWithUserAttributes called with invalid userId or email");
151151
Log.e(NAME, "You must provide userId or email");

example/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Welcome to @intercom/intercom-react-native example app 👋
2+
3+
## Installation
4+
5+
To get started with the @intercom/intercom-react-native example app, please follow the instructions below:
6+
7+
1. Generate a new .env file by running the following command in your terminal:
8+
```sh
9+
sh scripts/generateEnv.sh
10+
```
11+
12+
This command will create a .env file inside the example directory.
13+
14+
1. Fill in the required Android and iOS API keys and workspace IDs in the .env file. Other variables are optional.
15+
16+
2. Install the dependencies by running the following command in the project directory:
17+
18+
```sh
19+
yarn
20+
```
21+
22+
### Android
23+
24+
To run the app on Android, execute the following command:
25+
26+
27+
```sh
28+
yarn example android --variant=fossDebug
29+
```
30+
31+
### iOS
32+
For iOS, you need to install the necessary pods. Go to the example/ios directory in your terminal and run:
33+
34+
```sh
35+
pod install
36+
```
37+
38+
Once the pods are installed, go back to the project's root directory and execute the following command to run the app on iOS:
39+
40+
```sh
41+
yarn example ios
42+
```
43+
44+
### Notes:
45+
Please note that there is a known bug that prevents the iOS app from building on the latest Xcode. Therefore, it's recommended to use Xcode 14.2.

example/ios/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ PODS:
7373
- FlipperKit/FlipperKitNetworkPlugin
7474
- fmt (6.2.1)
7575
- glog (0.3.5)
76-
- Intercom (15.0.0)
77-
- intercom-react-native (5.0.0):
78-
- Intercom (~> 15.0.0)
76+
- Intercom (15.0.2)
77+
- intercom-react-native (5.1.2):
78+
- Intercom (~> 15.0.2)
7979
- React-Core
8080
- libevent (2.1.12)
8181
- OpenSSL-Universal (1.1.1100)
@@ -533,8 +533,8 @@ SPEC CHECKSUMS:
533533
FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86
534534
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
535535
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
536-
Intercom: c4d9286eb12277dd104e7a49aead819337772716
537-
intercom-react-native: 83a85583016a294827177465301795ec46e5a310
536+
Intercom: bb499c2bdeacaabb498c94572afa5fcfd74294eb
537+
intercom-react-native: 00d89b6267abc4470949a071bfac4550fbeb6deb
538538
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
539539
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
540540
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda

intercom-react-native.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ Pod::Spec.new do |s|
1717
s.resource_bundles = { 'IntercomFramework' => ['ios/assets/*'] }
1818

1919
s.dependency "React-Core"
20-
s.dependency "Intercom", '~> 15.0.0'
20+
s.dependency "Intercom", '~> 15.0.2'
2121
end

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@intercom/intercom-react-native",
3-
"version": "5.1.1",
3+
"version": "5.1.2",
44
"description": "React Native wrapper to bridge our iOS and Android SDK",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

0 commit comments

Comments
 (0)