@trycourier/courier-react-native 1.0.9 → 2.0.0-beta1

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.
Files changed (89) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +16 -412
  3. package/android/build.gradle +48 -83
  4. package/android/src/main/AndroidManifest.xml +0 -1
  5. package/android/src/main/AndroidManifestNew.xml +2 -0
  6. package/android/src/main/java/com/courierreactnative/CourierReactNativeActivity.kt +10 -10
  7. package/android/src/main/java/com/courierreactnative/CourierReactNativeModule.kt +146 -137
  8. package/android/src/main/java/com/courierreactnative/CourierReactNativePackage.kt +1 -3
  9. package/android/src/main/java/com/courierreactnative/CourierReactNativeViewManager.kt +43 -0
  10. package/courier-react-native.podspec +12 -4
  11. package/ios/CourierReactNative-Bridging-Header.h +0 -1
  12. package/ios/CourierReactNative.xcodeproj/project.pbxproj +4 -4
  13. package/ios/CourierReactNative.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
  14. package/ios/CourierReactNativeModule.m +53 -0
  15. package/ios/{CourierReactNative.swift → CourierReactNativeModule.swift} +178 -45
  16. package/ios/CourierReactNativeViewManager.m +15 -0
  17. package/ios/CourierReactNativeViewManager.swift +348 -0
  18. package/lib/commonjs/index.js +86 -210
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/commonjs/models/CourierInboxListener.js +26 -0
  21. package/lib/commonjs/models/CourierInboxListener.js.map +1 -0
  22. package/lib/commonjs/models/CourierInboxTheme.js +2 -0
  23. package/lib/commonjs/models/CourierInboxTheme.js.map +1 -0
  24. package/lib/commonjs/models/InboxAction.js +2 -0
  25. package/lib/commonjs/models/InboxAction.js.map +1 -0
  26. package/lib/commonjs/models/InboxMessage.js +6 -0
  27. package/lib/commonjs/models/InboxMessage.js.map +1 -0
  28. package/lib/commonjs/views/CourierInboxView.js +53 -0
  29. package/lib/commonjs/views/CourierInboxView.js.map +1 -0
  30. package/lib/module/index.js +80 -209
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/module/models/CourierInboxListener.js +18 -0
  33. package/lib/module/models/CourierInboxListener.js.map +1 -0
  34. package/lib/module/models/CourierInboxTheme.js +2 -0
  35. package/lib/module/models/CourierInboxTheme.js.map +1 -0
  36. package/lib/module/models/InboxAction.js +2 -0
  37. package/lib/module/models/InboxAction.js.map +1 -0
  38. package/lib/module/models/InboxMessage.js +2 -0
  39. package/lib/module/models/InboxMessage.js.map +1 -0
  40. package/lib/module/views/CourierInboxView.js +45 -0
  41. package/lib/module/views/CourierInboxView.js.map +1 -0
  42. package/lib/typescript/index.d.ts +46 -92
  43. package/lib/typescript/index.d.ts.map +1 -0
  44. package/lib/typescript/models/CourierInboxListener.d.ts +9 -0
  45. package/lib/typescript/models/CourierInboxListener.d.ts.map +1 -0
  46. package/lib/typescript/models/CourierInboxTheme.d.ts +34 -0
  47. package/lib/typescript/models/CourierInboxTheme.d.ts.map +1 -0
  48. package/lib/typescript/models/InboxAction.d.ts +8 -0
  49. package/lib/typescript/models/InboxAction.d.ts.map +1 -0
  50. package/lib/typescript/models/InboxMessage.d.ts +18 -0
  51. package/lib/typescript/models/InboxMessage.d.ts.map +1 -0
  52. package/lib/typescript/views/CourierInboxView.d.ts +16 -0
  53. package/lib/typescript/views/CourierInboxView.d.ts.map +1 -0
  54. package/package.json +61 -44
  55. package/src/index.tsx +213 -0
  56. package/src/models/CourierInboxListener.tsx +25 -0
  57. package/src/models/CourierInboxTheme.tsx +30 -0
  58. package/src/models/InboxAction.tsx +5 -0
  59. package/src/models/InboxMessage.tsx +16 -0
  60. package/src/views/CourierInboxView.tsx +85 -0
  61. package/android/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  62. package/android/.gradle/7.1/dependencies-accessors/gc.properties +0 -0
  63. package/android/.gradle/7.1/executionHistory/executionHistory.lock +0 -0
  64. package/android/.gradle/7.1/fileChanges/last-build.bin +0 -0
  65. package/android/.gradle/7.1/fileHashes/fileHashes.bin +0 -0
  66. package/android/.gradle/7.1/fileHashes/fileHashes.lock +0 -0
  67. package/android/.gradle/7.1/gc.properties +0 -0
  68. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  69. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  70. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  71. package/android/.gradle/checksums/checksums.lock +0 -0
  72. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  73. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  74. package/android/.gradle/vcs-1/gc.properties +0 -0
  75. package/android/.idea/compiler.xml +0 -6
  76. package/android/.idea/gradle.xml +0 -17
  77. package/android/.idea/jarRepositories.xml +0 -35
  78. package/android/.idea/misc.xml +0 -10
  79. package/android/.idea/vcs.xml +0 -6
  80. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  81. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  82. package/android/gradlew +0 -185
  83. package/android/gradlew.bat +0 -89
  84. package/android/local.properties +0 -8
  85. package/android/src/main/java/com/courierreactnative/NotificationPermissionStatus.kt +0 -6
  86. package/ios/CourierReactNative.m +0 -52
  87. package/ios/CourierReactNativeDelegate.h +0 -20
  88. package/ios/CourierReactNativeDelegate.m +0 -125
  89. package/src/index.ts +0 -337
