@trycourier/courier-react-native 4.0.4 → 4.1.0
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 +14 -3
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/courierreactnative/CourierReactNativeActivity.kt +4 -0
- package/android/src/main/java/com/courierreactnative/CourierSharedModule.kt +0 -9
- package/android/src/main/java/com/courierreactnative/ReactNativeModule.kt +1 -1
- package/courier-react-native.podspec +1 -1
- package/ios/CourierReactNativeDelegate.m +3 -0
- package/ios/CourierReactNativeEventEmitter.swift +2 -2
- package/ios/CourierSharedModule.swift +1 -14
- package/ios/CourierSystemModule.swift +1 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
<img width="1040" alt="banner-react-native" src="https://github.com/
|
|
1
|
+
<img width="1040" alt="banner-react-native" src="https://github.com/user-attachments/assets/c38f52d8-792f-4b51-a423-f1c5dd9f996b">
|
|
2
2
|
|
|
3
3
|
 
|
|
4
4
|
|
|
5
5
|
# Requirements & Support
|
|
6
6
|
|
|
7
|
-
 
|
|
8
|
-
|
|
9
7
|
<table>
|
|
10
8
|
<thead>
|
|
11
9
|
<tr>
|
|
@@ -199,6 +197,19 @@ These are all the available features of the SDK.
|
|
|
199
197
|
Allow users to update which types of notifications they would like to receive.
|
|
200
198
|
</td>
|
|
201
199
|
</tr>
|
|
200
|
+
<tr width="600px">
|
|
201
|
+
<td align="center">
|
|
202
|
+
5
|
|
203
|
+
</td>
|
|
204
|
+
<td align="left">
|
|
205
|
+
<a href="https://github.com/trycourier/courier-react-native/blob/master/Docs/Client.md">
|
|
206
|
+
<code>CourierClient</code>
|
|
207
|
+
</a>
|
|
208
|
+
</td>
|
|
209
|
+
<td align="left">
|
|
210
|
+
The base level API wrapper around the Courier endpoints. Useful if you have a highly customized user experience or codebase requirements.
|
|
211
|
+
</td>
|
|
212
|
+
</tr>
|
|
202
213
|
</tbody>
|
|
203
214
|
</table>
|
|
204
215
|
|
package/android/build.gradle
CHANGED
|
@@ -104,7 +104,7 @@ dependencies {
|
|
|
104
104
|
implementation 'com.google.code.gson:gson:2.11.0'
|
|
105
105
|
|
|
106
106
|
// Courier Core SDK
|
|
107
|
-
api 'com.github.trycourier:courier-android:4.
|
|
107
|
+
api 'com.github.trycourier:courier-android:4.4.1'
|
|
108
108
|
api 'androidx.recyclerview:recyclerview:1.3.2'
|
|
109
109
|
|
|
110
110
|
}
|
|
@@ -3,6 +3,7 @@ package com.courierreactnative
|
|
|
3
3
|
import android.content.Intent
|
|
4
4
|
import android.os.Bundle
|
|
5
5
|
import com.courier.android.Courier
|
|
6
|
+
import com.courier.android.models.CourierAgent
|
|
6
7
|
import com.courier.android.utils.getLastDeliveredMessage
|
|
7
8
|
import com.courier.android.utils.pushNotification
|
|
8
9
|
import com.courier.android.utils.trackPushNotificationClick
|
|
@@ -18,6 +19,9 @@ open class CourierReactNativeActivity : ReactActivity() {
|
|
|
18
19
|
// Used to ensure shared preferences works properly
|
|
19
20
|
Courier.initialize(this)
|
|
20
21
|
|
|
22
|
+
// Update the user agent
|
|
23
|
+
Courier.agent = CourierAgent.ReactNativeAndroid(version = "4.1.0")
|
|
24
|
+
|
|
21
25
|
super.onCreate(savedInstanceState)
|
|
22
26
|
|
|
23
27
|
// See if there is a pending click event
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
package com.courierreactnative
|
|
2
2
|
|
|
3
3
|
import com.courier.android.Courier
|
|
4
|
-
import com.courier.android.models.CourierAgent
|
|
5
4
|
import com.courier.android.models.CourierAuthenticationListener
|
|
6
5
|
import com.courier.android.models.CourierInboxListener
|
|
7
6
|
import com.courier.android.models.InboxMessage
|
|
@@ -41,14 +40,6 @@ class CourierSharedModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
41
40
|
private var authenticationListeners = mutableMapOf<String, CourierAuthenticationListener>()
|
|
42
41
|
private var inboxListeners = mutableMapOf<String, CourierInboxListener>()
|
|
43
42
|
|
|
44
|
-
init {
|
|
45
|
-
|
|
46
|
-
// User Agent is used to ensure we know the SDK
|
|
47
|
-
// the requests come from
|
|
48
|
-
Courier.USER_AGENT = CourierAgent.REACT_NATIVE_ANDROID
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
43
|
@ReactMethod
|
|
53
44
|
fun addListener(type: String?) {
|
|
54
45
|
// Keep: Required for RN built in Event Emitter Calls.
|
|
@@ -17,7 +17,7 @@ abstract class ReactNativeModule(val tag: String, private val name: String, reac
|
|
|
17
17
|
|
|
18
18
|
// User Agent is used to ensure we know the SDK
|
|
19
19
|
// the requests come from
|
|
20
|
-
Courier.
|
|
20
|
+
Courier.agent = CourierAgent.ReactNativeAndroid(version = "4.1.0")
|
|
21
21
|
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
19
|
# Courier Core Dependency
|
|
20
|
-
s.dependency "Courier_iOS", "4.
|
|
20
|
+
s.dependency "Courier_iOS", "4.4.2"
|
|
21
21
|
|
|
22
22
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
23
23
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
@@ -21,6 +21,9 @@ NSUInteger notificationPresentationOptions = UNNotificationPresentationOptionNon
|
|
|
21
21
|
|
|
22
22
|
if (self) {
|
|
23
23
|
|
|
24
|
+
// Set the user agent
|
|
25
|
+
Courier.agent = [CourierAgent reactNativeIOS:@"4.1.0"];
|
|
26
|
+
|
|
24
27
|
// Register for remote notifications
|
|
25
28
|
UIApplication *app = [UIApplication sharedApplication];
|
|
26
29
|
[app registerForRemoteNotifications];
|
|
@@ -14,8 +14,8 @@ 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.
|
|
18
|
-
|
|
17
|
+
Courier.agent = CourierAgent.reactNativeIOS("4.1.0")
|
|
18
|
+
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import Courier_iOS
|
|
2
2
|
|
|
3
3
|
@objc(CourierSharedModule)
|
|
4
|
-
class CourierSharedModule:
|
|
4
|
+
class CourierSharedModule: CourierReactNativeEventEmitter {
|
|
5
5
|
|
|
6
6
|
private var nativeEmitters = [String]()
|
|
7
7
|
private var authenticationListeners: [String: CourierAuthenticationListener] = [:]
|
|
8
8
|
private var inboxListeners: [String: CourierInboxListener] = [:]
|
|
9
9
|
|
|
10
|
-
override init() {
|
|
11
|
-
super.init()
|
|
12
|
-
|
|
13
|
-
// Set the user agent
|
|
14
|
-
// Used to know the platform performing requests
|
|
15
|
-
Courier.agent = CourierAgent.react_native_ios
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
10
|
override func stopObserving() {
|
|
20
11
|
removeAllAuthenticationListeners()
|
|
21
12
|
removeAllInboxListeners()
|
|
@@ -418,8 +409,4 @@ class CourierSharedModule: RCTEventEmitter {
|
|
|
418
409
|
return nativeEmitters
|
|
419
410
|
}
|
|
420
411
|
|
|
421
|
-
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
422
|
-
return true
|
|
423
|
-
}
|
|
424
|
-
|
|
425
412
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import Courier_iOS
|
|
9
9
|
|
|
10
10
|
@objc(CourierSystemModule)
|
|
11
|
-
class CourierSystemModule:
|
|
11
|
+
class CourierSystemModule: CourierReactNativeEventEmitter {
|
|
12
12
|
|
|
13
13
|
private var lastClickedMessage: [AnyHashable: Any]? = nil
|
|
14
14
|
private var notificationCenter: NotificationCenter {
|
|
@@ -17,14 +17,7 @@ class CourierSystemModule: RCTEventEmitter {
|
|
|
17
17
|
|
|
18
18
|
override init() {
|
|
19
19
|
super.init()
|
|
20
|
-
|
|
21
|
-
// Set the user agent
|
|
22
|
-
// Used to know the platform performing requests
|
|
23
|
-
Courier.agent = CourierAgent.react_native_ios
|
|
24
|
-
|
|
25
|
-
// Attach the listeners
|
|
26
20
|
attachObservers()
|
|
27
|
-
|
|
28
21
|
}
|
|
29
22
|
|
|
30
23
|
// MARK: Push Interactions
|
|
@@ -140,8 +133,4 @@ class CourierSystemModule: RCTEventEmitter {
|
|
|
140
133
|
]
|
|
141
134
|
}
|
|
142
135
|
|
|
143
|
-
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
144
|
-
return true
|
|
145
|
-
}
|
|
146
|
-
|
|
147
136
|
}
|