@trycourier/courier-react-native 4.0.4 → 4.1.1
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/CourierInboxViewManager.kt +2 -2
- package/android/src/main/java/com/courierreactnative/CourierReactNativeActivity.kt +6 -0
- package/android/src/main/java/com/courierreactnative/CourierSharedModule.kt +0 -9
- package/android/src/main/java/com/courierreactnative/ReactNativeModule.kt +1 -2
- package/android/src/main/java/com/courierreactnative/Utils.kt +37 -144
- 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/ios/Utils.swift +1 -2
- package/lib/commonjs/Modules.js +5 -0
- package/lib/commonjs/Modules.js.map +1 -1
- package/lib/commonjs/views/CourierInboxView.js +2 -8
- package/lib/commonjs/views/CourierInboxView.js.map +1 -1
- package/lib/commonjs/views/CourierPreferencesView.js +2 -8
- package/lib/commonjs/views/CourierPreferencesView.js.map +1 -1
- package/lib/module/Modules.js +6 -1
- package/lib/module/Modules.js.map +1 -1
- package/lib/module/views/CourierInboxView.js +3 -9
- package/lib/module/views/CourierInboxView.js.map +1 -1
- package/lib/module/views/CourierPreferencesView.js +3 -9
- package/lib/module/views/CourierPreferencesView.js.map +1 -1
- package/lib/typescript/src/Modules.d.ts +1 -0
- package/lib/typescript/src/Modules.d.ts.map +1 -1
- package/lib/typescript/src/views/CourierInboxView.d.ts.map +1 -1
- package/lib/typescript/src/views/CourierPreferencesView.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Modules.tsx +9 -1
- package/src/views/CourierInboxView.tsx +3 -15
- package/src/views/CourierPreferencesView.tsx +3 -15
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
|
}
|
|
@@ -63,7 +63,7 @@ class CourierInboxViewManager : SimpleViewManager<CourierInbox>() {
|
|
|
63
63
|
|
|
64
64
|
view.setOnClickActionListener { action, message, index ->
|
|
65
65
|
val map = Arguments.createMap()
|
|
66
|
-
map.
|
|
66
|
+
map.putString("action", action.toJson())
|
|
67
67
|
map.putString("message", message.toJson())
|
|
68
68
|
map.putInt("index", index)
|
|
69
69
|
themedReactContext?.sendEvent(ON_CLICK_ACTION_AT_INDEX, map)
|
|
@@ -109,7 +109,7 @@ class CourierInboxViewManager : SimpleViewManager<CourierInbox>() {
|
|
|
109
109
|
val timeStyle = getMap("timeStyle")
|
|
110
110
|
val bodyStyle = getMap("bodyStyle")
|
|
111
111
|
val infoViewStyle = getMap("infoViewStyle")
|
|
112
|
-
val buttonStyles = getMap("
|
|
112
|
+
val buttonStyles = getMap("buttonStyle")
|
|
113
113
|
|
|
114
114
|
val context = view.context
|
|
115
115
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.courierreactnative
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint
|
|
3
4
|
import android.content.Intent
|
|
4
5
|
import android.os.Bundle
|
|
5
6
|
import com.courier.android.Courier
|
|
@@ -14,6 +15,9 @@ open class CourierReactNativeActivity : ReactActivity() {
|
|
|
14
15
|
|
|
15
16
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
16
17
|
|
|
18
|
+
// Update the user agent
|
|
19
|
+
Courier.agent = Utils.COURIER_AGENT
|
|
20
|
+
|
|
17
21
|
// Starts the Courier SDK
|
|
18
22
|
// Used to ensure shared preferences works properly
|
|
19
23
|
Courier.initialize(this)
|
|
@@ -41,6 +45,7 @@ open class CourierReactNativeActivity : ReactActivity() {
|
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
|
|
48
|
+
@SuppressLint("VisibleForTests")
|
|
44
49
|
private fun postPushNotificationDelivered(message: RemoteMessage) {
|
|
45
50
|
reactInstanceManager.currentReactContext?.sendEvent(
|
|
46
51
|
eventName = CourierEvents.Push.DELIVERED_EVENT,
|
|
@@ -48,6 +53,7 @@ open class CourierReactNativeActivity : ReactActivity() {
|
|
|
48
53
|
)
|
|
49
54
|
}
|
|
50
55
|
|
|
56
|
+
@SuppressLint("VisibleForTests")
|
|
51
57
|
private fun postPushNotificationClicked(message: RemoteMessage) {
|
|
52
58
|
reactInstanceManager.currentReactContext?.sendEvent(
|
|
53
59
|
eventName = CourierEvents.Push.CLICKED_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.
|
|
@@ -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.facebook.react.ReactActivity
|
|
6
5
|
import com.facebook.react.bridge.Promise
|
|
7
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
@@ -17,7 +16,7 @@ abstract class ReactNativeModule(val tag: String, private val name: String, reac
|
|
|
17
16
|
|
|
18
17
|
// User Agent is used to ensure we know the SDK
|
|
19
18
|
// the requests come from
|
|
20
|
-
Courier.
|
|
19
|
+
Courier.agent = Utils.COURIER_AGENT
|
|
21
20
|
|
|
22
21
|
}
|
|
23
22
|
|
|
@@ -4,11 +4,7 @@ import android.content.Context
|
|
|
4
4
|
import android.graphics.Color
|
|
5
5
|
import android.graphics.Typeface
|
|
6
6
|
import androidx.recyclerview.widget.DividerItemDecoration
|
|
7
|
-
import com.courier.android.models.
|
|
8
|
-
import com.courier.android.models.CourierUserPreferences
|
|
9
|
-
import com.courier.android.models.InboxAction
|
|
10
|
-
import com.courier.android.models.InboxMessage
|
|
11
|
-
import com.courier.android.models.Paging
|
|
7
|
+
import com.courier.android.models.CourierAgent
|
|
12
8
|
import com.courier.android.ui.CourierStyles
|
|
13
9
|
import com.facebook.react.bridge.Arguments
|
|
14
10
|
import com.facebook.react.bridge.ReactContext
|
|
@@ -18,151 +14,16 @@ import com.facebook.react.bridge.WritableMap
|
|
|
18
14
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
19
15
|
import com.google.gson.GsonBuilder
|
|
20
16
|
|
|
21
|
-
internal
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
internal fun CourierUserPreferences.toWritableMap(): WritableMap {
|
|
26
|
-
|
|
27
|
-
val map = Arguments.createMap()
|
|
28
|
-
|
|
29
|
-
val itemsArray = Arguments.createArray()
|
|
30
|
-
items.forEach { topic ->
|
|
31
|
-
itemsArray.pushMap(topic.toWritableMap())
|
|
32
|
-
}
|
|
33
|
-
map.putArray("items", itemsArray)
|
|
34
|
-
|
|
35
|
-
map.putMap("paging", paging.toWritableMap())
|
|
36
|
-
|
|
37
|
-
return map
|
|
38
|
-
|
|
17
|
+
internal object Utils {
|
|
18
|
+
val COURIER_AGENT = CourierAgent.ReactNativeAndroid(version = "4.1.1")
|
|
39
19
|
}
|
|
40
20
|
|
|
41
|
-
internal fun
|
|
42
|
-
|
|
43
|
-
val map = Arguments.createMap()
|
|
44
|
-
map.putString("defaultStatus", defaultStatus.value)
|
|
45
|
-
map.putBoolean("hasCustomRouting", hasCustomRouting)
|
|
46
|
-
map.putString("status", status.value)
|
|
47
|
-
map.putString("topicId", topicId)
|
|
48
|
-
map.putString("topicName", topicName)
|
|
49
|
-
map.putString("sectionId", sectionId)
|
|
50
|
-
map.putString("sectionName", sectionName)
|
|
51
|
-
|
|
52
|
-
val actionsArray = Arguments.createArray()
|
|
53
|
-
customRouting.forEach { routing ->
|
|
54
|
-
actionsArray.pushString(routing.value)
|
|
55
|
-
}
|
|
56
|
-
map.putArray("customRouting", actionsArray)
|
|
57
|
-
|
|
58
|
-
return map
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
internal fun Paging.toWritableMap(): WritableMap {
|
|
63
|
-
|
|
64
|
-
val map = Arguments.createMap()
|
|
65
|
-
|
|
66
|
-
cursor?.let {
|
|
67
|
-
map.putString("cursor", it)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
map.putBoolean("more", more)
|
|
71
|
-
|
|
72
|
-
return map
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
@JvmName("toWritableArrayInboxMessage")
|
|
77
|
-
internal fun List<InboxMessage>.toWritableArray(): WritableArray {
|
|
78
|
-
|
|
79
|
-
val messagesArray = Arguments.createArray()
|
|
80
|
-
|
|
81
|
-
forEach { message ->
|
|
82
|
-
messagesArray.pushMap(message.toWritableMap())
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return messagesArray
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
internal fun InboxMessage.toWritableMap(): WritableMap {
|
|
90
|
-
|
|
91
|
-
val map = Arguments.createMap()
|
|
92
|
-
map.putString("messageId", messageId)
|
|
93
|
-
map.putString("title", title)
|
|
94
|
-
map.putString("body", body)
|
|
95
|
-
map.putString("preview", preview)
|
|
96
|
-
map.putString("created", created)
|
|
97
|
-
|
|
98
|
-
actions?.let { actionList ->
|
|
99
|
-
val actionsArray = Arguments.createArray()
|
|
100
|
-
actionList.forEach { action ->
|
|
101
|
-
actionsArray.pushMap(action.toWritableMap())
|
|
102
|
-
}
|
|
103
|
-
map.putArray("actions", actionsArray)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
map.putMap("data", data.toWritableMap())
|
|
107
|
-
map.putBoolean("read", isRead)
|
|
108
|
-
map.putBoolean("opened", isOpened)
|
|
109
|
-
map.putBoolean("archived", isArchived)
|
|
110
|
-
|
|
111
|
-
val trackingIds = Arguments.createMap()
|
|
112
|
-
trackingIds.putString("clickTrackingId", clickTrackingId)
|
|
113
|
-
|
|
114
|
-
map.putMap("trackingIds", trackingIds)
|
|
115
|
-
|
|
116
|
-
return map
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
internal fun InboxAction.toWritableMap(): WritableMap {
|
|
121
|
-
|
|
122
|
-
val map = Arguments.createMap()
|
|
123
|
-
map.putString("content", content)
|
|
124
|
-
map.putString("href", href)
|
|
125
|
-
map.putMap("data", data.toWritableMap())
|
|
126
|
-
|
|
127
|
-
return map
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
internal fun Map<String, Any>?.toWritableMap(): WritableMap {
|
|
132
|
-
val map = Arguments.createMap()
|
|
133
|
-
this?.forEach { (key, value) ->
|
|
134
|
-
when (value) {
|
|
135
|
-
is String -> map.putString(key, value)
|
|
136
|
-
is Int -> map.putInt(key, value)
|
|
137
|
-
is Double -> map.putDouble(key, value)
|
|
138
|
-
is Boolean -> map.putBoolean(key, value)
|
|
139
|
-
is Map<*, *> -> map.putMap(key, (value as? Map<String, Any>).toWritableMap())
|
|
140
|
-
is List<*> -> map.putArray(key, (value as? List<Any>).toWritableArray())
|
|
141
|
-
else -> map.putNull(key)
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return map
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
internal fun List<Any>?.toWritableArray(): WritableArray {
|
|
148
|
-
val array = Arguments.createArray()
|
|
149
|
-
this?.forEach { item ->
|
|
150
|
-
when (item) {
|
|
151
|
-
is String -> array.pushString(item)
|
|
152
|
-
is Int -> array.pushInt(item)
|
|
153
|
-
is Double -> array.pushDouble(item)
|
|
154
|
-
is Boolean -> array.pushBoolean(item)
|
|
155
|
-
is Map<*, *> -> array.pushMap((item as? Map<String, Any>).toWritableMap())
|
|
156
|
-
is List<*> -> array.pushArray((item as? List<Any>).toWritableArray())
|
|
157
|
-
else -> array.pushNull()
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return array
|
|
21
|
+
internal fun ReactContext.sendEvent(eventName: String, value: Any?) {
|
|
22
|
+
getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java).emit(eventName, value)
|
|
161
23
|
}
|
|
162
24
|
|
|
163
25
|
internal fun String.toDivider(context: Context): DividerItemDecoration? = if (this == "vertical") DividerItemDecoration(context, DividerItemDecoration.VERTICAL) else null
|
|
164
26
|
|
|
165
|
-
|
|
166
27
|
internal fun String.toColor(): Int = Color.parseColor(this)
|
|
167
28
|
|
|
168
29
|
internal fun String.toFont(context: Context): Typeface? {
|
|
@@ -215,6 +76,38 @@ internal fun ReadableMap.toInfoViewStyle(context: Context): CourierStyles.InfoVi
|
|
|
215
76
|
|
|
216
77
|
}
|
|
217
78
|
|
|
79
|
+
internal fun Map<String, Any>?.toWritableMap(): WritableMap {
|
|
80
|
+
val map = Arguments.createMap()
|
|
81
|
+
this?.forEach { (key, value) ->
|
|
82
|
+
when (value) {
|
|
83
|
+
is String -> map.putString(key, value)
|
|
84
|
+
is Int -> map.putInt(key, value)
|
|
85
|
+
is Double -> map.putDouble(key, value)
|
|
86
|
+
is Boolean -> map.putBoolean(key, value)
|
|
87
|
+
is Map<*, *> -> map.putMap(key, (value as? Map<String, Any>).toWritableMap())
|
|
88
|
+
is List<*> -> map.putArray(key, (value as? List<Any>).toWritableArray())
|
|
89
|
+
else -> map.putNull(key)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return map
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
internal fun List<Any>?.toWritableArray(): WritableArray {
|
|
96
|
+
val array = Arguments.createArray()
|
|
97
|
+
this?.forEach { item ->
|
|
98
|
+
when (item) {
|
|
99
|
+
is String -> array.pushString(item)
|
|
100
|
+
is Int -> array.pushInt(item)
|
|
101
|
+
is Double -> array.pushDouble(item)
|
|
102
|
+
is Boolean -> array.pushBoolean(item)
|
|
103
|
+
is Map<*, *> -> array.pushMap((item as? Map<String, Any>).toWritableMap())
|
|
104
|
+
is List<*> -> array.pushArray((item as? List<Any>).toWritableArray())
|
|
105
|
+
else -> array.pushNull()
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return array
|
|
109
|
+
}
|
|
110
|
+
|
|
218
111
|
internal fun Any.toJson(): String {
|
|
219
112
|
return GsonBuilder().setPrettyPrinting().create().toJson(this)
|
|
220
113
|
}
|
|
@@ -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.5.4"
|
|
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.1"];
|
|
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.1")
|
|
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
|
}
|
package/ios/Utils.swift
CHANGED
|
@@ -51,7 +51,6 @@ internal extension String {
|
|
|
51
51
|
switch self.lowercased() {
|
|
52
52
|
case "none": return .none
|
|
53
53
|
case "singleLine": return .singleLine
|
|
54
|
-
case "singleLineEtched": return .singleLineEtched
|
|
55
54
|
default: return .singleLine
|
|
56
55
|
}
|
|
57
56
|
|
|
@@ -60,7 +59,7 @@ internal extension String {
|
|
|
60
59
|
func toSelectionStyle() -> UITableViewCell.SelectionStyle? {
|
|
61
60
|
|
|
62
61
|
switch self.lowercased() {
|
|
63
|
-
case "none": return .none
|
|
62
|
+
case "none": return UITableViewCell.SelectionStyle.none
|
|
64
63
|
case "blue": return .blue
|
|
65
64
|
case "gray": return .gray
|
|
66
65
|
case "default": return .default
|
package/lib/commonjs/Modules.js
CHANGED
|
@@ -20,6 +20,11 @@ class Modules {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
+
static getNativeComponent(componentName) {
|
|
24
|
+
return _reactNative.UIManager.getViewManagerConfig(componentName) != null ? (0, _reactNative.requireNativeComponent)(componentName) : () => {
|
|
25
|
+
throw new Error(Modules.LINKING_ERROR);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
23
28
|
}
|
|
24
29
|
exports.Modules = Modules;
|
|
25
30
|
//# sourceMappingURL=Modules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","Modules","LINKING_ERROR","Platform","select","ios","default","Client","getNativeModule","NativeModules","CourierClientModule","Shared","CourierSharedModule","System","CourierSystemModule","nativeModule","Proxy","get","Error","exports"],"sourceRoot":"../../src","sources":["Modules.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,OAAO,CAAC;EAEnB,OAAgBC,aAAa,GAC7B,2FAA2F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;IAAEC,GAAG,EAAE,gCAAgC;IAAEC,OAAO,EAAE;EAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;EAE/B,OAAgBC,MAAM,GAAGN,OAAO,CAACO,eAAe,CAACC,0BAAa,CAACC,mBAAmB,CAAC;EACnF,OAAgBC,MAAM,GAAGV,OAAO,CAACO,eAAe,CAACC,0BAAa,CAACG,mBAAmB,CAAC;EACnF,OAAgBC,MAAM,GAAGZ,OAAO,CAACO,eAAe,CAACC,0BAAa,CAACK,mBAAmB,CAAC;EAEnF,OAAON,eAAeA,CAAIO,YAA2B,EAAK;IACxD,OAAOA,YAAY,GACfA,YAAY,GACZ,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;MACEC,GAAGA,CAAA,EAAG;QACJ,MAAM,IAAIC,KAAK,CAACjB,OAAO,CAACC,aAAa,CAAC;MACxC;IACF,CACF,CAAM;EACZ;AAEF;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","Modules","LINKING_ERROR","Platform","select","ios","default","Client","getNativeModule","NativeModules","CourierClientModule","Shared","CourierSharedModule","System","CourierSystemModule","nativeModule","Proxy","get","Error","getNativeComponent","componentName","UIManager","getViewManagerConfig","requireNativeComponent","exports"],"sourceRoot":"../../src","sources":["Modules.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,OAAO,CAAC;EAEnB,OAAgBC,aAAa,GAC7B,2FAA2F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;IAAEC,GAAG,EAAE,gCAAgC;IAAEC,OAAO,EAAE;EAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;EAE/B,OAAgBC,MAAM,GAAGN,OAAO,CAACO,eAAe,CAACC,0BAAa,CAACC,mBAAmB,CAAC;EACnF,OAAgBC,MAAM,GAAGV,OAAO,CAACO,eAAe,CAACC,0BAAa,CAACG,mBAAmB,CAAC;EACnF,OAAgBC,MAAM,GAAGZ,OAAO,CAACO,eAAe,CAACC,0BAAa,CAACK,mBAAmB,CAAC;EAEnF,OAAON,eAAeA,CAAIO,YAA2B,EAAK;IACxD,OAAOA,YAAY,GACfA,YAAY,GACZ,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;MACEC,GAAGA,CAAA,EAAG;QACJ,MAAM,IAAIC,KAAK,CAACjB,OAAO,CAACC,aAAa,CAAC;MACxC;IACF,CACF,CAAM;EACZ;EAEA,OAAOiB,kBAAkBA,CAACC,aAAqB,EAAE;IAC/C,OAAOC,sBAAS,CAACC,oBAAoB,CAACF,aAAa,CAAC,IAAI,IAAI,GACxD,IAAAG,mCAAsB,EAAMH,aAAa,CAAC,GAC1C,MAAM;MACJ,MAAM,IAAIF,KAAK,CAACjB,OAAO,CAACC,aAAa,CAAC;IACxC,CAAC;EACP;AAEF;AAACsB,OAAA,CAAAvB,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
@@ -6,16 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.CourierInboxView = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _Modules = require("../Modules");
|
|
9
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
const
|
|
12
|
-
const LINKING_ERROR = `The package '@trycourier/courier-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
13
|
-
ios: "- You have run 'pod install'\n",
|
|
14
|
-
default: ''
|
|
15
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
16
|
-
const CourierInbox = _reactNative.UIManager.getViewManagerConfig(ComponentName) != null ? (0, _reactNative.requireNativeComponent)(ComponentName) : () => {
|
|
17
|
-
throw new Error(LINKING_ERROR);
|
|
18
|
-
};
|
|
12
|
+
const CourierInbox = _Modules.Modules.getNativeComponent('CourierInboxView');
|
|
19
13
|
const CourierInboxView = props => {
|
|
20
14
|
let onClickInboxMessageAtIndexListener = undefined;
|
|
21
15
|
let onClickInboxActionForMessageAtIndexListener = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_Modules","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","CourierInbox","Modules","getNativeComponent","CourierInboxView","props","onClickInboxMessageAtIndexListener","undefined","onClickInboxActionForMessageAtIndexListener","onScrollInboxListener","useEffect","_onClickInboxMessageA","_onClickInboxActionFo","_onScrollInboxListene","remove","_onClickInboxMessageA2","Platform","OS","onClickInboxMessageAtIndex","DeviceEventEmitter","addListener","event","index","message","JSON","parse","_onClickInboxActionFo2","onClickInboxActionForMessageAtIndex","action","_onScrollInboxListene2","onScrollInbox","contentOffset","createElement","theme","light","dark","nativeEvent","style","exports"],"sourceRoot":"../../../src","sources":["views/CourierInboxView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AAAqC,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAL,wBAAAS,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CA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K,CAACgC;EAAM,CACpB,CAAC;AAGN,CAAC;AAAAC,OAAA,CAAAlC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -6,16 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.CourierPreferencesView = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _Modules = require("../Modules");
|
|
9
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
const
|
|
12
|
-
const LINKING_ERROR = `The package '@trycourier/courier-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
13
|
-
ios: "- You have run 'pod install'\n",
|
|
14
|
-
default: ''
|
|
15
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
16
|
-
const CourierPreferences = _reactNative.UIManager.getViewManagerConfig(ComponentName) != null ? (0, _reactNative.requireNativeComponent)(ComponentName) : () => {
|
|
17
|
-
throw new Error(LINKING_ERROR);
|
|
18
|
-
};
|
|
12
|
+
const CourierPreferences = _Modules.Modules.getNativeComponent('CourierPreferencesView');
|
|
19
13
|
const CourierPreferencesView = props => {
|
|
20
14
|
let onScrollPreferencesListener = undefined;
|
|
21
15
|
(0, _react.useEffect)(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_Modules","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","CourierPreferences","Modules","getNativeComponent","CourierPreferencesView","props","onScrollPreferencesListener","undefined","useEffect","_onScrollPreferencesL","remove","_onScrollPreferencesL2","Platform","OS","onScrollPreferences","DeviceEventEmitter","addListener","event","contentOffset","onPreferenceError","message","createElement","mode","theme","light","dark","nativeEvent","style","exports"],"sourceRoot":"../../../src","sources":["views/CourierPreferencesView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAAqC,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAL,wBAAAS,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,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,sBAAA","ignoreList":[]}
|
package/lib/module/Modules.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NativeModules, Platform } from "react-native";
|
|
1
|
+
import { NativeModules, Platform, UIManager, requireNativeComponent } from "react-native";
|
|
2
2
|
export class Modules {
|
|
3
3
|
static LINKING_ERROR = `The package '@trycourier/courier-react-native' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
4
4
|
ios: "- You have run 'pod install'\n",
|
|
@@ -14,5 +14,10 @@ export class Modules {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
+
static getNativeComponent(componentName) {
|
|
18
|
+
return UIManager.getViewManagerConfig(componentName) != null ? requireNativeComponent(componentName) : () => {
|
|
19
|
+
throw new Error(Modules.LINKING_ERROR);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
17
22
|
}
|
|
18
23
|
//# sourceMappingURL=Modules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","Modules","LINKING_ERROR","select","ios","default","Client","getNativeModule","CourierClientModule","Shared","CourierSharedModule","System","CourierSystemModule","nativeModule","Proxy","get","Error"],"sourceRoot":"../../src","sources":["Modules.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","UIManager","requireNativeComponent","Modules","LINKING_ERROR","select","ios","default","Client","getNativeModule","CourierClientModule","Shared","CourierSharedModule","System","CourierSystemModule","nativeModule","Proxy","get","Error","getNativeComponent","componentName","getViewManagerConfig"],"sourceRoot":"../../src","sources":["Modules.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,sBAAsB,QAAQ,cAAc;AAEzF,OAAO,MAAMC,OAAO,CAAC;EAEnB,OAAgBC,aAAa,GAC7B,2FAA2F,GAC3FJ,QAAQ,CAACK,MAAM,CAAC;IAAEC,GAAG,EAAE,gCAAgC;IAAEC,OAAO,EAAE;EAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;EAE/B,OAAgBC,MAAM,GAAGL,OAAO,CAACM,eAAe,CAACV,aAAa,CAACW,mBAAmB,CAAC;EACnF,OAAgBC,MAAM,GAAGR,OAAO,CAACM,eAAe,CAACV,aAAa,CAACa,mBAAmB,CAAC;EACnF,OAAgBC,MAAM,GAAGV,OAAO,CAACM,eAAe,CAACV,aAAa,CAACe,mBAAmB,CAAC;EAEnF,OAAOL,eAAeA,CAAIM,YAA2B,EAAK;IACxD,OAAOA,YAAY,GACfA,YAAY,GACZ,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;MACEC,GAAGA,CAAA,EAAG;QACJ,MAAM,IAAIC,KAAK,CAACf,OAAO,CAACC,aAAa,CAAC;MACxC;IACF,CACF,CAAM;EACZ;EAEA,OAAOe,kBAAkBA,CAACC,aAAqB,EAAE;IAC/C,OAAOnB,SAAS,CAACoB,oBAAoB,CAACD,aAAa,CAAC,IAAI,IAAI,GACxDlB,sBAAsB,CAAMkB,aAAa,CAAC,GAC1C,MAAM;MACJ,MAAM,IAAIF,KAAK,CAACf,OAAO,CAACC,aAAa,CAAC;IACxC,CAAC;EACP;AAEF","ignoreList":[]}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { Platform,
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
ios: "- You have run 'pod install'\n",
|
|
6
|
-
default: ''
|
|
7
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
-
const CourierInbox = UIManager.getViewManagerConfig(ComponentName) != null ? requireNativeComponent(ComponentName) : () => {
|
|
9
|
-
throw new Error(LINKING_ERROR);
|
|
10
|
-
};
|
|
2
|
+
import { Platform, DeviceEventEmitter } from "react-native";
|
|
3
|
+
import { Modules } from "../Modules";
|
|
4
|
+
const CourierInbox = Modules.getNativeComponent('CourierInboxView');
|
|
11
5
|
export const CourierInboxView = props => {
|
|
12
6
|
let onClickInboxMessageAtIndexListener = undefined;
|
|
13
7
|
let onClickInboxActionForMessageAtIndexListener = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","Platform","
|
|
1
|
+
{"version":3,"names":["React","useEffect","Platform","DeviceEventEmitter","Modules","CourierInbox","getNativeComponent","CourierInboxView","props","onClickInboxMessageAtIndexListener","undefined","onClickInboxActionForMessageAtIndexListener","onScrollInboxListener","_onClickInboxMessageA","_onClickInboxActionFo","_onScrollInboxListene","remove","_onClickInboxMessageA2","OS","onClickInboxMessageAtIndex","addListener","event","index","message","JSON","parse","_onClickInboxActionFo2","onClickInboxActionForMessageAtIndex","action","_onScrollInboxListene2","onScrollInbox","contentOffset","createElement","theme","light","dark","nativeEvent","style"],"sourceRoot":"../../../src","sources":["views/CourierInboxView.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,QAAQ,EAAaC,kBAAkB,QAA6B,cAAc;AAI3F,SAASC,OAAO,QAAQ,YAAY;AAapC,MAAMC,YAAY,GAAGD,OAAO,CAACE,kBAAkB,CAAC,kBAAkB,CAAC;AAEnE,OAAO,MAAMC,gBAAgB,GAAIC,KAA4B,IAAK;EAEhE,IAAIC,kCAAmE,GAAGC,SAAS;EACnF,IAAIC,2CAA4E,GAAGD,SAAS;EAC5F,IAAIE,qBAAsD,GAAGF,SAAS;EAEtET,SAAS,CAAC,MAAM;IAEd,OAAO,MAAM;MAAA,IAAAY,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;MACX,CAAAF,qBAAA,GAAAJ,kCAAkC,cAAAI,qBAAA,uBAAlCA,qBAAA,CAAoCG,MAAM,CAAC,CAAC;MAC5C,CAAAF,qBAAA,GAAAH,2CAA2C,cAAAG,qBAAA,uBAA3CA,qBAAA,CAA6CE,MAAM,CAAC,CAAC;MACrD,CAAAD,qBAAA,GAAAH,qBAAqB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N,aAAa,EAAGT,KAAU,IAAKS,aAAa,CAACT,KAAK,CAACe,WAAW,CAAE;IAChEC,KAAK,EAAE7B,KAAK,CAAC6B;EAAM,CACpB,CAAC;AAGN,CAAC","ignoreList":[]}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { DeviceEventEmitter, Platform
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
ios: "- You have run 'pod install'\n",
|
|
6
|
-
default: ''
|
|
7
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
-
const CourierPreferences = UIManager.getViewManagerConfig(ComponentName) != null ? requireNativeComponent(ComponentName) : () => {
|
|
9
|
-
throw new Error(LINKING_ERROR);
|
|
10
|
-
};
|
|
2
|
+
import { DeviceEventEmitter, Platform } from "react-native";
|
|
3
|
+
import { Modules } from "../Modules";
|
|
4
|
+
const CourierPreferences = Modules.getNativeComponent('CourierPreferencesView');
|
|
11
5
|
export const CourierPreferencesView = props => {
|
|
12
6
|
let onScrollPreferencesListener = undefined;
|
|
13
7
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","DeviceEventEmitter","Platform","
|
|
1
|
+
{"version":3,"names":["React","useEffect","DeviceEventEmitter","Platform","Modules","CourierPreferences","getNativeComponent","CourierPreferencesView","props","onScrollPreferencesListener","undefined","_onScrollPreferencesL","remove","_onScrollPreferencesL2","OS","onScrollPreferences","addListener","event","contentOffset","onPreferenceError","message","createElement","mode","theme","light","dark","nativeEvent","style"],"sourceRoot":"../../../src","sources":["views/CourierPreferencesView.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,kBAAkB,EAAuBC,QAAQ,QAAmB,cAAc;AAE3F,SAASC,OAAO,QAAQ,YAAY;AAapC,MAAMC,kBAAkB,GAAGD,OAAO,CAACE,kBAAkB,CAAC,wBAAwB,CAAC;A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;MAAEC,KAAK,EAAEd,SAAS;MAAEe,IAAI,EAAEf;IAAU,CAAE;IAC5DK,mBAAmB,EAAGE,KAAU,IAAKF,mBAAmB,CAACE,KAAK,CAACS,WAAW,CAAE;IAC5EP,iBAAiB,EAAGF,KAAU,IAAKE,iBAAiB,CAACF,KAAK,CAACS,WAAW,CAAE;IACxEC,KAAK,EAAEnB,KAAK,CAACmB;EAAM,CACpB,CAAC;AAGN,CAAC","ignoreList":[]}
|
|
@@ -4,5 +4,6 @@ export declare class Modules {
|
|
|
4
4
|
static readonly Shared: any;
|
|
5
5
|
static readonly System: any;
|
|
6
6
|
static getNativeModule<T>(nativeModule: T | undefined): T;
|
|
7
|
+
static getNativeComponent(componentName: string): import("react-native").HostComponent<any> | (() => never);
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=Modules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modules.d.ts","sourceRoot":"","sources":["../../../src/Modules.tsx"],"names":[],"mappings":"AAEA,qBAAa,OAAO;IAElB,MAAM,CAAC,QAAQ,CAAC,aAAa,SAIG;IAEhC,MAAM,CAAC,QAAQ,CAAC,MAAM,MAA8D;IACpF,MAAM,CAAC,QAAQ,CAAC,MAAM,MAA8D;IACpF,MAAM,CAAC,QAAQ,CAAC,MAAM,MAA8D;IAEpF,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,SAAS,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"Modules.d.ts","sourceRoot":"","sources":["../../../src/Modules.tsx"],"names":[],"mappings":"AAEA,qBAAa,OAAO;IAElB,MAAM,CAAC,QAAQ,CAAC,aAAa,SAIG;IAEhC,MAAM,CAAC,QAAQ,CAAC,MAAM,MAA8D;IACpF,MAAM,CAAC,QAAQ,CAAC,MAAM,MAA8D;IACpF,MAAM,CAAC,QAAQ,CAAC,MAAM,MAA8D;IAEpF,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,SAAS,GAAG,CAAC;IAazD,MAAM,CAAC,kBAAkB,CAAC,aAAa,EAAE,MAAM;CAQhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CourierInboxView.d.ts","sourceRoot":"","sources":["../../../../src/views/CourierInboxView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"CourierInboxView.d.ts","sourceRoot":"","sources":["../../../../src/views/CourierInboxView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAY,SAAS,EAA2C,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,KAAK,qBAAqB,GAAG;IAC3B,KAAK,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,iBAAiB,CAAC;QAC1B,IAAI,CAAC,EAAE,iBAAiB,CAAA;KACzB,CAAC;IACF,0BAA0B,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5E,mCAAmC,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1G,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAIF,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,sBAiG5D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CourierPreferencesView.d.ts","sourceRoot":"","sources":["../../../../src/views/CourierPreferencesView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"CourierPreferencesView.d.ts","sourceRoot":"","sources":["../../../../src/views/CourierPreferencesView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,EAAqD,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAGrG,KAAK,uBAAuB,GAAG;IAC7B,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,KAAK,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,uBAAuB,CAAC;QAChC,IAAI,CAAC,EAAE,uBAAuB,CAAA;KAC/B,CAAC;IACF,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAIF,eAAO,MAAM,sBAAsB,UAAW,uBAAuB,sBAwDpE,CAAA"}
|
package/package.json
CHANGED
package/src/Modules.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NativeModules, Platform } from "react-native";
|
|
1
|
+
import { NativeModules, Platform, UIManager, requireNativeComponent } from "react-native";
|
|
2
2
|
|
|
3
3
|
export class Modules {
|
|
4
4
|
|
|
@@ -25,4 +25,12 @@ export class Modules {
|
|
|
25
25
|
) as T;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
static getNativeComponent(componentName: string) {
|
|
29
|
+
return UIManager.getViewManagerConfig(componentName) != null
|
|
30
|
+
? requireNativeComponent<any>(componentName)
|
|
31
|
+
: () => {
|
|
32
|
+
throw new Error(Modules.LINKING_ERROR);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { Platform,
|
|
2
|
+
import { Platform, ViewStyle, DeviceEventEmitter, EmitterSubscription } from "react-native";
|
|
3
3
|
import { InboxAction } from "../models/InboxAction";
|
|
4
4
|
import { InboxMessage } from "../models/InboxMessage";
|
|
5
5
|
import { CourierInboxTheme } from "src/models/CourierInboxTheme";
|
|
6
|
+
import { Modules } from "../Modules";
|
|
6
7
|
|
|
7
8
|
type CourierInboxViewProps = {
|
|
8
9
|
theme?: {
|
|
@@ -15,20 +16,7 @@ type CourierInboxViewProps = {
|
|
|
15
16
|
style?: ViewStyle;
|
|
16
17
|
};
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const LINKING_ERROR =
|
|
21
|
-
`The package '@trycourier/courier-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
22
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
23
|
-
'- You rebuilt the app after installing the package\n' +
|
|
24
|
-
'- You are not using Expo Go\n';
|
|
25
|
-
|
|
26
|
-
const CourierInbox =
|
|
27
|
-
UIManager.getViewManagerConfig(ComponentName) != null
|
|
28
|
-
? requireNativeComponent<CourierInboxViewProps>(ComponentName)
|
|
29
|
-
: () => {
|
|
30
|
-
throw new Error(LINKING_ERROR);
|
|
31
|
-
};
|
|
19
|
+
const CourierInbox = Modules.getNativeComponent('CourierInboxView');
|
|
32
20
|
|
|
33
21
|
export const CourierInboxView = (props: CourierInboxViewProps) => {
|
|
34
22
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { DeviceEventEmitter, EmitterSubscription, Platform,
|
|
2
|
+
import { DeviceEventEmitter, EmitterSubscription, Platform, ViewStyle } from "react-native";
|
|
3
3
|
import { CourierPreferencesMode, CourierPreferencesTheme } from "src/models/CourierPreferencesTheme";
|
|
4
|
+
import { Modules } from "../Modules";
|
|
4
5
|
|
|
5
6
|
type CourierPreferencesProps = {
|
|
6
7
|
mode?: CourierPreferencesMode,
|
|
@@ -13,20 +14,7 @@ type CourierPreferencesProps = {
|
|
|
13
14
|
style?: ViewStyle;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const LINKING_ERROR =
|
|
19
|
-
`The package '@trycourier/courier-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
20
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
21
|
-
'- You rebuilt the app after installing the package\n' +
|
|
22
|
-
'- You are not using Expo Go\n';
|
|
23
|
-
|
|
24
|
-
const CourierPreferences =
|
|
25
|
-
UIManager.getViewManagerConfig(ComponentName) != null
|
|
26
|
-
? requireNativeComponent<CourierPreferencesProps>(ComponentName)
|
|
27
|
-
: () => {
|
|
28
|
-
throw new Error(LINKING_ERROR);
|
|
29
|
-
};
|
|
17
|
+
const CourierPreferences = Modules.getNativeComponent('CourierPreferencesView');
|
|
30
18
|
|
|
31
19
|
export const CourierPreferencesView = (props: CourierPreferencesProps) => {
|
|
32
20
|
|