@@ -3,8 +3,8 @@ 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.pushNotification
7
- import com.courier.android.trackPushNotificationClick
6
+ //import com.courier.android.pushNotification
7
+ //import com.courier.android.trackPushNotificationClick
8
8
  import com.facebook.react.ReactActivity
9
9
  import com.facebook.react.modules.core.DeviceEventManagerModule
10
10
  import com.google.firebase.messaging.RemoteMessage
@@ -28,9 +28,9 @@ open class CourierReactNativeActivity : ReactActivity() {
28
28
  checkIntentForPushNotificationClick(intent)
29
29
 
30
30
  // Handle delivered messages on the main thread
31
- Courier.getLastDeliveredMessage { message ->
32
- postPushNotificationDelivered(message)
33
- }
31
+ // Courier.getLastDeliveredMessage { message ->
32
+ // postPushNotificationDelivered(message)
33
+ // }
34
34
 
35
35
  }
36
36
 
@@ -46,17 +46,17 @@ open class CourierReactNativeActivity : ReactActivity() {
46
46
  }
47
47
 
48
48
  private fun checkIntentForPushNotificationClick(intent: Intent?) {
49
- intent?.trackPushNotificationClick { message ->
50
- postPushNotificationClicked(message)
51
- }
49
+ // intent?.trackPushNotificationClick { message ->
50
+ // postPushNotificationClicked(message)
51
+ // }
52
52
  }
53
53
 
54
54
  private fun postPushNotificationDelivered(message: RemoteMessage) {
55
- sendEvent(PUSH_DELIVERED_EVENT, JSONObject(message.pushNotification).toString())
55
+ // sendEvent(PUSH_DELIVERED_EVENT, JSONObject(message.pushNotification).toString())
56
56
  }
57
57
 
58
58
  private fun postPushNotificationClicked(message: RemoteMessage) {
59
- sendEvent(PUSH_CLICKED_EVENT, JSONObject(message.pushNotification).toString())
59
+ // sendEvent(PUSH_CLICKED_EVENT, JSONObject(message.pushNotification).toString())
60
60
  }
61
61
 
62
62
  }
@@ -4,6 +4,9 @@ import android.content.Intent
4
4
  import com.courier.android.*
5
5
  import com.courier.android.models.CourierAgent
6
6
  import com.courier.android.models.CourierProvider
