@trycourier/courier-react-native 6.0.1 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,192 +1,45 @@
|
|
|
1
1
|
<img width="1040" alt="banner-react-native" src="https://github.com/user-attachments/assets/c38f52d8-792f-4b51-a423-f1c5dd9f996b">
|
|
2
2
|
|
|
3
|
-
<!-- AUTO-GENERATED-OVERVIEW:START — Do not edit this section. It is synced from mintlify-docs. -->
|
|
4
3
|
# Courier React Native SDK
|
|
5
4
|
|
|
6
5
|
The Courier React Native SDK provides prebuilt components and TypeScript APIs for adding in-app notifications, push notifications, and notification preferences to your React Native app. It handles authentication, token management, and real-time message delivery across iOS and Android from a single codebase.
|
|
7
6
|
|
|
7
|
+
Requires iOS 15.0+, Android SDK 23+, and Gradle 8.4+.
|
|
8
|
+
|
|
8
9
|
## Installation
|
|
9
10
|
|
|
10
11
|
```bash
|
|
11
12
|
npm install @trycourier/courier-react-native
|
|
12
13
|
```
|
|
13
14
|
|
|
14
|
-
Also available via `yarn add @trycourier/courier-react-native`.
|
|
15
|
-
|
|
16
|
-
Requires iOS 15.0+, Android SDK 23+, and Gradle 8.4+. Run `cd ios && pod install` after installing.
|
|
15
|
+
Also available via `yarn add @trycourier/courier-react-native`. After installing, run `cd ios && pod install`.
|
|
17
16
|
|
|
18
17
|
## Quick Start
|
|
19
18
|
|
|
20
19
|
```jsx
|
|
21
|
-
import Courier, {
|
|
22
|
-
CourierInboxView,
|
|
23
|
-
CourierPreferencesView,
|
|
24
|
-
} from "@trycourier/courier-react-native";
|
|
20
|
+
import Courier, { CourierInboxView } from "@trycourier/courier-react-native";
|
|
25
21
|
|
|
26
|
-
// Sign in
|
|
22
|
+
// Sign in (JWT generated by your backend)
|
|
27
23
|
await Courier.shared.signIn({
|
|
28
24
|
userId: "user_123",
|
|
29
25
|
accessToken: jwt,
|
|
30
26
|
});
|
|
31
27
|
|
|
32
|
-
//
|
|
28
|
+
// Drop in a prebuilt Inbox view
|
|
33
29
|
<CourierInboxView
|
|
34
|
-
onClickInboxMessageAtIndex={(message
|
|
30
|
+
onClickInboxMessageAtIndex={(message) => {
|
|
35
31
|
message.read
|
|
36
32
|
? Courier.shared.unreadMessage({ messageId: message.messageId })
|
|
37
33
|
: Courier.shared.readMessage({ messageId: message.messageId });
|
|
38
34
|
}}
|
|
39
35
|
style={{ flex: 1 }}
|
|
40
36
|
/>
|
|
41
|
-
|
|
42
|
-
// Add a prebuilt Preferences component
|
|
43
|
-
<CourierPreferencesView
|
|
44
|
-
mode={{ type: "topic" }}
|
|
45
|
-
style={{ flex: 1 }}
|
|
46
|
-
/>
|
|
47
37
|
```
|
|
48
38
|
|
|
49
|
-
For Expo projects, see the [Expo setup guide](https://github.com/trycourier/courier-react-native/blob/master/Docs/6_Expo.md).
|
|
50
|
-
|
|
51
39
|
## Documentation
|
|
52
40
|
|
|
53
|
-
Full documentation
|
|
54
|
-
|
|
55
|
-
- [Inbox Overview](https://www.courier.com/docs/platform/inbox/inbox-overview/)
|
|
56
|
-
- [Authentication](https://www.courier.com/docs/platform/inbox/authentication/)
|
|
57
|
-
- [Push Integrations](https://www.courier.com/docs/external-integrations/push/intro-to-push/)
|
|
58
|
-
<!-- AUTO-GENERATED-OVERVIEW:END -->
|
|
59
|
-
|
|
60
|
-
 
|
|
61
|
-
|
|
62
|
-
# Getting Started
|
|
63
|
-
|
|
64
|
-
These are all the available features of the SDK.
|
|
65
|
-
|
|
66
|
-
<table>
|
|
67
|
-
<thead>
|
|
68
|
-
<tr>
|
|
69
|
-
<th width="25px"></th>
|
|
70
|
-
<th width="250px" align="left">Feature</th>
|
|
71
|
-
<th width="725px" align="left">Description</th>
|
|
72
|
-
</tr>
|
|
73
|
-
</thead>
|
|
74
|
-
<tbody>
|
|
75
|
-
<tr width="600px">
|
|
76
|
-
<td align="center">
|
|
77
|
-
1
|
|
78
|
-
</td>
|
|
79
|
-
<td align="left">
|
|
80
|
-
<a href="https://www.courier.com/docs/sdk-libraries/react-native/#authentication">
|
|
81
|
-
<code>Authentication</code>
|
|
82
|
-
</a>
|
|
83
|
-
</td>
|
|
84
|
-
<td align="left">
|
|
85
|
-
Manages user credentials between app sessions. Required if you would like to use <a href="https://www.courier.com/docs/sdk-libraries/react-native/#inbox"><code>Courier Inbox</code></a> and <a href="https://www.courier.com/docs/sdk-libraries/react-native/#push-notifications"><code>Push Notifications</code></a>.
|
|
86
|
-
</td>
|
|
87
|
-
</tr>
|
|
88
|
-
<tr width="600px">
|
|
89
|
-
<td align="center">
|
|
90
|
-
2
|
|
91
|
-
</td>
|
|
92
|
-
<td align="left">
|
|
93
|
-
<a href="https://www.courier.com/docs/sdk-libraries/react-native/#inbox">
|
|
94
|
-
<code>Inbox</code>
|
|
95
|
-
</a>
|
|
96
|
-
</td>
|
|
97
|
-
<td align="left">
|
|
98
|
-
An in-app notification center you can use to notify your users. Comes with a prebuilt UI and also supports fully custom UIs.
|
|
99
|
-
</td>
|
|
100
|
-
</tr>
|
|
101
|
-
<tr width="600px">
|
|
102
|
-
<td align="center">
|
|
103
|
-
3
|
|
104
|
-
</td>
|
|
105
|
-
<td align="left">
|
|
106
|
-
<a href="https://www.courier.com/docs/sdk-libraries/react-native/#push-notifications">
|
|
107
|
-
<code>Push Notifications</code>
|
|
108
|
-
</a>
|
|
109
|
-
</td>
|
|
110
|
-
<td align="left">
|
|
111
|
-
Automatically manages push notification device tokens and gives convenient functions for handling push notification receiving and clicking.
|
|
112
|
-
</td>
|
|
113
|
-
</tr>
|
|
114
|
-
<tr width="600px">
|
|
115
|
-
<td align="center">
|
|
116
|
-
4
|
|
117
|
-
</td>
|
|
118
|
-
<td align="left">
|
|
119
|
-
<a href="https://www.courier.com/docs/sdk-libraries/react-native/#preferences">
|
|
120
|
-
<code>Preferences</code>
|
|
121
|
-
</a>
|
|
122
|
-
</td>
|
|
123
|
-
<td align="left">
|
|
124
|
-
Allow users to update which types of notifications they would like to receive.
|
|
125
|
-
</td>
|
|
126
|
-
</tr>
|
|
127
|
-
<tr width="600px">
|
|
128
|
-
<td align="center">
|
|
129
|
-
5
|
|
130
|
-
</td>
|
|
131
|
-
<td align="left">
|
|
132
|
-
<a href="https://www.courier.com/docs/sdk-libraries/react-native/#courierclient">
|
|
133
|
-
<code>CourierClient</code>
|
|
134
|
-
</a>
|
|
135
|
-
</td>
|
|
136
|
-
<td align="left">
|
|
137
|
-
The base level API wrapper around the Courier endpoints. Useful if you have a highly customized user experience or codebase requirements.
|
|
138
|
-
</td>
|
|
139
|
-
</tr>
|
|
140
|
-
</tbody>
|
|
141
|
-
</table>
|
|
142
|
-
|
|
143
|
-
 
|
|
144
|
-
|
|
145
|
-
# Expo
|
|
146
|
-
|
|
147
|
-
If you are using Expo, you should check out the [Expo Docs](https://www.courier.com/docs/sdk-libraries/react-native/#expo) for all the details.
|
|
41
|
+
Full documentation lives at **[courier.com/docs/sdk-libraries/react-native](https://www.courier.com/docs/sdk-libraries/react-native)** — installation, authentication, push setup (iOS `CourierReactNativeDelegate` + Android Firebase decoupling), theming, custom UI, Expo, and the `CourierClient` API reference.
|
|
148
42
|
|
|
149
|
-
|
|
43
|
+
## Feedback
|
|
150
44
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
Starter projects using this SDK.
|
|
154
|
-
|
|
155
|
-
<table>
|
|
156
|
-
<thead>
|
|
157
|
-
<tr>
|
|
158
|
-
<th width="1000px" align="left">Project Link</th>
|
|
159
|
-
</tr>
|
|
160
|
-
</thead>
|
|
161
|
-
<tbody>
|
|
162
|
-
<tr width="1000px">
|
|
163
|
-
<td align="left">
|
|
164
|
-
<a href="https://github.com/trycourier/courier-react-native/tree/master/example-085">
|
|
165
|
-
<code>Example (React Native 0.85+, New Architecture)</code>
|
|
166
|
-
</a>
|
|
167
|
-
</td>
|
|
168
|
-
</tr>
|
|
169
|
-
</tbody>
|
|
170
|
-
</table>
|
|
171
|
-
|
|
172
|
-
 
|
|
173
|
-
|
|
174
|
-
# **Share feedback with Courier**
|
|
175
|
-
|
|
176
|
-
We want to make this the best SDK for managing notifications! Have an idea or feedback about our SDKs? Let us know!
|
|
177
|
-
|
|
178
|
-
[Courier React Native Issues](https://github.com/trycourier/courier-react-native/issues)
|
|
179
|
-
|
|
180
|
-
## EU endpoints
|
|
181
|
-
|
|
182
|
-
If your workspace uses EU-hosted Courier endpoints, pass the built-in EU preset through `apiUrls`.
|
|
183
|
-
|
|
184
|
-
```tsx
|
|
185
|
-
import Courier, { getCourierApiUrlsForRegion } from "@trycourier/courier-react-native";
|
|
186
|
-
|
|
187
|
-
await Courier.shared.signIn({
|
|
188
|
-
userId: "your_user_id",
|
|
189
|
-
accessToken: jwt,
|
|
190
|
-
apiUrls: getCourierApiUrlsForRegion("eu")
|
|
191
|
-
});
|
|
192
|
-
```
|
|
45
|
+
Found a bug or want to request a feature? [Open an issue](https://github.com/trycourier/courier-react-native/issues).
|
package/android/build.gradle
CHANGED
|
@@ -111,7 +111,7 @@ dependencies {
|
|
|
111
111
|
implementation 'com.google.code.gson:gson:2.11.0'
|
|
112
112
|
|
|
113
113
|
// Courier Core SDK
|
|
114
|
-
api 'com.github.trycourier:courier-android:6.0
|
|
114
|
+
api 'com.github.trycourier:courier-android:6.1.0'
|
|
115
115
|
api 'androidx.recyclerview:recyclerview:1.3.2'
|
|
116
116
|
|
|
117
117
|
// Firebase Messaging (needed to resolve RemoteMessage from Courier SDK APIs)
|
|
@@ -15,7 +15,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
|
15
15
|
import com.google.gson.GsonBuilder
|
|
16
16
|
|
|
17
17
|
internal object Utils {
|
|
18
|
-
val COURIER_AGENT = CourierAgent.ReactNativeAndroid(version = "6.0.
|
|
18
|
+
val COURIER_AGENT = CourierAgent.ReactNativeAndroid(version = "6.0.3")
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
internal fun ReactContext.sendEvent(eventName: String, value: Any?) {
|
|
@@ -33,7 +33,7 @@ static NSString *const CourierForegroundOptionsDidChangeNotification = @"iosFore
|
|
|
33
33
|
if (self) {
|
|
34
34
|
|
|
35
35
|
// Set the user agent
|
|
36
|
-
Courier.agent = [CourierAgent reactNativeIOS:@"6.0.
|
|
36
|
+
Courier.agent = [CourierAgent reactNativeIOS:@"6.0.3"];
|
|
37
37
|
|
|
38
38
|
// Register for remote notifications
|
|
39
39
|
UIApplication *app = [UIApplication sharedApplication];
|
|
@@ -14,7 +14,7 @@ internal class CourierReactNativeEventEmitter: RCTEventEmitter {
|
|
|
14
14
|
|
|
15
15
|
// Set the user agent
|
|
16
16
|
// Used to know the platform performing requests
|
|
17
|
-
Courier.agent = CourierAgent.reactNativeIOS("6.0.
|
|
17
|
+
Courier.agent = CourierAgent.reactNativeIOS("6.0.3")
|
|
18
18
|
|
|
19
19
|
}
|
|
20
20
|
|