@trycourier/courier-react-native 2.1.0 → 2.2.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.
Files changed (36) hide show
  1. package/android/build.gradle +2 -2
  2. package/android/src/main/java/com/courierreactnative/CourierReactNativeActivity.kt +0 -3
  3. package/android/src/main/java/com/courierreactnative/CourierReactNativeModule.kt +30 -22
  4. package/android/src/main/java/com/courierreactnative/CourierReactNativeViewManager.kt +84 -18
  5. package/courier-react-native.podspec +1 -1
  6. package/ios/CourierReactNativeModule.m +4 -6
  7. package/ios/CourierReactNativeModule.swift +17 -11
  8. package/ios/CourierReactNativeViewManager.swift +122 -41
  9. package/lib/commonjs/index.js +55 -38
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/models/CourierPushProvider.js +16 -0
  12. package/lib/commonjs/models/CourierPushProvider.js.map +1 -0
  13. package/lib/module/index.js +14 -21
  14. package/lib/module/index.js.map +1 -1
  15. package/lib/module/models/CourierPushProvider.js +9 -0
  16. package/lib/module/models/CourierPushProvider.js.map +1 -0
  17. package/lib/typescript/index.d.ts +16 -8
  18. package/lib/typescript/index.d.ts.map +1 -1
  19. package/lib/typescript/models/CourierInboxTheme.d.ts +24 -8
  20. package/lib/typescript/models/CourierInboxTheme.d.ts.map +1 -1
  21. package/lib/typescript/models/CourierPushProvider.d.ts +8 -0
  22. package/lib/typescript/models/CourierPushProvider.d.ts.map +1 -0
  23. package/lib/typescript/views/CourierInboxView.d.ts +1 -1
  24. package/lib/typescript/views/CourierInboxView.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/index.tsx +16 -26
  27. package/src/models/CourierInboxTheme.tsx +28 -8
  28. package/src/models/CourierPushProvider.tsx +7 -0
  29. package/src/views/CourierInboxView.tsx +1 -1
  30. package/lib/commonjs/hooks/CourierProvider.js +0 -254
  31. package/lib/commonjs/hooks/CourierProvider.js.map +0 -1
  32. package/lib/module/hooks/CourierProvider.js +0 -241
  33. package/lib/module/hooks/CourierProvider.js.map +0 -1
  34. package/lib/typescript/hooks/CourierProvider.d.ts +0 -57
  35. package/lib/typescript/hooks/CourierProvider.d.ts.map +0 -1
  36. package/src/hooks/CourierProvider.tsx +0 -356
@@ -101,8 +101,8 @@ dependencies {
101
101
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
102
102
 
103
103
  // Courier Core SDK
104
- api 'com.github.trycourier:courier-android:2.1.1'
105
- api 'androidx.recyclerview:recyclerview:1.3.1'
104
+ api 'com.github.trycourier:courier-android:2.3.1'
105
+ api 'androidx.recyclerview:recyclerview:1.3.2'
106
106
 
107
107
  }
108
108
 
@@ -6,10 +6,7 @@ import com.courier.android.Courier
6
6
  import com.courier.android.utils.getLastDeliveredMessage
7
7
  import com.courier.android.utils.pushNotification
8
8
  import com.courier.android.utils.trackPushNotificationClick
9
- //import com.courier.android.pushNotification
10
- //import com.courier.android.trackPushNotificationClick
11
9
  import com.facebook.react.ReactActivity
12
- import com.facebook.react.modules.core.DeviceEventManagerModule
13
10
  import com.google.firebase.messaging.RemoteMessage
14
11
  import org.json.JSONObject
15
12
 
@@ -4,9 +4,7 @@ import android.content.Intent
4
4
  import com.courier.android.Courier
5
5
  import com.courier.android.models.*
6
6
  import com.courier.android.modules.*
7
- import com.courier.android.utils.isPushPermissionGranted
8
7
  import com.courier.android.utils.pushNotification
9
- import com.courier.android.utils.requestNotificationPermission
10
8
  import com.courier.android.utils.trackPushNotificationClick
11
9
  import com.facebook.react.ReactActivity
12
10
  import com.facebook.react.bridge.*
@@ -72,16 +70,31 @@ class CourierReactNativeModule(reactContext: ReactApplicationContext) : ReactCon
72
70
  )