7
+ import com.courier.android.modules.*
8
+ import com.courier.android.utils.pushNotification
9
+ import com.courier.android.utils.trackPushNotificationClick
7
10
  import com.facebook.react.ReactActivity
8
11
  import com.facebook.react.bridge.*
9
12
  import com.facebook.react.modules.core.DeviceEventManagerModule
@@ -13,8 +16,9 @@ import org.json.JSONObject
13
16
 
14
17
  class CourierReactNativeModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
15
18
 
19
+ override fun getName() = "CourierReactNativeModule"
20
+
16
21
  companion object {
17
- private const val COURIER_MODULE_NAME = "CourierReactNative"
18
22
  private const val COURIER_ERROR_TAG = "Courier Android SDK Error"
19
23
  private const val COURIER_PUSH_NOTIFICATION_DEBUG_LOG_EVENT = "courierDebugEvent"
20
24
  private const val COURIER_PUSH_NOTIFICATION_CLICKED_EVENT = "pushNotificationClicked"
@@ -25,47 +29,30 @@ class CourierReactNativeModule(reactContext: ReactApplicationContext) : ReactCon
25
29
  // the requests come from
26
30
  Courier.USER_AGENT = CourierAgent.REACT_NATIVE_ANDROID
27
31
 
28
- Courier.shared.logListener = { data ->
29
- sendEvent(reactContext, COURIER_PUSH_NOTIFICATION_DEBUG_LOG_EVENT, data)
30
- }
32
+ // Courier.shared.logListener = { data ->
33
+ // sendEvent(reactContext, COURIER_PUSH_NOTIFICATION_DEBUG_LOG_EVENT, data)
34
+ // }
31
35
 
32
36
  }
33
37
 
34
- override fun getName(): String {
35
- return COURIER_MODULE_NAME
36
- }
37
-
38
- private val reactActivity: ReactActivity?
39
- get() = currentActivity as? ReactActivity
40
-
41
- @ReactMethod
42
- fun signIn(userId: String, accessToken: String, promise: Promise) {
43
- Courier.shared.signIn(
44
- accessToken = accessToken,
45
- userId = userId,
46
- onSuccess = {
47
- promise.resolve(null)
48
- },
49
- onFailure = { e ->
50
- promise.reject(COURIER_ERROR_TAG, e)
51
- }
52
- )
53
- }
38
+ private val reactActivity: ReactActivity? get() = currentActivity as? ReactActivity
54
39
 
55
40
  @ReactMethod
