@wscsports/blaze-rtn-sdk 1.1.1 → 1.2.2
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/android/build.gradle +1 -1
- package/android/src/main/java/com/blaze/rtnblazesdk/BlazeSdkModule.kt +60 -20
- package/android/src/main/java/com/blaze/rtnblazesdk/BlazeSdkPackage.kt +4 -0
- package/android/src/main/java/com/blaze/rtnblazesdk/base/BaseWidgetView.kt +18 -16
- package/android/src/main/java/com/blaze/rtnblazesdk/base/BlazeReactSizeFixingView.kt +9 -16
- package/android/src/main/java/com/blaze/rtnblazesdk/base/BlazeWidgetViewManager.kt +149 -0
- package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactLayoutMerger.kt +27 -2
- package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactWidgetLayout.kt +25 -3
- package/android/src/main/java/com/blaze/rtnblazesdk/events/SdkModuleJsEvent.kt +1 -0
- package/android/src/main/java/com/blaze/rtnblazesdk/events/WidgetHeightChangedEvent.kt +25 -0
- package/android/src/main/java/com/blaze/rtnblazesdk/extensions/ContextExtensions.kt +19 -0
- package/android/src/main/java/com/blaze/rtnblazesdk/moments/BlazeMomentsGridViewManager.kt +25 -0
- package/android/src/main/java/com/blaze/rtnblazesdk/moments/BlazeMomentsRowViewManager.kt +24 -0
- package/android/src/main/java/com/blaze/rtnblazesdk/stories/BlazeStoriesGridViewManager.kt +26 -0
- package/android/src/main/java/com/blaze/rtnblazesdk/stories/BlazeStoriesRowViewManager.kt +24 -0
- package/android/src/main/java/com/blaze/rtnblazesdk/utils/ArrayExtensions.kt +3 -1
- package/android/src/main/java/com/blaze/rtnblazesdk/utils/BlazePlayerEventExtensions.kt +13 -1
- package/android/src/main/java/com/blaze/rtnblazesdk/utils/DataSourceTypeExtractUtils.kt +1 -1
- package/blaze-rtn-sdk.podspec +1 -1
- package/ios/Sources/BlazeMomentsGridWidgetManager/BlazeMomentsGridWidgetManager.m +3 -0
- package/ios/Sources/BlazeMomentsRowWidgetManager/BlazeMomentsRowWidgetManager.m +3 -0
- package/ios/Sources/BlazeNativeSDKModule/RTNBlazeSdkModule+AppEvents.swift +2 -0
- package/ios/Sources/BlazeStoriesGridWidgetManager/BlazeStoriesGridWidgetManager.m +3 -0
- package/ios/Sources/BlazeStoriesRowWidgetManager/BlazeStoriesRowWidgetManager.m +3 -0
- package/ios/Sources/LayoutCustomization/BlazeReactLayoutMerger.swift +35 -0
- package/ios/Sources/LayoutCustomization/BlazeReactWidgetLayout.swift +14 -0
- package/ios/Sources/Utils/BlazePlayerEvent+Extensions.swift +15 -0
- package/ios/Sources/Widgets/Base/BlazeWidgetBase.swift +16 -18
- package/ios/Sources/Widgets/Base/BlazeWidgetViewManagerBase.h +35 -0
- package/lib/commonjs/classes/common-parser.js +6 -2
- package/lib/commonjs/classes/common-parser.js.map +1 -1
- package/lib/commonjs/widgets/BlazeBaseWidgetComponent.js +12 -3
- package/lib/commonjs/widgets/BlazeBaseWidgetComponent.js.map +1 -1
- package/lib/commonjs/widgets/BlazeMomentsGridView.js +8 -0
- package/lib/commonjs/widgets/BlazeMomentsGridView.js.map +1 -1
- package/lib/commonjs/widgets/BlazeStoriesGridView.js +8 -0
- package/lib/commonjs/widgets/BlazeStoriesGridView.js.map +1 -1
- package/lib/commonjs/widgets/BlazeStoriesRowView.js.map +1 -1
- package/lib/module/classes/common-parser.js +6 -2
- package/lib/module/classes/common-parser.js.map +1 -1
- package/lib/module/widgets/BlazeBaseWidgetComponent.js +12 -3
- package/lib/module/widgets/BlazeBaseWidgetComponent.js.map +1 -1
- package/lib/module/widgets/BlazeMomentsGridView.js +8 -0
- package/lib/module/widgets/BlazeMomentsGridView.js.map +1 -1
- package/lib/module/widgets/BlazeStoriesGridView.js +8 -0
- package/lib/module/widgets/BlazeStoriesGridView.js.map +1 -1
- package/lib/module/widgets/BlazeStoriesRowView.js.map +1 -1
- package/lib/typescript/classes/common-parser.d.ts.map +1 -1
- package/lib/typescript/interfaces/blaze-player-event.d.ts +6 -2
- package/lib/typescript/interfaces/blaze-player-event.d.ts.map +1 -1
- package/lib/typescript/interfaces/common.interface.d.ts +1 -1
- package/lib/typescript/interfaces/common.interface.d.ts.map +1 -1
- package/lib/typescript/interfaces/widget-layout.interface.d.ts +0 -1
- package/lib/typescript/interfaces/widget-layout.interface.d.ts.map +1 -1
- package/lib/typescript/interfaces/widgets-props.interface.d.ts +3 -0
- package/lib/typescript/interfaces/widgets-props.interface.d.ts.map +1 -1
- package/lib/typescript/widgets/BlazeBaseWidgetComponent.d.ts +9 -1
- package/lib/typescript/widgets/BlazeBaseWidgetComponent.d.ts.map +1 -1
- package/lib/typescript/widgets/BlazeBaseWidgetViewProps.d.ts +4 -2
- package/lib/typescript/widgets/BlazeBaseWidgetViewProps.d.ts.map +1 -1
- package/lib/typescript/widgets/BlazeMomentsGridView.d.ts.map +1 -1
- package/lib/typescript/widgets/BlazeStoriesGridView.d.ts.map +1 -1
- package/lib/typescript/widgets/BlazeStoriesRowView.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/classes/common-parser.tsx +7 -4
- package/src/interfaces/blaze-player-event.tsx +17 -8
- package/src/interfaces/common.interface.tsx +3 -1
- package/src/interfaces/widget-layout.interface.tsx +0 -1
- package/src/interfaces/widgets-props.interface.tsx +4 -0
- package/src/widgets/BlazeBaseWidgetComponent.tsx +20 -2
- package/src/widgets/BlazeBaseWidgetViewProps.tsx +8 -4
- package/src/widgets/BlazeMomentsGridView.tsx +30 -20
- package/src/widgets/BlazeStoriesGridView.tsx +31 -21
- package/src/widgets/BlazeStoriesRowView.tsx +19 -19
- package/android/src/main/java/com/blaze/rtnblazesdk/BlazeMomentsGridViewManager.kt +0 -89
- package/android/src/main/java/com/blaze/rtnblazesdk/BlazeMomentsRowViewManager.kt +0 -80
- package/android/src/main/java/com/blaze/rtnblazesdk/BlazeStoriesGridViewManager.kt +0 -90
- package/android/src/main/java/com/blaze/rtnblazesdk/BlazeStoriesRowViewManager.kt +0 -80
- package/android/src/main/java/com/blaze/rtnblazesdk/NativeBlazeSdkSpec.kt +0 -71
- package/android/src/main/java/com/blaze/rtnblazesdk/base/BaseViewManager.kt +0 -91
- package/android/src/main/java/com/blaze/rtnblazesdk/base/BlazeWidgetViewShadowNode.kt +0 -35
- package/android/src/main/java/com/blaze/rtnblazesdk/moments/BlazeGridViewManagerImp.kt +0 -11
- package/android/src/main/java/com/blaze/rtnblazesdk/moments/BlazeRowViewManagerImp.kt +0 -13
- package/android/src/main/java/com/blaze/rtnblazesdk/stories/BlazeGridViewManagerImp.kt +0 -14
- package/android/src/main/java/com/blaze/rtnblazesdk/stories/BlazeRowViewManagerImp.kt +0 -13
- package/android/src/main/java/com/blaze/rtnblazesdk/viewmanagers/RTNBlazeMomentsGridViewManagerDelegate.kt +0 -39
- package/android/src/main/java/com/blaze/rtnblazesdk/viewmanagers/RTNBlazeMomentsGridViewManagerInterface.kt +0 -16
- package/android/src/main/java/com/blaze/rtnblazesdk/viewmanagers/RTNBlazeMomentsRowViewManagerDelegate.kt +0 -35
- package/android/src/main/java/com/blaze/rtnblazesdk/viewmanagers/RTNBlazeMomentsRowViewManagerInterface.kt +0 -15
- package/android/src/main/java/com/blaze/rtnblazesdk/viewmanagers/RTNBlazeStoriesGridViewManagerDelegate.kt +0 -36
- package/android/src/main/java/com/blaze/rtnblazesdk/viewmanagers/RTNBlazeStoriesGridViewManagerInterface.kt +0 -16
- package/android/src/main/java/com/blaze/rtnblazesdk/viewmanagers/RTNBlazeStoriesRowViewManagerDelegate.kt +0 -32
- package/android/src/main/java/com/blaze/rtnblazesdk/viewmanagers/RTNBlazeStoriesRowViewManagerInterface.kt +0 -15
- package/ios/Sources/Widgets/Base/BlazeWidgetViewManagerBase.m +0 -45
package/android/build.gradle
CHANGED
|
@@ -12,8 +12,6 @@ import com.blaze.blazesdk.features.shared.models.ui_shared.BlazeLinkActionHandle
|
|
|
12
12
|
import com.blaze.blazesdk.prefetch.models.BlazeCachingLevel
|
|
13
13
|
import com.blaze.blazesdk.shared.BlazeSDK
|
|
14
14
|
import com.blaze.blazesdk.shared.results.BlazeResult
|
|
15
|
-
import com.blaze.blazesdk.style.players.moments.BlazeMomentsPlayerStyle
|
|
16
|
-
import com.blaze.blazesdk.style.players.stories.BlazeStoryPlayerStyle
|
|
17
15
|
import com.blaze.rtnblazesdk.events.SdkModuleJsEvent
|
|
18
16
|
import com.blaze.rtnblazesdk.utils.extractCachingLevel
|
|
19
17
|
import com.blaze.rtnblazesdk.utils.extractDataSource
|
|
@@ -21,12 +19,21 @@ import com.blaze.rtnblazesdk.utils.extractMomentsPlayerStyle
|
|
|
21
19
|
import com.blaze.rtnblazesdk.utils.extractStoriesPlayerStyle
|
|
22
20
|
import com.blaze.rtnblazesdk.utils.handleResult
|
|
23
21
|
import com.blaze.rtnblazesdk.utils.rejectWith
|
|
22
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
24
23
|
import com.facebook.react.bridge.NoSuchKeyException
|
|
25
24
|
import com.facebook.react.bridge.Promise
|
|
26
25
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
26
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
27
|
+
import com.facebook.react.bridge.ReactMethod
|
|
27
28
|
import com.facebook.react.bridge.ReadableMap
|
|
29
|
+
import javax.annotation.Nonnull
|
|
28
30
|
|
|
29
|
-
class BlazeSdkModule(private val context: ReactApplicationContext):
|
|
31
|
+
class BlazeSdkModule(private val context: ReactApplicationContext): ReactContextBaseJavaModule(context) {
|
|
32
|
+
|
|
33
|
+
@Nonnull
|
|
34
|
+
override fun getName(): String {
|
|
35
|
+
return NAME
|
|
36
|
+
}
|
|
30
37
|
|
|
31
38
|
private val reactNativeSDKHelper = BlazeReactSDKHelper()
|
|
32
39
|
private var appOverridesCTAHandling: Boolean = false
|
|
@@ -113,7 +120,9 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
113
120
|
BlazeExternalModulesBinder.reactNativeSDKHelper = reactNativeSDKHelper
|
|
114
121
|
}
|
|
115
122
|
|
|
116
|
-
|
|
123
|
+
@ReactMethod
|
|
124
|
+
@DoNotStrip
|
|
125
|
+
fun init(options: ReadableMap, promise: Promise) {
|
|
117
126
|
|
|
118
127
|
try {
|
|
119
128
|
setAppOverrideCtaHandling(options)
|
|
@@ -169,7 +178,9 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
169
178
|
context.emitDeviceEvent(event.eventName, event.params)
|
|
170
179
|
}
|
|
171
180
|
|
|
172
|
-
|
|
181
|
+
@ReactMethod
|
|
182
|
+
@DoNotStrip
|
|
183
|
+
fun playStory(options: ReadableMap, promise: Promise) {
|
|
173
184
|
try {
|
|
174
185
|
val storyId = options.getString(KEY_STORY_OPT_STORY_ID) ?: run {
|
|
175
186
|
promise.rejectWith("no story id")
|
|
@@ -191,7 +202,9 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
191
202
|
}
|
|
192
203
|
}
|
|
193
204
|
|
|
194
|
-
|
|
205
|
+
@ReactMethod
|
|
206
|
+
@DoNotStrip
|
|
207
|
+
fun playMoment(options: ReadableMap, promise: Promise) {
|
|
195
208
|
|
|
196
209
|
try {
|
|
197
210
|
val momentId = options.getString(KEY_STORY_OPT_MOMENT_ID) ?: run {
|
|
@@ -211,7 +224,9 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
211
224
|
}
|
|
212
225
|
}
|
|
213
226
|
|
|
214
|
-
|
|
227
|
+
@ReactMethod
|
|
228
|
+
@DoNotStrip
|
|
229
|
+
fun prepareStories(options: ReadableMap, promise: Promise) {
|
|
215
230
|
try {
|
|
216
231
|
val dataSource = options.getMap(KEY_ENTRY_POINT_DATA_SOURCE)?.extractDataSource() ?: run {
|
|
217
232
|
promise.rejectWith("Error parsing data source for prepareStories")
|
|
@@ -226,7 +241,9 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
226
241
|
|
|
227
242
|
}
|
|
228
243
|
|
|
229
|
-
|
|
244
|
+
@ReactMethod
|
|
245
|
+
@DoNotStrip
|
|
246
|
+
fun prepareMoments(options: ReadableMap, promise: Promise) {
|
|
230
247
|
try {
|
|
231
248
|
val dataSource = options.getMap(KEY_ENTRY_POINT_DATA_SOURCE)?.extractDataSource() ?: run {
|
|
232
249
|
promise.rejectWith("Error parsing data source for prepareMoments")
|
|
@@ -240,28 +257,37 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
240
257
|
}
|
|
241
258
|
}
|
|
242
259
|
|
|
243
|
-
|
|
244
|
-
|
|
260
|
+
@ReactMethod
|
|
261
|
+
@DoNotStrip
|
|
262
|
+
fun dismissPlayer(promise: Promise) {
|
|
245
263
|
BlazeSDK.dismissCurrentPlayer()
|
|
246
264
|
promise.resolve(true)
|
|
247
265
|
}
|
|
248
266
|
|
|
249
|
-
|
|
267
|
+
@DoNotStrip
|
|
268
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
269
|
+
fun isInitialized(): Boolean {
|
|
250
270
|
return BlazeSDK.isInitialized()
|
|
251
271
|
}
|
|
252
272
|
|
|
253
|
-
|
|
273
|
+
@ReactMethod
|
|
274
|
+
@DoNotStrip
|
|
275
|
+
fun setExternalUserId(externalUserId: String?, promise: Promise) {
|
|
254
276
|
BlazeSDK.setExternalUserId(externalUserId) { result ->
|
|
255
277
|
promise.handleResult(result)
|
|
256
278
|
}
|
|
257
279
|
}
|
|
258
280
|
|
|
259
|
-
|
|
281
|
+
@ReactMethod
|
|
282
|
+
@DoNotStrip
|
|
283
|
+
fun setDoNotTrack(doNotTrack: Boolean, promise: Promise) {
|
|
260
284
|
BlazeSDK.setDoNotTrack(doNotTrack)
|
|
261
285
|
promise.resolve(doNotTrack)
|
|
262
286
|
}
|
|
263
287
|
|
|
264
|
-
|
|
288
|
+
@ReactMethod
|
|
289
|
+
@DoNotStrip
|
|
290
|
+
fun playStories(options: ReadableMap, promise: Promise) {
|
|
265
291
|
try {
|
|
266
292
|
val dataSource = options.getMap(KEY_ENTRY_POINT_DATA_SOURCE)?.extractDataSource() ?: run {
|
|
267
293
|
promise.rejectWith("Error parsing data source for playStories")
|
|
@@ -280,7 +306,9 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
280
306
|
}
|
|
281
307
|
}
|
|
282
308
|
|
|
283
|
-
|
|
309
|
+
@ReactMethod
|
|
310
|
+
@DoNotStrip
|
|
311
|
+
fun playMoments(options: ReadableMap, promise: Promise) {
|
|
284
312
|
try {
|
|
285
313
|
val dataSource = options.getMap(KEY_ENTRY_POINT_DATA_SOURCE)?.extractDataSource() ?: run {
|
|
286
314
|
promise.rejectWith("Error parsing data source for playMoments")
|
|
@@ -299,7 +327,9 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
299
327
|
}
|
|
300
328
|
}
|
|
301
329
|
|
|
302
|
-
|
|
330
|
+
@ReactMethod
|
|
331
|
+
@DoNotStrip
|
|
332
|
+
fun handleUniversalLink(link: String, promise: Promise) {
|
|
303
333
|
try {
|
|
304
334
|
BlazeSDK.handleUniversalLink(link){ result ->
|
|
305
335
|
promise.handleResult(result)
|
|
@@ -309,7 +339,9 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
309
339
|
}
|
|
310
340
|
}
|
|
311
341
|
|
|
312
|
-
|
|
342
|
+
@ReactMethod
|
|
343
|
+
@DoNotStrip
|
|
344
|
+
fun canHandleUniversalLink(link: String, promise: Promise) {
|
|
313
345
|
try {
|
|
314
346
|
val canHandle = BlazeSDK.canHandleUniversalLink(link)
|
|
315
347
|
promise.resolve(canHandle)
|
|
@@ -318,7 +350,9 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
318
350
|
}
|
|
319
351
|
}
|
|
320
352
|
|
|
321
|
-
|
|
353
|
+
@ReactMethod
|
|
354
|
+
@DoNotStrip
|
|
355
|
+
fun updateGeoRestriction(geoLocation: String?, promise: Promise) {
|
|
322
356
|
val updatedGeoLocation = if (geoLocation.isNullOrEmpty()) null else geoLocation
|
|
323
357
|
try {
|
|
324
358
|
BlazeSDK.updateGeoRestriction(updatedGeoLocation){ result ->
|
|
@@ -329,7 +363,9 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
329
363
|
}
|
|
330
364
|
}
|
|
331
365
|
|
|
332
|
-
|
|
366
|
+
@ReactMethod
|
|
367
|
+
@DoNotStrip
|
|
368
|
+
fun canHandlePushNotification(payload: ReadableMap, promise: Promise) {
|
|
333
369
|
try {
|
|
334
370
|
// This is needed for now since the Android SDK requires <String, String>. Remove if it changes.
|
|
335
371
|
val hashMap = payload.toHashMap() as HashMap<String, String>
|
|
@@ -340,7 +376,9 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
340
376
|
}
|
|
341
377
|
}
|
|
342
378
|
|
|
343
|
-
|
|
379
|
+
@ReactMethod
|
|
380
|
+
@DoNotStrip
|
|
381
|
+
fun handleNotificationPayload(payload: ReadableMap, promise: Promise) {
|
|
344
382
|
try {
|
|
345
383
|
// This is needed for now since the Android SDK requires <String, String>. Remove if it changes.
|
|
346
384
|
val hashMap = payload.toHashMap() as HashMap<String, String>
|
|
@@ -353,6 +391,8 @@ class BlazeSdkModule(private val context: ReactApplicationContext): NativeBlazeS
|
|
|
353
391
|
}
|
|
354
392
|
|
|
355
393
|
companion object {
|
|
394
|
+
const val NAME = "RTNBlazeSdk"
|
|
395
|
+
|
|
356
396
|
val TAG: String = BlazeSdkModule::class.java.simpleName
|
|
357
397
|
|
|
358
398
|
const val KEY_INIT_API_KEY = "apiKey"
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
package com.blaze.rtnblazesdk
|
|
2
2
|
|
|
3
|
+
import com.blaze.rtnblazesdk.moments.BlazeMomentsGridViewManager
|
|
4
|
+
import com.blaze.rtnblazesdk.moments.BlazeMomentsRowViewManager
|
|
5
|
+
import com.blaze.rtnblazesdk.stories.BlazeStoriesGridViewManager
|
|
6
|
+
import com.blaze.rtnblazesdk.stories.BlazeStoriesRowViewManager
|
|
3
7
|
import com.facebook.react.ReactPackage
|
|
4
8
|
import com.facebook.react.bridge.NativeModule
|
|
5
9
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
@@ -13,12 +13,10 @@ import com.blaze.blazesdk.delegates.models.BlazePlayerType
|
|
|
13
13
|
import com.blaze.blazesdk.extentions.blazeDeepCopy
|
|
14
14
|
import com.blaze.blazesdk.features.shared.models.ui_shared.BlazeLinkActionHandleType
|
|
15
15
|
import com.blaze.blazesdk.prefetch.models.BlazeCachingLevel
|
|
16
|
-
import com.blaze.blazesdk.shared.BlazeSDK
|
|
17
16
|
import com.blaze.blazesdk.shared.results.BlazeResult
|
|
18
17
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemCustomMapping
|
|
19
18
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemStyleOverrides
|
|
20
19
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetLayout
|
|
21
|
-
import com.blaze.rtnblazesdk.BlazeSdkModule
|
|
22
20
|
import com.blaze.rtnblazesdk.BlazeSdkModuleRepo
|
|
23
21
|
import com.blaze.rtnblazesdk.customization.BlazeReactWidgetItemCustomMapping
|
|
24
22
|
import com.blaze.rtnblazesdk.customization.BlazeReactWidgetItemStyleOverrides
|
|
@@ -27,6 +25,7 @@ import com.blaze.rtnblazesdk.events.BaseEvent
|
|
|
27
25
|
import com.blaze.rtnblazesdk.events.WidgetCTAClickEvent
|
|
28
26
|
import com.blaze.rtnblazesdk.events.WidgetDataLoadCompletedEvent
|
|
29
27
|
import com.blaze.rtnblazesdk.events.WidgetDataLoadStartedEvent
|
|
28
|
+
import com.blaze.rtnblazesdk.events.WidgetHeightChangedEvent
|
|
30
29
|
import com.blaze.rtnblazesdk.events.WidgetItemClickedEvent
|
|
31
30
|
import com.blaze.rtnblazesdk.events.WidgetOnPlayerEventTriggered
|
|
32
31
|
import com.blaze.rtnblazesdk.events.WidgetOnTriggerPlayerBodyTextLinkEvent
|
|
@@ -188,6 +187,16 @@ abstract class BaseWidgetView @JvmOverloads constructor(
|
|
|
188
187
|
abstract fun updateWidgetsUi()
|
|
189
188
|
abstract fun play()
|
|
190
189
|
|
|
190
|
+
override fun onHeightChanged(height: Int) {
|
|
191
|
+
dispatchEvent(
|
|
192
|
+
WidgetHeightChangedEvent(
|
|
193
|
+
UIManagerHelper.getSurfaceId(context),
|
|
194
|
+
id,
|
|
195
|
+
newHeight = height,
|
|
196
|
+
)
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
|
|
191
200
|
override fun onAttachedToWindow() {
|
|
192
201
|
super.onAttachedToWindow()
|
|
193
202
|
createWidgetAndAddToParent()
|
|
@@ -233,13 +242,11 @@ abstract class BaseWidgetView @JvmOverloads constructor(
|
|
|
233
242
|
}
|
|
234
243
|
|
|
235
244
|
fun updateDataSourceFromArgs(args: ReadableArray) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
updateWidgetDataSource(sourceType = sourceType, isSilentRefresh = isSilentRefresh)
|
|
242
|
-
}
|
|
245
|
+
val dataSourceMap = args.getMap(ARG_INDEX_DATA_SOURCE_MAP) ?: return
|
|
246
|
+
dataSourceMap.extractDataSource()?.let { sourceType ->
|
|
247
|
+
dataSourceType = sourceType
|
|
248
|
+
val isSilentRefresh = args.getBooleanOrNull(ARG_INDEX_UPDATE_DATA_SOURCE_IS_SILENT_REFRESH) ?: false
|
|
249
|
+
updateWidgetDataSource(sourceType = sourceType, isSilentRefresh = isSilentRefresh)
|
|
243
250
|
}
|
|
244
251
|
}
|
|
245
252
|
|
|
@@ -266,12 +273,7 @@ abstract class BaseWidgetView @JvmOverloads constructor(
|
|
|
266
273
|
}
|
|
267
274
|
|
|
268
275
|
fun onPropsUpdate(props: ReactStylesDiffMap) {
|
|
269
|
-
//
|
|
270
|
-
// So make sure to update it again then reloadData with shimmer.
|
|
271
|
-
dataSourceType?.let {
|
|
272
|
-
callInitWidget(it)
|
|
273
|
-
reloadData(false)
|
|
274
|
-
}
|
|
276
|
+
// Currently we don't do anything here.
|
|
275
277
|
}
|
|
276
278
|
|
|
277
279
|
protected fun dispatchEvent(e: BaseEvent<*>) {
|
|
@@ -306,7 +308,7 @@ abstract class BaseWidgetView @JvmOverloads constructor(
|
|
|
306
308
|
|
|
307
309
|
val customizationMap = rawLayout.toHashMap().mapNotNull { (key, value) ->
|
|
308
310
|
val keyObj = key.fromJsonString<BlazeReactWidgetItemCustomMapping>()
|
|
309
|
-
val valueObj = value
|
|
311
|
+
val valueObj = value?.toObject<BlazeReactWidgetItemStyleOverrides>()
|
|
310
312
|
if (keyObj != null && valueObj != null) {
|
|
311
313
|
keyObj to valueObj
|
|
312
314
|
} else {
|
|
@@ -5,8 +5,7 @@ import android.util.AttributeSet
|
|
|
5
5
|
import android.view.View
|
|
6
6
|
import android.view.ViewGroup
|
|
7
7
|
import android.widget.FrameLayout
|
|
8
|
-
import com.
|
|
9
|
-
import com.facebook.react.uimanager.UIManagerModule
|
|
8
|
+
import com.blaze.rtnblazesdk.extensions.convertPixelsToDp
|
|
10
9
|
|
|
11
10
|
abstract class BlazeReactSizeFixingFrameLayout @JvmOverloads constructor(
|
|
12
11
|
context: Context,
|
|
@@ -48,7 +47,7 @@ abstract class BlazeReactSizeFixingFrameLayout @JvmOverloads constructor(
|
|
|
48
47
|
|
|
49
48
|
currentHeight = measuredHeight
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
updateHeight(height = measuredHeight)
|
|
52
51
|
disableNestedScrolling(this) // disable nested scrolling
|
|
53
52
|
}
|
|
54
53
|
|
|
@@ -74,26 +73,20 @@ abstract class BlazeReactSizeFixingFrameLayout @JvmOverloads constructor(
|
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
|
|
76
|
+
abstract fun onHeightChanged(height: Int)
|
|
77
|
+
|
|
77
78
|
/**
|
|
78
|
-
* All native views are backed by a ReactShadowNode in React Native -
|
|
79
|
-
* which is an wrapper view that is measured based on the native view.
|
|
80
79
|
*
|
|
81
80
|
* For grid views, we need to calculate their height manually
|
|
82
|
-
* and send the value to the React Native
|
|
81
|
+
* and send the value to the React Native side -
|
|
83
82
|
* because they have dynamic data and therefore dynamic height.
|
|
84
83
|
*
|
|
85
84
|
* React Native can then measure the backing view correctly.
|
|
86
85
|
*
|
|
87
86
|
* @see <a href="https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java#L133">createShadowNodeInstance</a>
|
|
88
87
|
*/
|
|
89
|
-
private fun
|
|
90
|
-
val
|
|
91
|
-
|
|
92
|
-
val uiManager = reactContext.getNativeModule(UIManagerModule::class.java) ?: return@runOnNativeModulesQueueThread
|
|
93
|
-
reactContext.runOnUiQueueThread {
|
|
94
|
-
uiManager.setViewLocalData(id, height) //dispatch height data to shadow node
|
|
95
|
-
requestLayout()
|
|
96
|
-
}
|
|
97
|
-
}
|
|
88
|
+
private fun updateHeight(height: Int) {
|
|
89
|
+
val dpHeight = context.convertPixelsToDp(height).toInt()
|
|
90
|
+
onHeightChanged(dpHeight)
|
|
98
91
|
}
|
|
99
|
-
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
package com.blaze.rtnblazesdk.base
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Keep
|
|
4
|
+
import com.blaze.rtnblazesdk.events.WidgetCTAClickEvent
|
|
5
|
+
import com.blaze.rtnblazesdk.events.WidgetDataLoadCompletedEvent
|
|
6
|
+
import com.blaze.rtnblazesdk.events.WidgetDataLoadStartedEvent
|
|
7
|
+
import com.blaze.rtnblazesdk.events.WidgetHeightChangedEvent
|
|
8
|
+
import com.blaze.rtnblazesdk.events.WidgetItemClickedEvent
|
|
9
|
+
import com.blaze.rtnblazesdk.events.WidgetOnPlayerEventTriggered
|
|
10
|
+
import com.blaze.rtnblazesdk.events.WidgetOnTriggerPlayerBodyTextLinkEvent
|
|
11
|
+
import com.blaze.rtnblazesdk.events.WidgetPlayerDidAppearEvent
|
|
12
|
+
import com.blaze.rtnblazesdk.events.WidgetPlayerDismissedEvent
|
|
13
|
+
import com.blaze.rtnblazesdk.stories.BlazeStoriesGridView
|
|
14
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
15
|
+
import com.facebook.react.bridge.ReadableArray
|
|
16
|
+
import com.facebook.react.bridge.ReadableMap
|
|
17
|
+
import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
18
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
19
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
20
|
+
|
|
21
|
+
abstract class BlazeWidgetViewManager<TWidget : BaseWidgetView>(
|
|
22
|
+
context: ReactApplicationContext?,
|
|
23
|
+
) : SimpleViewManager<TWidget>() {
|
|
24
|
+
|
|
25
|
+
override fun receiveCommand(view: TWidget, commandId: Int, args: ReadableArray?) {
|
|
26
|
+
when (commandId) {
|
|
27
|
+
COMMAND_RELOAD_DATA_ID -> args?.let { view.getIsSilentRefreshAndReloadData(it) }
|
|
28
|
+
COMMAND_UPDATE_DATA_SOURCE_ID -> args?.let { view.updateDataSourceFromArgs(it) }
|
|
29
|
+
COMMAND_PLAY_WIDGET_ID -> view.play()
|
|
30
|
+
COMMAND_UPDATE_OVERRIDE_STYLES_ID -> args?.let { view.updateOverrideStylesFromArgs(it) }
|
|
31
|
+
COMMAND_UPDATE_WIDGETS_UI_ID -> view.updateWidgetsUi()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any>? {
|
|
36
|
+
val map: Map<String, Any> = mapOf(
|
|
37
|
+
WidgetDataLoadStartedEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onWidgetDataLoadStartedInternal")),
|
|
38
|
+
WidgetDataLoadCompletedEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onWidgetDataLoadCompletedInternal")),
|
|
39
|
+
WidgetPlayerDidAppearEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onWidgetPlayerDidAppearInternal")),
|
|
40
|
+
WidgetPlayerDismissedEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onWidgetPlayerDismissedInternal")),
|
|
41
|
+
WidgetItemClickedEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onItemClickedInternal")),
|
|
42
|
+
WidgetCTAClickEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onTriggerCTAInternal")),
|
|
43
|
+
WidgetOnTriggerPlayerBodyTextLinkEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onTriggerPlayerBodyTextLinkInternal")),
|
|
44
|
+
WidgetOnPlayerEventTriggered.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onPlayerEventTriggeredInternal")),
|
|
45
|
+
WidgetHeightChangedEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onHeightChangedInternal")),
|
|
46
|
+
)
|
|
47
|
+
return map
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
companion object {
|
|
51
|
+
const val COMMAND_RELOAD_DATA = "reloadData"
|
|
52
|
+
const val COMMAND_UPDATE_DATA_SOURCE = "updateDataSource"
|
|
53
|
+
const val COMMAND_PLAY_WIDGET = "play"
|
|
54
|
+
const val KEY_EVENT_REGISTRATION_NAME = "registrationName"
|
|
55
|
+
const val COMMAND_UPDATE_OVERRIDE_STYLES = "updateOverrideStyles"
|
|
56
|
+
const val COMMAND_UPDATE_WIDGETS_UI = "updateWidgetsUi"
|
|
57
|
+
|
|
58
|
+
//COMMAND IDs
|
|
59
|
+
const val COMMAND_RELOAD_DATA_ID = 0
|
|
60
|
+
const val COMMAND_UPDATE_DATA_SOURCE_ID = 1
|
|
61
|
+
const val COMMAND_PLAY_WIDGET_ID = 2
|
|
62
|
+
const val COMMAND_UPDATE_OVERRIDE_STYLES_ID = 3
|
|
63
|
+
const val COMMAND_UPDATE_WIDGETS_UI_ID = 4
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
override fun getCommandsMap(): MutableMap<String, Int> {
|
|
67
|
+
return mutableMapOf(
|
|
68
|
+
COMMAND_RELOAD_DATA to COMMAND_RELOAD_DATA_ID,
|
|
69
|
+
COMMAND_UPDATE_DATA_SOURCE to COMMAND_UPDATE_DATA_SOURCE_ID,
|
|
70
|
+
COMMAND_PLAY_WIDGET to COMMAND_PLAY_WIDGET_ID,
|
|
71
|
+
COMMAND_UPDATE_OVERRIDE_STYLES to COMMAND_UPDATE_OVERRIDE_STYLES_ID,
|
|
72
|
+
COMMAND_UPDATE_WIDGETS_UI to COMMAND_UPDATE_WIDGETS_UI_ID,
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
override fun updateProperties(viewToUpdate: TWidget, props: ReactStylesDiffMap) {
|
|
77
|
+
super.updateProperties(viewToUpdate, props)
|
|
78
|
+
viewToUpdate.onPropsUpdate(props)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//---------- Shared props ----------//
|
|
82
|
+
|
|
83
|
+
@Keep
|
|
84
|
+
@ReactProp(name = "dataSource")
|
|
85
|
+
fun setDataSource(view: TWidget, value: ReadableMap?) {
|
|
86
|
+
view.setDataSourceTypeFromMap(value)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@Keep
|
|
90
|
+
@ReactProp(name = "presetWidgetLayout")
|
|
91
|
+
fun setPresetWidgetLayout(view: TWidget, value: String?) {
|
|
92
|
+
view.presetWidgetLayoutString = value
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@Keep
|
|
96
|
+
@ReactProp(name = "appOverridesCTAHandling")
|
|
97
|
+
fun setAppOverridesCTAHandling(view: TWidget, value: Boolean) {
|
|
98
|
+
view.appOverridesCTAHandling = value
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Keep
|
|
102
|
+
@ReactProp(name = "blazeWidgetLayout")
|
|
103
|
+
fun setBlazeWidgetLayout(view: TWidget, value: ReadableMap?) {
|
|
104
|
+
view.reactWidgetLayoutStyleMap = value
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@Keep
|
|
108
|
+
@ReactProp(name = "shouldOrderWidgetByReadStatus")
|
|
109
|
+
fun setShouldOrderWidgetByReadStatus(view: TWidget, value: Boolean) {
|
|
110
|
+
view.shouldOrderWidgetByReadStatus = value
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@Keep
|
|
114
|
+
@ReactProp(name = "perItemStyleOverridesInternal")
|
|
115
|
+
fun setPerItemStyleOverrides(view: TWidget, value: ReadableMap?) {
|
|
116
|
+
view.perItemStyleOverridesReadableMap = value
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@Keep
|
|
120
|
+
@ReactProp(name = "cachingLevel")
|
|
121
|
+
fun setCachingLevel(view: TWidget, value: String?) {
|
|
122
|
+
view.reactCachingLevel = value
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
//---------- Props for Grids ----------//
|
|
126
|
+
|
|
127
|
+
@Keep
|
|
128
|
+
@ReactProp(name = "isEmbeddedInScrollView")
|
|
129
|
+
fun setIsEmbeddedInScrollView(view: TWidget, value: Boolean) {
|
|
130
|
+
view.isEmbeddedInScrollView = value
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
//---------- Props for Moment widget ----------//
|
|
134
|
+
|
|
135
|
+
@Keep
|
|
136
|
+
@ReactProp(name = "blazeMomentsPlayerStyle")
|
|
137
|
+
fun setBlazeMomentsPlayerStyle(view: TWidget, value: ReadableMap?) {
|
|
138
|
+
view.reactWidgetPlayerStyleMap = value
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
//---------- Props for Story widget ----------//
|
|
142
|
+
|
|
143
|
+
@Keep
|
|
144
|
+
@ReactProp(name = "blazeStoryPlayerStyle")
|
|
145
|
+
fun setBlazeStoryPlayerStyle(view: TWidget, value: ReadableMap?) {
|
|
146
|
+
view.reactWidgetPlayerStyleMap = value
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
}
|
|
@@ -11,6 +11,7 @@ import BlazeReactWidgetItemBadgeStyle
|
|
|
11
11
|
import BlazeReactWidgetItemImageAnimatedThumbnailStyle
|
|
12
12
|
import BlazeReactWidgetItemImageContainerBorderStateStyle
|
|
13
13
|
import BlazeReactWidgetItemImageContainerBorderStyle
|
|
14
|
+
import BlazeReactWidgetItemImageGradientOverlayStyle
|
|
14
15
|
import BlazeReactWidgetItemImagePosition
|
|
15
16
|
import BlazeReactWidgetItemImageStyle
|
|
16
17
|
import BlazeReactWidgetItemStatusIndicatorStateStyle
|
|
@@ -28,6 +29,7 @@ import com.blaze.blazesdk.style.widgets.BlazeWidgetItemBadgeStyle
|
|
|
28
29
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemImageAnimatedThumbnailStyle
|
|
29
30
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemImageContainerBorderStateStyle
|
|
30
31
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemImageContainerBorderStyle
|
|
32
|
+
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemImageGradientOverlayStyle
|
|
31
33
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemImageStyle
|
|
32
34
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemStatusIndicatorStateStyle
|
|
33
35
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemStatusIndicatorStyle
|
|
@@ -36,7 +38,6 @@ import com.blaze.blazesdk.style.widgets.BlazeWidgetItemTextStyle
|
|
|
36
38
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemTitleStyle
|
|
37
39
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetLayout
|
|
38
40
|
|
|
39
|
-
|
|
40
41
|
fun BlazeWidgetLayout.mergedWith(
|
|
41
42
|
customization: BlazeReactWidgetLayout?,
|
|
42
43
|
context: Context
|
|
@@ -53,7 +54,6 @@ fun BlazeWidgetLayout.mergedWith(
|
|
|
53
54
|
merged.maxDisplayItemsCount = customization.maxDisplayItemsCount ?: merged.maxDisplayItemsCount
|
|
54
55
|
merged.widgetItemStyle =
|
|
55
56
|
this.widgetItemStyle.mergedWith(customization.widgetItemStyle, context)
|
|
56
|
-
merged.isScrollEnabled = customization.isScrollEnabled ?: merged.isScrollEnabled
|
|
57
57
|
merged.margins = this.margins.mergedWith(customization.margins)
|
|
58
58
|
return merged
|
|
59
59
|
}
|
|
@@ -255,9 +255,34 @@ fun BlazeWidgetItemImageStyle.mergedWith(customization: BlazeReactWidgetItemImag
|
|
|
255
255
|
customization.thumbnailType?.let { merged.thumbnailType = it.mapToBlazeEnumClass() }
|
|
256
256
|
merged.margins = this.margins.mergedWith(customization.margins)
|
|
257
257
|
merged.animatedThumbnail = this.animatedThumbnail.mergedWith(customization.animatedThumbnail)
|
|
258
|
+
merged.gradientOverlay = this.gradientOverlay.mergedWith(customization.gradientOverlay)
|
|
259
|
+
|
|
260
|
+
return merged
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
fun BlazeWidgetItemImageGradientOverlayStyle.mergedWith(customization: BlazeReactWidgetItemImageGradientOverlayStyle?): BlazeWidgetItemImageGradientOverlayStyle {
|
|
264
|
+
customization ?: return this
|
|
265
|
+
|
|
266
|
+
val merged = this
|
|
267
|
+
merged.isVisible = customization.isVisible ?: merged.isVisible
|
|
268
|
+
merged.position = merged.position.mergedWith(customization.position)
|
|
269
|
+
|
|
270
|
+
// We switch between startColor and endColor to match the iOS implementation.
|
|
271
|
+
// If this is aligned on future Android version we must switch them back!
|
|
272
|
+
merged.startColor = safeParseColor(customization.endColor) ?: merged.startColor
|
|
273
|
+
merged.endColor = safeParseColor(customization.startColor) ?: merged.endColor
|
|
274
|
+
|
|
258
275
|
return merged
|
|
259
276
|
}
|
|
260
277
|
|
|
278
|
+
fun BlazeWidgetItemImageGradientOverlayStyle.BlazeGradientPosition.mergedWith(
|
|
279
|
+
customization: BlazeReactWidgetItemImageGradientOverlayStyle.Position?
|
|
280
|
+
): BlazeWidgetItemImageGradientOverlayStyle.BlazeGradientPosition {
|
|
281
|
+
customization ?: return this
|
|
282
|
+
|
|
283
|
+
return customization.mapToBlazeEnumClass()
|
|
284
|
+
}
|
|
285
|
+
|
|
261
286
|
fun BlazeWidgetItemImageAnimatedThumbnailStyle.mergedWith(customization: BlazeReactWidgetItemImageAnimatedThumbnailStyle?): BlazeWidgetItemImageAnimatedThumbnailStyle {
|
|
262
287
|
customization ?: return this
|
|
263
288
|
|
|
@@ -2,6 +2,7 @@ import android.view.Gravity
|
|
|
2
2
|
import androidx.annotation.Keep
|
|
3
3
|
import com.blaze.blazesdk.style.shared.models.BlazeObjectXPosition
|
|
4
4
|
import com.blaze.blazesdk.style.shared.models.BlazeObjectYPosition
|
|
5
|
+
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemImageGradientOverlayStyle
|
|
5
6
|
import com.blaze.blazesdk.style.widgets.BlazeWidgetItemImageStyle
|
|
6
7
|
import com.blaze.rtnblazesdk.customization.BlazeEnumMapper
|
|
7
8
|
|
|
@@ -73,9 +74,31 @@ data class BlazeReactWidgetItemImageStyle(
|
|
|
73
74
|
val border: BlazeReactWidgetItemImageContainerBorderStyle?,
|
|
74
75
|
val thumbnailType: BlazeReactThumbnailType?,
|
|
75
76
|
val margins: BlazeReactMargins?,
|
|
76
|
-
val animatedThumbnail: BlazeReactWidgetItemImageAnimatedThumbnailStyle
|
|
77
|
+
val animatedThumbnail: BlazeReactWidgetItemImageAnimatedThumbnailStyle?,
|
|
78
|
+
val gradientOverlay: BlazeReactWidgetItemImageGradientOverlayStyle?
|
|
77
79
|
)
|
|
78
80
|
|
|
81
|
+
@Keep
|
|
82
|
+
data class BlazeReactWidgetItemImageGradientOverlayStyle(
|
|
83
|
+
val isVisible: Boolean?,
|
|
84
|
+
val position: Position?,
|
|
85
|
+
val startColor: String?,
|
|
86
|
+
val endColor: String?
|
|
87
|
+
) {
|
|
88
|
+
@Keep
|
|
89
|
+
enum class Position(override val rawValue: String) : BlazeEnumMapper<BlazeWidgetItemImageGradientOverlayStyle.BlazeGradientPosition> {
|
|
90
|
+
TOP("Top") {
|
|
91
|
+
override fun mapToBlazeEnumClass() = BlazeWidgetItemImageGradientOverlayStyle.BlazeGradientPosition.TOP
|
|
92
|
+
},
|
|
93
|
+
CENTER("Center") {
|
|
94
|
+
override fun mapToBlazeEnumClass() = BlazeWidgetItemImageGradientOverlayStyle.BlazeGradientPosition.CENTER
|
|
95
|
+
},
|
|
96
|
+
Bottom("Bottom") {
|
|
97
|
+
override fun mapToBlazeEnumClass() = BlazeWidgetItemImageGradientOverlayStyle.BlazeGradientPosition.BOTTOM
|
|
98
|
+
},
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
79
102
|
@Keep
|
|
80
103
|
data class BlazeReactWidgetItemImageContainerBorderStyle(
|
|
81
104
|
val isVisible: Boolean?,
|
|
@@ -255,6 +278,5 @@ data class BlazeReactWidgetLayout(
|
|
|
255
278
|
val columns: Int?,
|
|
256
279
|
val maxDisplayItemsCount: Int?,
|
|
257
280
|
val widgetItemStyle: BlazeReactWidgetItemStyle?,
|
|
258
|
-
val margins: BlazeReactMargins
|
|
259
|
-
val isScrollEnabled: Boolean?
|
|
281
|
+
val margins: BlazeReactMargins?
|
|
260
282
|
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.blaze.rtnblazesdk.events
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Arguments
|
|
4
|
+
import com.facebook.react.bridge.WritableMap
|
|
5
|
+
|
|
6
|
+
class WidgetHeightChangedEvent(
|
|
7
|
+
surfaceId: Int,
|
|
8
|
+
viewTag: Int,
|
|
9
|
+
val newHeight: Int,
|
|
10
|
+
) : BaseEvent<WidgetHeightChangedEvent>(surfaceId, viewTag) {
|
|
11
|
+
companion object {
|
|
12
|
+
// The name just needs to be unique, the way it's called on the React side is defined elsewhere.
|
|
13
|
+
const val EVENT_NAME = "Blaze.WidgetHeightChangedEvent"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override fun getEventName(): String {
|
|
17
|
+
return EVENT_NAME
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
override fun getEventData(): WritableMap? {
|
|
21
|
+
val params = Arguments.createMap()
|
|
22
|
+
params.putInt("newHeight", newHeight)
|
|
23
|
+
return params
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package com.blaze.rtnblazesdk.extensions
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import kotlin.math.roundToInt
|
|
5
|
+
|
|
6
|
+
internal fun Context.convertDpToPx(dp: Int): Int {
|
|
7
|
+
val screenPixelDensity = resources.displayMetrics.density
|
|
8
|
+
return (dp * screenPixelDensity).roundToInt()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
internal fun Context.convertDpToPx(dp: Float): Float {
|
|
12
|
+
val screenPixelDensity = resources.displayMetrics.density
|
|
13
|
+
return (dp * screenPixelDensity)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
internal fun Context.convertPixelsToDp(pixels: Int): Float {
|
|
17
|
+
val screenPixelDensity = resources.displayMetrics.density
|
|
18
|
+
return (pixels / screenPixelDensity)
|
|
19
|
+
}
|