73
71
  }
74
72
 
75
- @ReactMethod // TODO: Update in the future
73
+ @ReactMethod
76
74
  fun requestNotificationPermission(promise: Promise) {
77
- reactActivity?.requestNotificationPermission()
75
+
76
+ reactActivity?.let { activity ->
77
+ Courier.shared.requestNotificationPermission(activity)
78
+ }
79
+
80
+ promise.resolve("unknown")
81
+
78
82
  }
79
83
 
80
- @ReactMethod // TODO: Update in the future
84
+ @ReactMethod
81
85
  fun getNotificationPermissionStatus(promise: Promise) {
82
- val granted = reactActivity?.isPushPermissionGranted
83
- val status = if (granted == true) "authorized" else "denied"
84
- promise.resolve(status)
86
+
87
+ reactActivity?.let { context ->
88
+
89
+ val isGranted = Courier.shared.isPushPermissionGranted(context)
90
+ val status = if (isGranted) "authorized" else "denied"
91
+ promise.resolve(status)
92
+ return
93
+
94
+ }
95
+
96
+ promise.resolve("unknown")
97
+
85
98
  }
86
99
 
87
100
  @ReactMethod
@@ -148,23 +161,18 @@ class CourierReactNativeModule(reactContext: ReactApplicationContext) : ReactCon
148
161
  }
149
162
 
150
163
  @ReactMethod