56
- fun getFcmToken(promise: Promise) {
41
+ fun setDebugMode(isDebugging: Boolean, promise: Promise) {
57
42
  try {
58
- val token = Courier.shared.fcmToken
59
- promise.resolve(token)
43
+ Courier.shared.isDebugging = isDebugging
44
+ promise.resolve(Courier.shared.isDebugging)
60
45
  } catch (e: Exception) {
61
46
  promise.reject(COURIER_ERROR_TAG, e)
62
47
  }
63
48
  }
64
49
 
65
50
  @ReactMethod
66
- fun setFcmToken(token: String, promise: Promise) {
67
- Courier.shared.setFCMToken(
68
- token,
51
+ fun signIn(accessToken: String, clientKey: String?, userId: String, promise: Promise) {
52
+ Courier.shared.signIn(
53
+ accessToken = accessToken,
54
+ clientKey = clientKey,
55
+ userId = userId,
69
56
  onSuccess = {
70
57
  promise.resolve(null)
71
58
  },
@@ -75,6 +62,37 @@ class CourierReactNativeModule(reactContext: ReactApplicationContext) : ReactCon
75
62
  )
76
63
  }
77
64
 
65
+ // @ReactMethod
66
+ // fun getFcmToken(promise: Promise) {
67
+ // Courier.shared.getFCMToken(
68
+ // onSuccess = { token ->
69
+ // promise.resolve(token)
70
+ // },
71
+ // onFailure = { e ->
72
+ // promise.reject(COURIER_ERROR_TAG, e)
73
+ // }
74
+ // )
75
+ // }
76
+ //
77
+ // @ReactMethod
78
+ // fun setFcmToken(token: String, promise: Promise) {
79
+ //
80
+ // token.let { fcmToken ->
81
+ //
82
+ // Courier.shared.setFCMToken(
83
+ // fcmToken,
84
+ // onSuccess = {
85
+ // promise.resolve(null)
86
+ // },
87
+ // onFailure = { e ->
88
+ // promise.reject(COURIER_ERROR_TAG, e)
89
+ // }
90
+ // )
91
+ //
92
+ // }
93
+ //
94
+ // }
95
+ //
78
96
  @ReactMethod
79
97
  fun getUserId(promise: Promise) {
80
98
  try {
@@ -96,112 +114,103 @@ class CourierReactNativeModule(reactContext: ReactApplicationContext) : ReactCon
96
114
  }
97
115
  )
98
116
  }
99
-
100
- @ReactMethod
101
- fun sendPush(
102
- authKey: String,
103
- userId: String,
104
- title: String,
105
- body: String,
106
- providers: ReadableArray,
107
- promise: Promise
108
- ) {
109
- Courier.shared.sendPush(
110
- authKey = authKey,
111
- userId = userId,
112
- title = title,
113
- body = body,
114
- providers = providers.toCourierProviders(),
115
- onSuccess = { messageId ->
116
- promise.resolve(messageId)
117
- },
118
- onFailure = { e ->
119
- promise.reject(COURIER_ERROR_TAG, e)
120
- }
121
- )
122
- }
123
-
124
- @ReactMethod
125
- fun requestNotificationPermission(promise: Promise) {
126
- try {
127
- reactActivity?.requestNotificationPermission { isGranted ->
128
- val status = if (isGranted) NotificationPermissionStatus.AUTHORIZED else NotificationPermissionStatus.DENIED
129
- promise.resolve(status.value)
130
- }
131
- } catch (e: Exception) {
132
- promise.reject(COURIER_ERROR_TAG, e)
133
- }
134
- }
135
-
136
- @ReactMethod
137
- fun getNotificationPermissionStatus(promise: Promise) {
138
- try {
139
- reactActivity?.getNotificationPermissionStatus { isGranted ->
140
- val status = if (isGranted) NotificationPermissionStatus.AUTHORIZED else NotificationPermissionStatus.DENIED
141
- promise.resolve(status.value)
142
- }
143
- } catch (e: Exception) {
144
- promise.reject(COURIER_ERROR_TAG, e)
145
- }
146
- }
147
-
148
- @ReactMethod
149
- fun registerPushNotificationClickedOnKilledState() {
150
- reactActivity?.let { activity ->
151
- checkIntentForPushNotificationClick(activity.intent)
152
- }
153
- }
154
-
155
- private fun checkIntentForPushNotificationClick(intent: Intent?) {
156
- intent?.trackPushNotificationClick { message ->
157
- postPushNotificationClicked(message)
158
- }
159
- }
160
-
161
- private fun postPushNotificationClicked(message: RemoteMessage) {
162
- sendEvent(
163
- reactApplicationContext,
164
- COURIER_PUSH_NOTIFICATION_CLICKED_EVENT,
165
- JSONObject(message.pushNotification).toString()
166
- )
167
- }
168
-
169
- @ReactMethod
170
- fun setDebugMode(isDebugging: Boolean, promise: Promise) {
171
- try {
172
- Courier.shared.isDebugging = isDebugging
173
- promise.resolve(Courier.shared.isDebugging)
174
- } catch (e: Exception) {
175
- promise.reject(COURIER_ERROR_TAG, e)
176
- }
177
- }
178
-
179
- private fun sendEvent(reactContext: ReactContext, eventName: String, params: String) {
180
- reactContext
181
- .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
182
- .emit(eventName, params)
183
- }
184
-
185
- @ReactMethod
186
- fun addListener(eventName: String?) {
187
- // Empty
188
- }
189
-
190
- @ReactMethod
191
- fun removeListeners(count: Int?) {
192
- // Empty
193
- }
194
-
195
- private fun ReadableArray.toCourierProviders(): List<CourierProvider> {
196
- val providers: MutableList<CourierProvider> = mutableListOf()
197
- for (provider in toArrayList()) {
198
- CourierProvider.values().forEach {
199
- if (it.value == provider) {
200
- providers.add(it)
201
- }
202
- }
203
- }
204
- return providers
205
- }
117
+ //
118
+ // @ReactMethod
119
+ // fun sendPush(
120
+ // authKey: String,
121
+ // userId: String,
122
+ // title: String,
123
+ // body: String,
124
+ // providers: ReadableArray,
125
+ // promise: Promise
126
+ // ) {
127
+ //// Courier.shared.sendPush(
128
+ //// authKey = authKey,
129
+ //// userId = userId,
130
+ //// title = title,
131
+ //// body = body,
132
+ //// providers = providers.toCourierProviders(),
133
+ //// onSuccess = { messageId ->
134
+ //// promise.resolve(messageId)
135
+ //// },
136
+ //// onFailure = { e ->
137
+ //// promise.reject(COURIER_ERROR_TAG, e)
138
+ //// }
139
+ //// )
140
+ // }
141
+ //
142
+ // @ReactMethod
143
+ // fun requestNotificationPermission(promise: Promise) {
144
+ //// try {
145
+ //// reactActivity?.requestNotificationPermission { isGranted ->
146
+ //// val status = if (isGranted) NotificationPermissionStatus.AUTHORIZED else NotificationPermissionStatus.DENIED
147
+ //// promise.resolve(status.value)
148
+ //// }
149
+ //// } catch (e: Exception) {
150
+ //// promise.reject(COURIER_ERROR_TAG, e)
151
+ //// }
152
+ // }
153
+ //
154
+ // @ReactMethod
155
+ // fun getNotificationPermissionStatus(promise: Promise) {
156
+ //// try {
157
+ //// reactActivity?.getNotificationPermissionStatus { isGranted ->
158
+ //// val status = if (isGranted) NotificationPermissionStatus.AUTHORIZED else NotificationPermissionStatus.DENIED
159
+ //// promise.resolve(status.value)
160
+ //// }
161
+ //// } catch (e: Exception) {
162
+ //// promise.reject(COURIER_ERROR_TAG, e)
163
+ //// }
164
+ // }
165
+ //
166
+ // @ReactMethod
167
+ // fun registerPushNotificationClickedOnKilledState() {
168
+ // reactActivity?.let { activity ->
169
+ // checkIntentForPushNotificationClick(activity.intent)
170
+ // }
171
+ // }
172
+ //
173
+ // private fun checkIntentForPushNotificationClick(intent: Intent?) {
174
+ // intent?.trackPushNotificationClick { message ->
175
+ // postPushNotificationClicked(message)
176
+ // }
177
+ // }
178
+ //
179
+ // private fun postPushNotificationClicked(message: RemoteMessage) {
180
+ // sendEvent(
181
+ // reactApplicationContext,
182
+ // COURIER_PUSH_NOTIFICATION_CLICKED_EVENT,
183
+ // JSONObject(message.pushNotification).toString()
184
+ // )
185
+ // }
186
+ //
187
+ //
188
+ // private fun sendEvent(reactContext: ReactContext, eventName: String, params: String) {
189
+ // reactContext
190
+ // .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
191
+ // .emit(eventName, params)
192
+ // }
193
+ //
194
+ // @ReactMethod
195
+ // fun addListener(eventName: String?) {
196
+ // // Empty
197
+ // }
198
+ //
199
+ // @ReactMethod
200
+ // fun removeListeners(count: Int?) {
201
+ // // Empty
202
+ // }
203
+ //
204
+ // private fun ReadableArray.toCourierProviders(): List<CourierProvider> {
205
+ // val providers: MutableList<CourierProvider> = mutableListOf()
206
+ // for (provider in toArrayList()) {
207
+ // CourierProvider.values().forEach {
208
+ // if (it.value == provider) {
209
+ // providers.add(it)
210
+ // }
211
+ // }
212
+ // }
213
+ // return providers
214
+ // }
206
215
 
207
216
  }
@@ -7,13 +7,11 @@ import com.facebook.react.uimanager.ViewManager
7
7
 
8
8
 
9
9
  class CourierReactNativePackage : ReactPackage {
10
-
11
10
  override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
12
11
  return listOf(CourierReactNativeModule(reactContext))
13
12
  }
14
13
 
15
14
  override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
16
- return emptyList()
15
+ return listOf(CourierReactNativeViewManager())
17
16
  }
18
-
19
17
  }
@@ -0,0 +1,43 @@
1
+ package com.courierreactnative
2
+
3
+ import android.graphics.Color
4
+ import android.view.View
5
+ import android.widget.FrameLayout
6
+ import com.courier.android.inbox.CourierInbox
7
+ import com.facebook.react.bridge.ReadableMap
8
+ import com.facebook.react.bridge.UiThreadUtil
9
+ import com.facebook.react.uimanager.SimpleViewManager
10
+ import com.facebook.react.uimanager.ThemedReactContext
11
+ import com.facebook.react.uimanager.annotations.ReactProp
12
+
13
+ class CourierReactNativeViewManager : SimpleViewManager<FrameLayout>() {
14
+
15
+ override fun getName() = "CourierReactNativeView"
16
+
17
+ override fun createViewInstance(reactContext: ThemedReactContext): FrameLayout {
18
+ return FrameLayout(reactContext)
19
+ }
20
+
21
+ @ReactProp(name = "theme")
22
+ fun setTheme(view: FrameLayout, theme: ReadableMap) {
23
+
24
+ view.removeAllViews()
25
+
26
+ // Create the view
27
+ val courierInbox = CourierInbox(view.context)
28
+
29
+ // Set the layout params
30
+ val layoutParams = FrameLayout.LayoutParams(
31
+ FrameLayout.LayoutParams.MATCH_PARENT,
32
+ FrameLayout.LayoutParams.MATCH_PARENT
33
+ )
34
+ courierInbox.layoutParams = layoutParams
35
+
36
+ // Add the view to the parent
37
+ view.addView(courierInbox)
38
+
39
+ view.setBackgroundColor(Color.parseColor(theme.getString("color")))
40
+
41
+ }
42
+
43
+ }
@@ -15,23 +15,31 @@ Pod::Spec.new do |s|
15
15
  s.source = { :git => "https://github.com/trycourier/courier-react-native.git", :tag => "#{s.version}" }
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
+
19
+ # Courier Core Dependency
20
+ s.dependency "Courier_iOS", "2.0.4"
18
21
 