151
- fun setFcmToken(token: String, promise: Promise) {
152
- Courier.shared.setFCMToken(
153
- token = token,
154
- onSuccess = {
155
- promise.resolve(null)
156
- },
157
- onFailure = { e ->
158
- promise.reject(CourierEvents.COURIER_ERROR_TAG, e)
159
- }
160
- )
164
+ fun getToken(key: String, promise: Promise) {
165
+ val token = Courier.shared.getToken(key)
166
+ promise.resolve(token)
161
167
  }
162
168
 
163
169
  @ReactMethod
164
- fun getFcmToken(promise: Promise) {
165
- Courier.shared.getFCMToken(
166
- onSuccess = { token ->
167
- promise.resolve(token)
170
+ fun setToken(key: String, token: String, promise: Promise) {
171
+ Courier.shared.setToken(
172
+ provider = key,
173
+ token = token,
174
+ onSuccess = {
175
+ promise.resolve(null)
168
176
  },
169
177
  onFailure = { e ->
170
178
  promise.reject(CourierEvents.COURIER_ERROR_TAG, e)
@@ -5,10 +5,7 @@ import android.graphics.Color
5
5
  import android.graphics.Typeface
6
6
  import android.view.View
7
7
  import androidx.recyclerview.widget.DividerItemDecoration
8
- import com.courier.android.inbox.CourierInbox
9
- import com.courier.android.inbox.CourierInboxButtonStyles
10
- import com.courier.android.inbox.CourierInboxFont
11
- import com.courier.android.inbox.CourierInboxTheme
8
+ import com.courier.android.inbox.*
12
9
  import com.facebook.react.bridge.Arguments
13
10
  import com.facebook.react.bridge.ReadableMap
14
11
  import com.facebook.react.uimanager.SimpleViewManager
@@ -90,26 +87,41 @@ class CourierReactNativeViewManager : SimpleViewManager<CourierInbox>() {
90
87
  val android = getMap("android")
91
88
  val dividerItemDecoration = android?.getString("dividerItemDecoration")
92
89
 
93
- val unreadIndicatorBarColor = getString("unreadIndicatorBarColor")
90
+ val unreadIndicatorStyle = getMap("unreadIndicatorStyle")
94
91
  val loadingIndicatorColor = getString("loadingIndicatorColor")
95
92
 
96
- val titleFont = getMap("titleFont")
97
- val timeFont = getMap("timeFont")
98
- val bodyFont = getMap("bodyFont")
99
- val detailTitleFont = getMap("detailTitleFont")
93
+ val titleStyle = getMap("titleStyle")
94
+ val timeStyle = getMap("timeStyle")
95
+ val bodyStyle = getMap("bodyStyle")
96
+ val infoViewStyle = getMap("infoViewStyle")
100
97
  val buttonStyles = getMap("buttonStyles")
101
98
 
102
99
  val context = view.context
103
100
 
104
101
  return CourierInboxTheme(
105
- dividerItemDecoration = dividerItemDecoration?.toDivider(context),
106
- unreadIndicatorBarColor = unreadIndicatorBarColor?.toColor(),
102
+ unreadIndicatorStyle = unreadIndicatorStyle?.toUnreadIndicatorStyle() ?: CourierInboxUnreadIndicatorStyle(),
107
103
  loadingIndicatorColor = loadingIndicatorColor?.toColor(),
108
- titleFont = titleFont?.toFont(context) ?: CourierInboxFont(),
109
- timeFont = timeFont?.toFont(context) ?: CourierInboxFont(),
110
- bodyFont = bodyFont?.toFont(context) ?: CourierInboxFont(),
111
- detailTitleFont = detailTitleFont?.toFont(context) ?: CourierInboxFont(),
112
- buttonStyles = buttonStyles?.toButtonStyles(context) ?: CourierInboxButtonStyles()
104
+ titleStyle = titleStyle?.toTextStyle(context) ?: CourierInboxTextStyle(
105
+ unread = CourierInboxFont(),
106
+ read = CourierInboxFont(),
107
+ ),
108
+ timeStyle = timeStyle?.toTextStyle(context) ?: CourierInboxTextStyle(
109
+ unread = CourierInboxFont(),
110
+ read = CourierInboxFont(),
111
+ ),
112
+ bodyStyle = bodyStyle?.toTextStyle(context) ?: CourierInboxTextStyle(
113
+ unread = CourierInboxFont(),
114
+ read = CourierInboxFont(),
115
+ ),
116
+ buttonStyle = buttonStyles?.toButtonStyle(context) ?: CourierInboxButtonStyle(
117
+ unread = CourierInboxButton(),
118
+ read = CourierInboxButton(),
119
+ ),
120
+ infoViewStyle = infoViewStyle?.toInfoStyle(context) ?: CourierInboxInfoViewStyle(
121
+ font = CourierInboxFont(),
122
+ button = CourierInboxButton(),
123
+ ),
124
+ dividerItemDecoration = dividerItemDecoration?.toDivider(context),
113
125
  )
114
126
 
115
127
  }
@@ -142,13 +154,43 @@ class CourierReactNativeViewManager : SimpleViewManager<CourierInbox>() {
142
154
 
143
155
  }
144
156
 
145
- private fun ReadableMap.toButtonStyles(context: Context): CourierInboxButtonStyles {
157
+ private fun ReadableMap.toTextStyle(context: Context): CourierInboxTextStyle {
158
+
159
+ val unread = getMap("unread")
160
+ val read = getMap("read")
161
+
162
+ return CourierInboxTextStyle(
163
+ unread = unread?.toFont(context) ?: CourierInboxFont(),
164
+ read = read?.toFont(context) ?: CourierInboxFont(),
165
+ )
166
+
167
+ }
168
+
169
+ private fun ReadableMap.toUnreadIndicatorStyle(): CourierInboxUnreadIndicatorStyle {
170
+
171
+ val indicator = getString("indicator")
172
+ val color = getString("color")
173
+
174
+ var style = CourierInboxUnreadIndicator.LINE
175
+
176
+ if (indicator == "dot") {
177
+ style = CourierInboxUnreadIndicator.DOT
178
+ }
179
+
180
+ return CourierInboxUnreadIndicatorStyle(
181
+ indicator = style,
182
+ color = color?.toColor(),
183
+ )
184
+
185
+ }
186
+
187
+ private fun ReadableMap.toButton(context: Context): CourierInboxButton {
146
188
 
147
189
  val font = getMap("font")
148
190
  val backgroundColor = getString("backgroundColor")
149
191
  val cornerRadius = if (isNull("cornerRadius")) null else getDouble("cornerRadius")
150
192
 
151
- return CourierInboxButtonStyles(
193
+ return CourierInboxButton(
152
194
  font = font?.toFont(context),
153
195
  backgroundColor = backgroundColor?.toColor(),
154
196
  cornerRadiusInDp = cornerRadius?.toInt()
@@ -156,4 +198,28 @@ class CourierReactNativeViewManager : SimpleViewManager<CourierInbox>() {
156
198
 
157
199
  }
158
200
 
201
+ private fun ReadableMap.toButtonStyle(context: Context): CourierInboxButtonStyle {
202
+
203
+ val unread = getMap("unread")
204
+ val read = getMap("read")
205
+
206
+ return CourierInboxButtonStyle(
207
+ unread = unread?.toButton(context) ?: CourierInboxButton(),
208
+ read = read?.toButton(context) ?: CourierInboxButton()
209
+ )
210
+
211
+ }
212
+
213
+ private fun ReadableMap.toInfoStyle(context: Context): CourierInboxInfoViewStyle {
214
+
215
+ val font = getMap("font")
216
+ val button = getMap("button")
217
+
218
+ return CourierInboxInfoViewStyle(
219
+ font = font?.toFont(context) ?: CourierInboxFont(),
220
+ button = button?.toButton(context) ?: CourierInboxButton()
221
+ )
222
+
223
+ }
224
+
159
225
  }
@@ -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", "2.1.3"
20
+ s.dependency "Courier_iOS", "2.7.3"
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.
@@ -45,17 +45,15 @@ RCT_EXTERN_METHOD(
45
45
  withRejecter: (RCTPromiseRejectBlock)reject
46
46
  )
47
47
 
48
- RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(
49
- getApnsToken
50
- )
51
-
52
48
  RCT_EXTERN_METHOD(
53
- getFcmToken: (RCTPromiseResolveBlock)resolve
49
+ setToken: (NSString*)key
50
+ withToken: (NSString*)token
51
+ withResolver: (RCTPromiseResolveBlock)resolve
54
52
  withRejecter: (RCTPromiseRejectBlock)reject
55
53
  )
56
54
 
57
55
  RCT_EXTERN_METHOD(
58
- setFcmToken: (NSString*)token
56
+ getToken: (NSString*)key
59
57
  withResolver: (RCTPromiseResolveBlock)resolve
60
58
  withRejecter: (RCTPromiseRejectBlock)reject
61
59
  )
@@ -226,11 +226,12 @@ class CourierReactNativeModule: RCTEventEmitter {
226
226
 
227
227
  }
228
228
 
229
- @objc(setFcmToken: withResolver: withRejecter:)
230
- func setFcmToken(token: NSString, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
229
+ @objc(setToken: withToken: withResolver: withRejecter:)
230
+ func setToken(key: NSString, token: NSString, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
231
231
 
232
- Courier.shared.setFCMToken(
233
- token as String,
232
+ Courier.shared.setToken(
233
+ providerKey: key as String,
234
+ token: token as String,
234
235
  onSuccess: {
235
236
  resolve(nil)
236
237
  },
@@ -241,13 +242,18 @@ class CourierReactNativeModule: RCTEventEmitter {
241
242
 
242
243
  }
243
244
 
244
- @objc(getFcmToken: withRejecter:)
245
- func getFcmToken(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
246
- resolve(Courier.shared.fcmToken)
247
- }
248
-
249
- @objc func getApnsToken() -> String? {
250
- return Courier.shared.apnsToken
245
+ @objc(getToken: withResolver: withRejecter:)
246
+ func getToken(key: NSString, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
247
+
248
+ let provider = key as String
249
+
250
+ Task {
251
+
252
+ let token = await Courier.shared.getToken(providerKey: provider)
253
+ resolve(token)
254
+
255
+ }
256
+
251
257
  }
252
258
 
253
259
  @objc(iOSForegroundPresentationOptions:)
@@ -96,56 +96,58 @@ class CourierReactNativeView : UIView {
96
96
  let cellStyles = iOS?["cellStyles"] as? [String : Any]
97
97
 
98
98
  // Unread
99
- let unreadIndicatorBarColor = dict["unreadIndicatorBarColor"] as? String
99
+ let unreadIndicatorStyle = dict["unreadIndicatorStyle"] as? [String : Any]
100
100
 
101
101
  // Loading
102
102
  let loadingIndicatorColor = dict["loadingIndicatorColor"] as? String
103
103
 
104
104
  // Title
105
- let titleFont = dict["titleFont"] as? [String : Any]
105
+ let titleStyle = dict["titleStyle"] as? [String : Any]
106
106
 
107
107
  // Time
108
- let timeFont = dict["timeFont"] as? [String : Any]
108
+ let timeStyle = dict["timeStyle"] as? [String : Any]
109
109
 
110
110
  // Body
111
- let bodyFont = dict["bodyFont"] as? [String : Any]
111
+ let bodyStyle = dict["bodyStyle"] as? [String : Any]
112
112
 
113
- // Detail
114
- let detailTitleFont = dict["detailTitleFont"] as? [String : Any]
113
+ // Info View
114
+ let infoViewStyle = dict["infoViewStyle"] as? [String : Any]
115
115
 
116
- // Detail
117
- let buttonStyles = dict["buttonStyles"] as? [String : Any]
116
+ // Button
117
+ let buttonStyle = dict["buttonStyle"] as? [String : Any]
118
118
 
119
119
  return CourierInboxTheme(
120
120
  messageAnimationStyle: messageAnimationStyle?.toRowAnimation() ?? .left,
121
- unreadIndicatorBarColor: unreadIndicatorBarColor?.toColor(),
122
121
  loadingIndicatorColor: loadingIndicatorColor?.toColor(),
123
- titleFont: dictionaryToFont(
124
- dictionary: titleFont,
125
- defaultFont: UIFont.boldSystemFont(ofSize: UIFont.labelFontSize),
126
- defaultColor: .label
127
- ),
128
- timeFont: dictionaryToFont(
129
- dictionary: timeFont,
130
- defaultFont: UIFont.systemFont(ofSize: UIFont.labelFontSize),
131
- defaultColor: .placeholderText
132
- ),
133
- bodyFont: dictionaryToFont(
134
- dictionary: bodyFont,
135
- defaultFont: UIFont.systemFont(ofSize: UIFont.labelFontSize),
136
- defaultColor: .label
137
- ),
138
- detailTitleFont: dictionaryToFont(
139
- dictionary: detailTitleFont,
140
- defaultFont: UIFont.systemFont(ofSize: UIFont.labelFontSize),
141
- defaultColor: .label
142
- ),
143
- buttonStyles: dictionaryToButtonStyles(
144
- dictionary: buttonStyles
145
- ),
146
- cellStyles: dictionaryToCellStyles(
147
- dictionary: cellStyles
148
- )
122
+ unreadIndicatorStyle: dictionaryToUnreadStyle(dictionary: unreadIndicatorStyle),
123
+ titleStyle: dictionaryToTextStyle(dictionary: titleStyle),
124
+ timeStyle: dictionaryToTextStyle(dictionary: timeStyle),
125
+ bodyStyle: dictionaryToTextStyle(dictionary: bodyStyle),
126
+ buttonStyle: dictionaryToButtonStyle(dictionary: buttonStyle),
127
+ cellStyle: dictionaryToCellStyles(dictionary: cellStyles),
128
+ infoViewStyle: dictionaryToInfoViewStyle(dictionary: infoViewStyle)
129
+ )
130
+
131
+ }
132
+
133
+ func dictionaryToUnreadStyle(dictionary: [String : Any]?) -> CourierInboxUnreadIndicatorStyle {
134
+
135
+ guard let dict = dictionary else {
136
+ return CourierInboxUnreadIndicatorStyle()
137
+ }
138
+
139
+ let indicator = dict["indicator"] as? String
140
+ let color = dict["color"] as? String
141
+
142
+ var style: CourierInboxUnreadIndicator = .line
143
+
144
+ if (indicator == "dot") {
145
+ style = .dot
146
+ }
147
+
148
+ return CourierInboxUnreadIndicatorStyle(
149
+ indicator: style,
150
+ color: color?.toColor()
149
151
  )
150
152
 
151
153
  }
@@ -170,17 +172,22 @@ class CourierReactNativeView : UIView {
170
172
 
171
173
  }
172
174
 
173
- func dictionaryToButtonStyles(dictionary: [String : Any]?) -> CourierInboxButtonStyles {
175
+ func dictionaryToButton(dictionary: [String : Any]?) -> CourierInboxButton {
174
176
 
175
177
  guard let dict = dictionary else {
176
- return CourierInboxButtonStyles()
178
+ return CourierInboxButton(
179
+ font: CourierInboxFont(
180
+ font: UIFont.systemFont(ofSize: UIFont.labelFontSize),
181
+ color: .white
182
+ )
183
+ )
177
184
  }
178
185
 
179
186
  let font = dict["font"] as? [String : Any]
180
187
  let backgroundColor = dict["backgroundColor"] as? String
181
188
  let cornerRadius = dict["cornerRadius"] as? CGFloat
182
189
 
183
- return CourierInboxButtonStyles(
190
+ return CourierInboxButton(
184
191
  font: dictionaryToFont(
185
192
  dictionary: font,
186
193
  defaultFont: UIFont.systemFont(ofSize: UIFont.labelFontSize),
@@ -192,10 +199,84 @@ class CourierReactNativeView : UIView {
192
199
 
193
200
  }
194
201
 
195
- func dictionaryToCellStyles(dictionary: [String : Any]?) -> CourierInboxCellStyles {
202
+ func dictionaryToButtonStyle(dictionary: [String : Any]?) -> CourierInboxButtonStyle {
203
+
204
+ guard let dict = dictionary else {
205
+ return CourierInboxButtonStyle()
206
+ }
207
+
208
+ let unread = dict["unread"] as? [String : Any]
209
+ let read = dict["read"] as? [String : Any]
210
+
211
+ return CourierInboxButtonStyle(
212
+ unread: dictionaryToButton(dictionary: unread),
213
+ read: dictionaryToButton(dictionary: read)
214
+ )
215
+
216
+ }
217
+
218
+ func dictionaryToInfoViewStyle(dictionary: [String : Any]?) -> CourierInboxInfoViewStyle {
219
+
220
+ let defaultColor: UIColor = .label
221
+ let defaultFont: UIFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
222
+
223
+ let defaultInboxFont = CourierInboxFont(
224
+ font: defaultFont,
225
+ color: defaultColor
226
+ )
227
+
228
+ guard let dict = dictionary else {
229
+ return CourierInboxInfoViewStyle(
230
+ font: defaultInboxFont,
231
+ button: CourierInboxButton(
232
+ font: defaultInboxFont
233
+ )
234
+ )
235
+ }
236
+
237
+ let font = dict["font"] as? [String : Any]
238
+ let button = dict["button"] as? [String : Any]
239
+
240
+ return CourierInboxInfoViewStyle(
241
+ font: dictionaryToFont(dictionary: font, defaultFont: defaultFont, defaultColor: defaultColor),
242
+ button: dictionaryToButton(dictionary: button)
243
+ )
244
+
245
+ }
246
+
247
+ func dictionaryToTextStyle(dictionary: [String : Any]?) -> CourierInboxTextStyle {
248
+
249
+ let defaultColor: UIColor = .label
250
+ let defaultFont: UIFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
251
+
252
+ let defaultInboxFont = CourierInboxFont(
253
+ font: defaultFont,
254
+ color: defaultColor
255
+ )
256
+
257
+ let defaultText = CourierInboxTextStyle(
258
+ unread: defaultInboxFont,
259
+ read: defaultInboxFont
260
+ )
261
+
262
+ guard let dict = dictionary else {
263
+ return defaultText
264
+ }
265
+
266
+ let unread = dict["unread"] as? [String : Any]
267
+ let read = dict["read"] as? [String : Any]
268
+
269
+ return CourierInboxTextStyle(
270
+ unread: dictionaryToFont(dictionary: unread, defaultFont: defaultFont, defaultColor: defaultColor),
271
+ read: dictionaryToFont(dictionary: read, defaultFont: defaultFont, defaultColor: defaultColor)
272
+ )
273
+
274
+ }
275
+
276
+ func dictionaryToCellStyles(dictionary: [String : Any]?) -> CourierInboxCellStyle {
196
277
 
197
278
  guard let dict = dictionary else {
198
- return CourierInboxCellStyles()
279
+ return CourierInboxCellStyle()
199
280
  }
200
281
 
201
282
  let separatorStyle = dict["separatorStyle"] as? String
@@ -209,7 +290,7 @@ class CourierReactNativeView : UIView {
209
290
  let bottom = insets?["bottom"] as? CGFloat
210
291
  let separatorInsets = UIEdgeInsets(top: top ?? 0, left: left ?? 0, bottom: bottom ?? 0, right: right ?? 0)
211
292
 
212
- return CourierInboxCellStyles(
293
+ return CourierInboxCellStyle(
213
294
  separatorStyle: separatorStyle?.toSeparatorStyle() ?? .singleLine,
214
295
  separatorInsets: separatorInsets,
215
296
  separatorColor: separatorColor?.toColor(),