22
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
23
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
24
+ if respond_to?(:install_modules_dependencies, true)
25
+ install_modules_dependencies(s)
26
+ else
19
27
  s.dependency "React-Core"
20
- s.dependency 'Courier-iOS', '1.1.2'
21
- s.swift_version = '5.6'
22
28
 
23
29
  # Don't install the dependencies when we run `pod install` in the old architecture.
24
30
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
25
31
  s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
26
32
  s.pod_target_xcconfig = {
27
33
  "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
34
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
28
35
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
29
36
  }
30
-
37
+ s.dependency "React-RCTFabric"
31
38
  s.dependency "React-Codegen"
32
39
  s.dependency "RCT-Folly"
33
40
  s.dependency "RCTRequired"
34
41
  s.dependency "RCTTypeSafety"
35
42
  s.dependency "ReactCommon/turbomodule/core"
36
- end
43
+ end
44
+ end
37
45
  end
@@ -1,3 +1,2 @@
1
- #import <React/RCTBridgeModule.h>
2
1
  #import <React/RCTViewManager.h>
3
2
  #import <React/RCTEventEmitter.h>
@@ -7,7 +7,7 @@
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
- 5E555C0D2413F4C50049A1A2 /* CourierReactNative.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* CourierReactNative.m */; };
10
+ 5E555C0D2413F4C50049A1A2 /* CourierReactNative.mm in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* CourierReactNative.mm */; };
11
11
  F4FF95D7245B92E800C19C63 /* CourierReactNative.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* CourierReactNative.swift */; };
12
12
  /* End PBXBuildFile section */
13
13
 
@@ -25,7 +25,7 @@
25
25
 
26
26
  /* Begin PBXFileReference section */
27
27
  134814201AA4EA6300B7C361 /* libCourierReactNative.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCourierReactNative.a; sourceTree = BUILT_PRODUCTS_DIR; };
28
- B3E7B5891CC2AC0600A0062D /* CourierReactNative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CourierReactNative.m; sourceTree = "<group>"; };
28
+ B3E7B5891CC2AC0600A0062D /* CourierReactNative.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CourierReactNative.mm; sourceTree = "<group>"; };
29
29
  F4FF95D5245B92E700C19C63 /* CourierReactNative-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CourierReactNative-Bridging-Header.h"; sourceTree = "<group>"; };
30
30
  F4FF95D6245B92E800C19C63 /* CourierReactNative.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourierReactNative.swift; sourceTree = "<group>"; };
31
31
  /* End PBXFileReference section */
@@ -53,7 +53,7 @@
53
53
  isa = PBXGroup;
54
54
  children = (
55
55
  F4FF95D6245B92E800C19C63 /* CourierReactNative.swift */,
56
- B3E7B5891CC2AC0600A0062D /* CourierReactNative.m */,
56
+ B3E7B5891CC2AC0600A0062D /* CourierReactNative.mm */,
57
57
  F4FF95D5245B92E700C19C63 /* CourierReactNative-Bridging-Header.h */,
58
58
  134814211AA4EA7D00B7C361 /* Products */,
59
59
  );
@@ -117,7 +117,7 @@
117
117
  buildActionMask = 2147483647;
118
118
  files = (
119
119
  F4FF95D7245B92E800C19C63 /* CourierReactNative.swift in Sources */,
120
- B3E7B58A1CC2AC0600A0062D /* CourierReactNative.m in Sources */,
120
+ B3E7B58A1CC2AC0600A0062D /* CourierReactNative.mm in Sources */,
121
121
  );
122
122
  runOnlyForDeploymentPostprocessing = 0;
123
123
  };
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ </Workspace>
@@ -0,0 +1,53 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface RCT_EXTERN_MODULE(CourierReactNativeModule, NSObject)
4
+
5
+ RCT_EXTERN_METHOD(
6
+ signIn: (NSString*)accessToken
7
+ withClientKey: (NSString*)clientKey
8
+ withUserId: (NSString*)userId
9
+ withResolver: (RCTPromiseResolveBlock)resolve
10
+ withRejecter: (RCTPromiseRejectBlock)reject
11
+ )
12
+
13
+ RCT_EXTERN_METHOD(
14
+ signOut: (RCTPromiseResolveBlock)resolve
15
+ withRejecter: (RCTPromiseRejectBlock)reject
16
+ )
17
+
18
+ RCT_EXTERN_METHOD(
19
+ getUserId: (RCTPromiseResolveBlock)resolve
20
+ withRejecter: (RCTPromiseRejectBlock)reject
21
+ )
22
+
23
+ RCT_EXTERN_METHOD(
24
+ readMessage: (NSString*)messageId
25
+ withResolver: (RCTPromiseResolveBlock)resolve
26
+ withRejecter: (RCTPromiseRejectBlock)reject
27
+ )
28
+
29
+ RCT_EXTERN_METHOD(
30
+ unreadMessage: (NSString*)messageId
31
+ withResolver: (RCTPromiseResolveBlock)resolve
32
+ withRejecter: (RCTPromiseRejectBlock)reject
33
+ )
34
+
35
+ RCT_EXTERN_METHOD(
36
+ readAllInboxMessages: (RCTPromiseResolveBlock)resolve
37
+ withRejecter: (RCTPromiseRejectBlock)reject
38
+ )
39
+
40
+ RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(
41
+ addInboxListener: (NSString*)listenerId
42
+ )
43
+
44
+ RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(
45
+ removeInboxListener: (NSString*)listenerId
46
+ )
47
+
48
+ RCT_EXTERN_METHOD(
49
+ refreshInbox: (RCTPromiseResolveBlock)resolve
50
+ withRejecter: (RCTPromiseRejectBlock)reject
51
+ )
52
+
53
+ @end