react-native-firework-sdk 2.14.2 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +14 -4
- package/android/src/main/java/com/fireworksdk/bridge/models/FWActionButtonDeserializer.kt +27 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWActionButtonModel.kt +8 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWActionButtonSerializer.kt +21 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamEventDetailsModel.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWPlayerButtonConfigurationDeserializer.kt +3 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWPlayerButtonConfigurationModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWPlayerButtonConfigurationSerializer.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWShape.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +6 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +23 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +14 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +3 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWLivestreamPlayerVersion.kt +6 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +4 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +3 -3
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +14 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +156 -3
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +6 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +32 -0
- package/ios/Components/StoryBlock.swift +10 -2
- package/ios/Components/VideoFeed.swift +12 -29
- package/ios/Components/VideoFeedManager.swift +0 -5
- package/ios/Models/NativeToRN/FireworkEventName.swift +3 -1
- package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +13 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +42 -5
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +2 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +16 -0
- package/ios/Modules/Shopping/ShoppingModule.swift +1 -1
- package/lib/commonjs/FireworkSDK.js +41 -14
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +21 -0
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +23 -0
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +2 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/models/LivestreamPlayerDesignVersion.js +16 -0
- package/lib/commonjs/models/LivestreamPlayerDesignVersion.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +38 -14
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/components/StoryBlock.js +14 -0
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +18 -0
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +2 -0
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/models/LivestreamPlayerDesignVersion.js +9 -0
- package/lib/module/models/LivestreamPlayerDesignVersion.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +9 -2
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/models/FWEventName.d.ts +3 -1
- package/lib/typescript/models/LivestreamPlayerDesignVersion.d.ts +5 -0
- package/lib/typescript/models/StoryBlockConfiguration.d.ts +2 -7
- package/lib/typescript/modules/FireworkSDKModule.d.ts +3 -1
- package/package.json +1 -1
- package/react-native-firework-sdk.podspec +2 -2
- package/src/FireworkSDK.ts +44 -13
- package/src/components/StoryBlock.tsx +27 -1
- package/src/components/VideoFeed.tsx +29 -1
- package/src/index.ts +2 -0
- package/src/models/FWEventName.ts +2 -0
- package/src/models/LivestreamPlayerDesignVersion.ts +6 -0
- package/src/models/StoryBlockConfiguration.ts +2 -7
- package/src/modules/FireworkSDKModule.ts +5 -1
|
@@ -11,19 +11,35 @@ import com.firework.common.ad.AdBadgeTextType
|
|
|
11
11
|
import com.firework.common.ad.AdOption
|
|
12
12
|
import com.firework.common.cta.CtaDelay
|
|
13
13
|
import com.firework.common.cta.CtaDelayUnit
|
|
14
|
+
import com.firework.common.cta.CtaStyle
|
|
14
15
|
import com.firework.common.feed.FeedLayout
|
|
15
16
|
import com.firework.common.feed.FeedResource
|
|
16
17
|
import com.firework.common.feed.FeedTitlePosition
|
|
18
|
+
import com.firework.common.player.ActionButtonOption
|
|
17
19
|
import com.firework.common.player.CloseButtonOption
|
|
18
20
|
import com.firework.common.player.LivestreamCountDownOption
|
|
19
21
|
import com.firework.common.player.MuteButtonOption
|
|
22
|
+
import com.firework.common.player.PipButtonOption
|
|
20
23
|
import com.firework.common.player.PlaybackButtonOption
|
|
21
24
|
import com.firework.common.player.PlayerUiOption
|
|
22
25
|
import com.firework.common.player.VideoDetailsOption
|
|
26
|
+
import com.firework.common.widget.ActionButton
|
|
27
|
+
import com.firework.common.widget.Shape
|
|
23
28
|
import com.firework.common.widget.WidgetImage
|
|
24
|
-
import com.firework.viewoptions
|
|
29
|
+
import com.firework.viewoptions.BaseOption
|
|
30
|
+
import com.firework.viewoptions.CtaOption
|
|
31
|
+
import com.firework.viewoptions.LayoutOption
|
|
32
|
+
import com.firework.viewoptions.LogoConfig
|
|
33
|
+
import com.firework.viewoptions.PlayerOption
|
|
34
|
+
import com.firework.viewoptions.StoryBlockOption
|
|
35
|
+
import com.firework.viewoptions.TitleOption
|
|
36
|
+
import com.firework.viewoptions.ViewOptions
|
|
25
37
|
import com.fireworksdk.bridge.FWInitializationProvider
|
|
26
|
-
import com.fireworksdk.bridge.models
|
|
38
|
+
import com.fireworksdk.bridge.models.FWAdConfigurationModel
|
|
39
|
+
import com.fireworksdk.bridge.models.FWButtonInfoModel
|
|
40
|
+
import com.fireworksdk.bridge.models.FWFontInfoModel
|
|
41
|
+
import com.fireworksdk.bridge.models.FWShape
|
|
42
|
+
import com.fireworksdk.bridge.models.FWVideoFeedPropsModel
|
|
27
43
|
import com.fireworksdk.bridge.models.enums.FWAppearanceMode
|
|
28
44
|
import com.fireworksdk.bridge.models.enums.FWBadgeTextType
|
|
29
45
|
import com.fireworksdk.bridge.models.enums.FWCtaDelayType
|
|
@@ -49,6 +65,7 @@ object FWConfigUtil {
|
|
|
49
65
|
val playerUiOptionBuilder = getDefaultPlayerUiOptionBuilder()
|
|
50
66
|
val videoDetailsOptionBuilder = getDefaultVideoDetailsOptionBuilder()
|
|
51
67
|
val closeButtonOptionBuilder = getDefaultCloseButtonOptionBuilder()
|
|
68
|
+
val pipButtonOptionBuilder = getDefaultPipButtonOptionBuilder()
|
|
52
69
|
val muteButtonOptionBuilder = getDefaultMuteButtonOptionBuilder()
|
|
53
70
|
val playbackButtonOptionBuilder = getDefaultPlaybackButtonOptionBuilder()
|
|
54
71
|
val baseOptionBuilder = getDefaultBaseOptionBuilder()
|
|
@@ -56,6 +73,8 @@ object FWConfigUtil {
|
|
|
56
73
|
val ctaOptionBuilder = getDefaultCtaOptionBuilder()
|
|
57
74
|
val adOptionBuilder = getDefaultAdOptionBuilder()
|
|
58
75
|
val countDownOptionBuilder = getDefaultPlayerCountdownTimerOptionBuilder()
|
|
76
|
+
val actionButtonOption = getDefaultActionButtonOptionBuilder()
|
|
77
|
+
val storyblockOptionBuilder = getDefaultStoryblockOptionBuilder()
|
|
59
78
|
|
|
60
79
|
when (videoFeedPropsModel.source) {
|
|
61
80
|
FWVideoFeedSource.Discover -> {
|
|
@@ -323,6 +342,117 @@ object FWConfigUtil {
|
|
|
323
342
|
else -> {}
|
|
324
343
|
}
|
|
325
344
|
|
|
345
|
+
val ctaButtonStyle = videoFeedPropsModel.videoPlayerConfiguration?.ctaButtonStyle
|
|
346
|
+
ctaButtonStyle?.let { style ->
|
|
347
|
+
val background = if (!style.backgroundColor.isNullOrBlank()) {
|
|
348
|
+
FWColorUtil.parseColor(style.backgroundColor)
|
|
349
|
+
} else {
|
|
350
|
+
null
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
val fontSize = if (style.fontSize != null && style.fontSize > 0) {
|
|
354
|
+
FWCommonUtil.spToPx(style.fontSize.toFloat(), context).toFloat()
|
|
355
|
+
} else {
|
|
356
|
+
null
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
val textColor = if (!style.textColor.isNullOrBlank()) {
|
|
360
|
+
FWColorUtil.parseColor(style.textColor)
|
|
361
|
+
} else {
|
|
362
|
+
null
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
val shape = when (style.shape) {
|
|
366
|
+
FWShape.ROUND_RECTANGLE -> {
|
|
367
|
+
Shape.SHAPE_ROUND_RECTANGLE
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
FWShape.OVAL -> {
|
|
371
|
+
Shape.SHAPE_OVAL
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
else -> null
|
|
375
|
+
}
|
|
376
|
+
ctaOptionBuilder.ctaStyle(CtaStyle(
|
|
377
|
+
shape = shape,
|
|
378
|
+
backgroundColor = background,
|
|
379
|
+
textColor = textColor,
|
|
380
|
+
fontSize = fontSize
|
|
381
|
+
))
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
val actionButtonStyle = videoFeedPropsModel.videoPlayerConfiguration?.actionButtonStyle
|
|
385
|
+
actionButtonStyle?.let { style ->
|
|
386
|
+
val background = if (!style.backgroundColor.isNullOrBlank()) {
|
|
387
|
+
FWColorUtil.parseColor(style.backgroundColor)
|
|
388
|
+
} else {
|
|
389
|
+
null
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
val textColor = if (!style.textColor.isNullOrBlank()) {
|
|
393
|
+
FWColorUtil.parseColor(style.textColor)
|
|
394
|
+
} else {
|
|
395
|
+
null
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
val dividingLineColor = if (!style.dividingLineColor.isNullOrBlank()) {
|
|
399
|
+
FWColorUtil.parseColor(style.dividingLineColor)
|
|
400
|
+
} else {
|
|
401
|
+
null
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
val shape = when (style.shape) {
|
|
405
|
+
FWShape.ROUND_RECTANGLE -> {
|
|
406
|
+
Shape.SHAPE_ROUND_RECTANGLE
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
FWShape.OVAL -> {
|
|
410
|
+
Shape.SHAPE_OVAL
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
else -> null
|
|
414
|
+
}
|
|
415
|
+
actionButtonOption.actionButton(ActionButton(
|
|
416
|
+
backgroundColor = background,
|
|
417
|
+
textColor = textColor,
|
|
418
|
+
shape = shape,
|
|
419
|
+
dividingLineColor = dividingLineColor
|
|
420
|
+
))
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
val cancelButtonStyle = videoFeedPropsModel.videoPlayerConfiguration?.cancelButtonStyle
|
|
424
|
+
cancelButtonStyle?.let { style ->
|
|
425
|
+
val background = if (!style.backgroundColor.isNullOrBlank()) {
|
|
426
|
+
FWColorUtil.parseColor(style.backgroundColor)
|
|
427
|
+
} else {
|
|
428
|
+
null
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
val textColor = if (!style.textColor.isNullOrBlank()) {
|
|
432
|
+
FWColorUtil.parseColor(style.textColor)
|
|
433
|
+
} else {
|
|
434
|
+
null
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
val shape = when (style.shape) {
|
|
438
|
+
FWShape.ROUND_RECTANGLE -> {
|
|
439
|
+
Shape.SHAPE_ROUND_RECTANGLE
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
FWShape.OVAL -> {
|
|
443
|
+
Shape.SHAPE_OVAL
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
else -> null
|
|
447
|
+
}
|
|
448
|
+
actionButtonOption.cancelButton(ActionButton(
|
|
449
|
+
backgroundColor = background,
|
|
450
|
+
textColor = textColor,
|
|
451
|
+
shape = shape,
|
|
452
|
+
))
|
|
453
|
+
}
|
|
454
|
+
playerOptionBuilder.actionButtonOption(actionButtonOption.build())
|
|
455
|
+
|
|
326
456
|
val ctaDelay = videoFeedPropsModel.videoPlayerConfiguration?.ctaDelay
|
|
327
457
|
ctaDelay?.let { delay ->
|
|
328
458
|
delay.value ?: return@let
|
|
@@ -368,7 +498,7 @@ object FWConfigUtil {
|
|
|
368
498
|
|
|
369
499
|
val showPlaybackButton = videoFeedPropsModel.videoPlayerConfiguration?.showPlaybackButton
|
|
370
500
|
showPlaybackButton?.let {
|
|
371
|
-
playerOptionBuilder.
|
|
501
|
+
playerOptionBuilder.showPlayPauseButtonInVideo(it)
|
|
372
502
|
}
|
|
373
503
|
|
|
374
504
|
val showBranding = videoFeedPropsModel.videoPlayerConfiguration?.showBranding
|
|
@@ -384,6 +514,7 @@ object FWConfigUtil {
|
|
|
384
514
|
val buttonConfiguration = videoFeedPropsModel.videoPlayerConfiguration?.buttonConfiguration
|
|
385
515
|
videoDetailsOptionBuilder.buttonIcon(getWidgetImage(context, buttonConfiguration?.videoDetailButton))
|
|
386
516
|
closeButtonOptionBuilder.icon(getWidgetImage(context, buttonConfiguration?.closeButton))
|
|
517
|
+
pipButtonOptionBuilder.icon(getWidgetImage(context, buttonConfiguration?.pipButton))
|
|
387
518
|
muteButtonOptionBuilder.muteIcon(getWidgetImage(context, buttonConfiguration?.muteButton))
|
|
388
519
|
.unmuteIcon(getWidgetImage(context, buttonConfiguration?.unmuteButton))
|
|
389
520
|
playbackButtonOptionBuilder.playIcon(getWidgetImage(context, buttonConfiguration?.playButton))
|
|
@@ -391,6 +522,7 @@ object FWConfigUtil {
|
|
|
391
522
|
|
|
392
523
|
playerUiOptionBuilder.videoDetailsOption(videoDetailsOptionBuilder.build())
|
|
393
524
|
.closeButtonOption(closeButtonOptionBuilder.build())
|
|
525
|
+
.pipButtonOption(pipButtonOptionBuilder.build())
|
|
394
526
|
.muteButtonOption(muteButtonOptionBuilder.build())
|
|
395
527
|
.playbackButtonOption(playbackButtonOptionBuilder.build())
|
|
396
528
|
playerOptionBuilder.playerUiOption(playerUiOptionBuilder.build())
|
|
@@ -425,6 +557,14 @@ object FWConfigUtil {
|
|
|
425
557
|
else -> {}
|
|
426
558
|
}
|
|
427
559
|
playerOptionBuilder.livestreamCountDownOption(countDownOptionBuilder.build())
|
|
560
|
+
videoFeedPropsModel.videoPlayerConfiguration?.enableAutoPlay?.let { enableAutoplayOnStoryblock ->
|
|
561
|
+
storyblockOptionBuilder.enableAutoPlay(enableAutoplayOnStoryblock)}
|
|
562
|
+
videoFeedPropsModel.videoPlayerConfiguration?.showFullScreenIcon?.let { showFullScreenIcon ->
|
|
563
|
+
storyblockOptionBuilder.showFullScreenIcon(showFullScreenIcon)}
|
|
564
|
+
videoFeedPropsModel.videoPlayerConfiguration?.enableAutoPause?.let { enableAutoPause ->
|
|
565
|
+
storyblockOptionBuilder.enableAutoPause(enableAutoPause)}
|
|
566
|
+
|
|
567
|
+
playerOptionBuilder.shareUrlCustomCallBack(FWGlobalDataUtil.customShareUrlCallback)
|
|
428
568
|
|
|
429
569
|
return ViewOptions.Builder()
|
|
430
570
|
.layoutOption(layoutOptionBuilder.build())
|
|
@@ -434,6 +574,11 @@ object FWConfigUtil {
|
|
|
434
574
|
.adBadgeOption(adBadgeOptionBuilder.build())
|
|
435
575
|
.ctaOption(ctaOptionBuilder.build())
|
|
436
576
|
.adOption(adOptionBuilder.build())
|
|
577
|
+
.storyBlockOption(storyblockOptionBuilder.build())
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
private fun getDefaultStoryblockOptionBuilder(): StoryBlockOption.Builder {
|
|
581
|
+
return StoryBlockOption.Builder()
|
|
437
582
|
}
|
|
438
583
|
|
|
439
584
|
private fun getDefaultLayoutOptionBuilder(): LayoutOption.Builder {
|
|
@@ -460,6 +605,10 @@ object FWConfigUtil {
|
|
|
460
605
|
return LivestreamCountDownOption.Builder()
|
|
461
606
|
}
|
|
462
607
|
|
|
608
|
+
private fun getDefaultActionButtonOptionBuilder(): ActionButtonOption.Builder {
|
|
609
|
+
return ActionButtonOption.Builder()
|
|
610
|
+
}
|
|
611
|
+
|
|
463
612
|
private fun getDefaultVideoDetailsOptionBuilder(): VideoDetailsOption.Builder {
|
|
464
613
|
return VideoDetailsOption.Builder()
|
|
465
614
|
}
|
|
@@ -468,6 +617,10 @@ object FWConfigUtil {
|
|
|
468
617
|
return CloseButtonOption.Builder()
|
|
469
618
|
}
|
|
470
619
|
|
|
620
|
+
private fun getDefaultPipButtonOptionBuilder(): PipButtonOption.Builder {
|
|
621
|
+
return PipButtonOption.Builder()
|
|
622
|
+
}
|
|
623
|
+
|
|
471
624
|
private fun getDefaultMuteButtonOptionBuilder(): MuteButtonOption.Builder {
|
|
472
625
|
return MuteButtonOption.Builder()
|
|
473
626
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.fireworksdk.bridge.utils
|
|
2
2
|
|
|
3
|
+
import com.firework.analyticsevents.VideoInfo
|
|
3
4
|
import com.fireworksdk.bridge.models.FWAdBadgeConfigModel
|
|
4
5
|
import com.fireworksdk.bridge.models.FWSdkInitResultModel
|
|
5
6
|
import com.fireworksdk.bridge.models.enums.FWSwitchLanguageBehavior
|
|
@@ -23,4 +24,9 @@ object FWGlobalDataUtil {
|
|
|
23
24
|
var switchLanguageBehavior = FWSwitchLanguageBehavior.RestartingActivity
|
|
24
25
|
|
|
25
26
|
var initCompletedListener: (() -> Unit)? = null
|
|
27
|
+
|
|
28
|
+
var customShareUrlCallbackEnabled: Boolean = false
|
|
29
|
+
|
|
30
|
+
var customShareUrlCallback: (suspend (String, VideoInfo) -> String)? = null
|
|
31
|
+
|
|
26
32
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.fireworksdk.bridge.utils
|
|
2
2
|
|
|
3
3
|
import com.firework.analyticsevents.VideoInfo
|
|
4
|
+
import com.firework.analyticsevents.VideoType
|
|
4
5
|
import com.firework.analyticsevents.cta.CtaButtonClickAnalyticsEvent
|
|
5
6
|
import com.firework.analyticsevents.player.PlayerLifecycleAnalyticsEvent
|
|
6
7
|
import com.firework.analyticsevents.share.ShareButtonAnalyticsEvent
|
|
@@ -8,6 +9,27 @@ import com.fireworksdk.bridge.models.FWLiveStreamEventDetailsModel
|
|
|
8
9
|
import com.fireworksdk.bridge.models.FWVideoPlaybackDetails
|
|
9
10
|
|
|
10
11
|
object FWModelUtils {
|
|
12
|
+
|
|
13
|
+
val VideoInfo.internalVideoType: String
|
|
14
|
+
get() = when (this.videoType) {
|
|
15
|
+
is VideoType.ShortVideo -> "video"
|
|
16
|
+
is VideoType.Ad -> "ad"
|
|
17
|
+
is VideoType.Livestream.Idle -> "livestream"
|
|
18
|
+
is VideoType.Livestream.Live -> "livestream"
|
|
19
|
+
is VideoType.Livestream.Replay -> "livestream"
|
|
20
|
+
is VideoType.Livestream.Completed -> "livestream"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
val VideoInfo.internalLiveStreamStatus: String?
|
|
24
|
+
get() = when (this.videoType) {
|
|
25
|
+
is VideoType.ShortVideo -> null
|
|
26
|
+
is VideoType.Ad -> null
|
|
27
|
+
is VideoType.Livestream.Idle -> "idle"
|
|
28
|
+
is VideoType.Livestream.Live -> "live"
|
|
29
|
+
is VideoType.Livestream.Replay -> "replay"
|
|
30
|
+
is VideoType.Livestream.Completed -> "completed"
|
|
31
|
+
}
|
|
32
|
+
|
|
11
33
|
fun convertVideoInfo2PlaybackDetails(videoInfo: VideoInfo): FWVideoPlaybackDetails {
|
|
12
34
|
return FWVideoPlaybackDetails(
|
|
13
35
|
badge = videoInfo.badge,
|
|
@@ -18,6 +40,8 @@ object FWModelUtils {
|
|
|
18
40
|
playerWidth = videoInfo.playerWidth,
|
|
19
41
|
id = videoInfo.id,
|
|
20
42
|
feedId = videoInfo.feedId,
|
|
43
|
+
videoType = videoInfo.internalVideoType,
|
|
44
|
+
liveStreamStatus = videoInfo.internalLiveStreamStatus,
|
|
21
45
|
)
|
|
22
46
|
}
|
|
23
47
|
|
|
@@ -25,6 +49,8 @@ object FWModelUtils {
|
|
|
25
49
|
return FWLiveStreamEventDetailsModel(
|
|
26
50
|
id = videoInfo.id,
|
|
27
51
|
feedId = videoInfo.feedId,
|
|
52
|
+
videoType = videoInfo.internalVideoType,
|
|
53
|
+
liveStreamStatus = videoInfo.internalLiveStreamStatus,
|
|
28
54
|
)
|
|
29
55
|
}
|
|
30
56
|
|
|
@@ -39,6 +65,8 @@ object FWModelUtils {
|
|
|
39
65
|
id = event.videoInfo.id,
|
|
40
66
|
actionUrl = event.actionUrl,
|
|
41
67
|
feedId = event.videoInfo.feedId,
|
|
68
|
+
videoType = event.videoInfo.internalVideoType,
|
|
69
|
+
liveStreamStatus = event.videoInfo.internalLiveStreamStatus,
|
|
42
70
|
)
|
|
43
71
|
}
|
|
44
72
|
|
|
@@ -53,6 +81,8 @@ object FWModelUtils {
|
|
|
53
81
|
id = event.videoInfo?.id,
|
|
54
82
|
progress = event.progress,
|
|
55
83
|
feedId = event.videoInfo?.feedId,
|
|
84
|
+
videoType = event.videoInfo?.internalVideoType,
|
|
85
|
+
liveStreamStatus = event.videoInfo?.internalLiveStreamStatus,
|
|
56
86
|
)
|
|
57
87
|
}
|
|
58
88
|
|
|
@@ -66,6 +96,8 @@ object FWModelUtils {
|
|
|
66
96
|
playerWidth = event.videoInfo.playerWidth,
|
|
67
97
|
id = event.videoInfo.id,
|
|
68
98
|
feedId = event.videoInfo.feedId,
|
|
99
|
+
videoType = event.videoInfo.internalVideoType,
|
|
100
|
+
liveStreamStatus = event.videoInfo.internalLiveStreamStatus,
|
|
69
101
|
)
|
|
70
102
|
}
|
|
71
103
|
|
|
@@ -20,8 +20,8 @@ public protocol StoryBlockViewDelegate: AnyObject {
|
|
|
20
20
|
func storyBlock(_ view: StoryBlock, didFailToLoadFeed error: StoryBlockError)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// swiftlint:disable type_body_length
|
|
23
24
|
@objc
|
|
24
|
-
// swiftlint:disable:next type_body_length
|
|
25
25
|
public class StoryBlock: UIView, StoryBlockViewControllerDelegate, PictureInPictureControllerDelegate {
|
|
26
26
|
@objc public var sourceType: StoryBlockSourceType = .discover
|
|
27
27
|
@objc public var channel: String = ""
|
|
@@ -210,8 +210,10 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate, PictureInPict
|
|
|
210
210
|
if let playerStyle = config.playerStyle {
|
|
211
211
|
switch playerStyle {
|
|
212
212
|
case .full:
|
|
213
|
+
resultConfig.playerStyle = .fullBleed
|
|
213
214
|
resultConfig.fullScreenPlayerView.playerStyle = .fullBleed
|
|
214
|
-
|
|
215
|
+
case .fit:
|
|
216
|
+
resultConfig.playerStyle = .fit
|
|
215
217
|
resultConfig.fullScreenPlayerView.playerStyle = .fit
|
|
216
218
|
}
|
|
217
219
|
}
|
|
@@ -307,6 +309,7 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate, PictureInPict
|
|
|
307
309
|
|
|
308
310
|
if let buttonConfiguration = config.buttonConfiguration {
|
|
309
311
|
if let videoDetailButtonDisplay = buttonConfiguration.videoDetailButton?.getButtonDisplayConfiguration() {
|
|
312
|
+
resultConfig.videoDetailButtonDisplayConfiguration = videoDetailButtonDisplay
|
|
310
313
|
resultConfig.fullScreenPlayerView.videoDetailButtonDisplayConfiguration = videoDetailButtonDisplay
|
|
311
314
|
}
|
|
312
315
|
|
|
@@ -315,18 +318,22 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate, PictureInPict
|
|
|
315
318
|
}
|
|
316
319
|
|
|
317
320
|
if let muteButtonDisplay = buttonConfiguration.muteButton?.getButtonDisplayConfiguration() {
|
|
321
|
+
resultConfig.muteButton.muteDisplay = muteButtonDisplay
|
|
318
322
|
resultConfig.fullScreenPlayerView.muteButton.muteDisplay = muteButtonDisplay
|
|
319
323
|
}
|
|
320
324
|
|
|
321
325
|
if let unmuteButtonDisplay = buttonConfiguration.unmuteButton?.getButtonDisplayConfiguration() {
|
|
326
|
+
resultConfig.muteButton.unmuteDisplay = unmuteButtonDisplay
|
|
322
327
|
resultConfig.fullScreenPlayerView.muteButton.unmuteDisplay = unmuteButtonDisplay
|
|
323
328
|
}
|
|
324
329
|
|
|
325
330
|
if let playButtonDisplay = buttonConfiguration.playButton?.getButtonDisplayConfiguration() {
|
|
331
|
+
resultConfig.playbackButton.playDisplay = playButtonDisplay
|
|
326
332
|
resultConfig.fullScreenPlayerView.playbackButton.playDisplay = playButtonDisplay
|
|
327
333
|
}
|
|
328
334
|
|
|
329
335
|
if let pauseButtonDisplay = buttonConfiguration.pauseButton?.getButtonDisplayConfiguration() {
|
|
336
|
+
resultConfig.playbackButton.pauseDisplay = pauseButtonDisplay
|
|
330
337
|
resultConfig.fullScreenPlayerView.playbackButton.pauseDisplay = pauseButtonDisplay
|
|
331
338
|
}
|
|
332
339
|
}
|
|
@@ -417,3 +424,4 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate, PictureInPict
|
|
|
417
424
|
completionHandler(true)
|
|
418
425
|
}
|
|
419
426
|
}
|
|
427
|
+
// swiftlint:enable type_body_length
|
|
@@ -110,7 +110,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate, PictureInPictur
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
private var videoFeedLayout: VideoFeedLayout {
|
|
113
|
-
|
|
113
|
+
let resultLayout: VideoFeedLayout
|
|
114
114
|
switch mode {
|
|
115
115
|
case .row:
|
|
116
116
|
let layout = VideoFeedHorizontalLayout()
|
|
@@ -139,25 +139,27 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate, PictureInPictur
|
|
|
139
139
|
}
|
|
140
140
|
if let contentPadding = config.contentPadding {
|
|
141
141
|
if let top = contentPadding.top {
|
|
142
|
-
resultLayout
|
|
142
|
+
resultLayout.contentInsets.top = top
|
|
143
143
|
}
|
|
144
144
|
if let right = contentPadding.right {
|
|
145
|
-
resultLayout
|
|
145
|
+
resultLayout.contentInsets.right = right
|
|
146
146
|
}
|
|
147
147
|
if let bottom = contentPadding.bottom {
|
|
148
|
-
resultLayout
|
|
148
|
+
resultLayout.contentInsets.bottom = bottom
|
|
149
149
|
}
|
|
150
150
|
if let left = contentPadding.left {
|
|
151
|
-
resultLayout
|
|
151
|
+
resultLayout.contentInsets.left = left
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
if let itemSpacing = config.itemSpacing {
|
|
156
|
-
resultLayout
|
|
156
|
+
resultLayout.itemSpacing = itemSpacing
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
resultLayout.ignoresSafeAreaLayoutGuide = true
|
|
161
|
+
|
|
162
|
+
return resultLayout
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
private var isInPip: Bool = false
|
|
@@ -196,17 +198,8 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate, PictureInPictur
|
|
|
196
198
|
|
|
197
199
|
onVideoFeedGetFeedId?(["feedId": feedVC.feedID])
|
|
198
200
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
viewConfiguration.itemView.autoplay.isEnabled = false
|
|
202
|
-
feedVC.viewConfiguration = viewConfiguration
|
|
203
|
-
DispatchQueue.main.async {
|
|
204
|
-
viewConfiguration.itemView.autoplay.isEnabled = true
|
|
205
|
-
feedVC.viewConfiguration = viewConfiguration
|
|
206
|
-
}
|
|
207
|
-
} else {
|
|
208
|
-
feedVC.viewConfiguration = viewConfiguration
|
|
209
|
-
}
|
|
201
|
+
let viewConfiguration = convertToVideoFeedContentConfiguration()
|
|
202
|
+
feedVC.viewConfiguration = viewConfiguration
|
|
210
203
|
|
|
211
204
|
feedVC.isPictureInPictureEnabled = playerViewConfig?.enablePictureInPicture ?? false
|
|
212
205
|
|
|
@@ -214,16 +207,6 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate, PictureInPictur
|
|
|
214
207
|
feedVC.pictureInPictureDelegate = self
|
|
215
208
|
self.feedVC = feedVC
|
|
216
209
|
|
|
217
|
-
if self.mode != .row, let subView = feedVC.view.subviews.first {
|
|
218
|
-
let constraints = feedVC.view.constraints
|
|
219
|
-
for constraint in constraints {
|
|
220
|
-
if (constraint.firstItem as? NSObject) == subView || (constraint.secondItem as? NSObject) == subView {
|
|
221
|
-
constraint.isActive = false
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
NSLayoutConstraint.activate(subView.constraints(equalTo: feedVC.view))
|
|
225
|
-
}
|
|
226
|
-
|
|
227
210
|
parentVC.attachChild(feedVC, to: self)
|
|
228
211
|
}
|
|
229
212
|
|
|
@@ -413,7 +396,7 @@ extension VideoFeed {
|
|
|
413
396
|
switch playerStyle {
|
|
414
397
|
case .full:
|
|
415
398
|
vpcConfig.playerStyle = .fullBleed
|
|
416
|
-
|
|
399
|
+
case .fit:
|
|
417
400
|
vpcConfig.playerStyle = .fit
|
|
418
401
|
}
|
|
419
402
|
}
|
|
@@ -42,9 +42,4 @@ class VideoFeedManager: RCTViewManager, VideoFeedDelegate {
|
|
|
42
42
|
view.onVideoFeedLoadFinished?(error.jsObject)
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
// // MARK: - FireworkVideoFeedDelegate
|
|
47
|
-
// func fireworkVideoDidTapVideoThumbnail(_ eventDetails: FeedEventDetails) {
|
|
48
|
-
// view.onVideoFeedClick?(eventDetails.jsObject)
|
|
49
|
-
// }
|
|
50
45
|
}
|
|
@@ -19,7 +19,9 @@ enum FWEventName: String, CaseIterable {
|
|
|
19
19
|
case appLanguageUpdated = "fw:app-language-updated" // emitted in JS side
|
|
20
20
|
case nativeAppLanguageUpdated = "fw:native-app-language-updated" // emitted in native side
|
|
21
21
|
case logMessage = "fw:log-message"
|
|
22
|
-
case productInfoViewConfigurationUpdated = "fw:product-info-view-configuration-updated"
|
|
22
|
+
case productInfoViewConfigurationUpdated = "fw:product-info-view-configuration-updated" // emitted in JS side
|
|
23
|
+
case livestreamPlayerDesignVersionUpdated = "fw:livestream-player-design-version-updated" // emitted in JS side
|
|
24
|
+
case dataTrackingLevelUpdated = "fw:data-tracking-level-updated" // emitted in JS side
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
enum VideoPlaybackSubEventName: String {
|
|
@@ -126,4 +126,17 @@ extension RCTConvert {
|
|
|
126
126
|
return nil
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
static func livestreamPlayerDesignVersion(
|
|
131
|
+
_ version: String
|
|
132
|
+
) -> FireworkVideo.LivestreamPlayerDesignVersion? {
|
|
133
|
+
switch version {
|
|
134
|
+
case "v1":
|
|
135
|
+
return FireworkVideo.LivestreamPlayerDesignVersion.v1
|
|
136
|
+
case "v2":
|
|
137
|
+
return FireworkVideo.LivestreamPlayerDesignVersion.v2
|
|
138
|
+
default:
|
|
139
|
+
return nil
|
|
140
|
+
}
|
|
141
|
+
}
|
|
129
142
|
}
|
|
@@ -128,6 +128,36 @@ extension FireworkSDKModule: FireworkVideoPlaybackDelegate {
|
|
|
128
128
|
"info": videoPlayback.jsObject
|
|
129
129
|
])
|
|
130
130
|
}
|
|
131
|
+
|
|
132
|
+
func fireworkVideoDidClose(_ videoPlayback: VideoPlaybackDetails) {
|
|
133
|
+
guard enableVideoPlayBackEvent else { return }
|
|
134
|
+
sendEvent(
|
|
135
|
+
withName: FWEventName.videoPlayback.rawValue,
|
|
136
|
+
body: [
|
|
137
|
+
"eventName": VideoPlaybackSubEventName.complete.rawValue,
|
|
138
|
+
"info": videoPlayback.jsObject
|
|
139
|
+
])
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
func fireworkVideoDidAutomaticallyPause(_ videoPlayback: VideoPlaybackDetails) {
|
|
143
|
+
guard enableVideoPlayBackEvent else { return }
|
|
144
|
+
sendEvent(
|
|
145
|
+
withName: FWEventName.videoPlayback.rawValue,
|
|
146
|
+
body: [
|
|
147
|
+
"eventName": VideoPlaybackSubEventName.pause.rawValue,
|
|
148
|
+
"info": videoPlayback.jsObject
|
|
149
|
+
])
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
func fireworkVideoDidAutomaticallyResume(_ videoPlayback: VideoPlaybackDetails) {
|
|
153
|
+
guard enableVideoPlayBackEvent else { return }
|
|
154
|
+
sendEvent(
|
|
155
|
+
withName: FWEventName.videoPlayback.rawValue,
|
|
156
|
+
body: [
|
|
157
|
+
"eventName": VideoPlaybackSubEventName.resume.rawValue,
|
|
158
|
+
"info": videoPlayback.jsObject
|
|
159
|
+
])
|
|
160
|
+
}
|
|
131
161
|
}
|
|
132
162
|
|
|
133
163
|
extension FireworkSDKModule: FireworkVideoFeedDelegate {
|
|
@@ -138,10 +168,17 @@ extension FireworkSDKModule: FireworkVideoFeedDelegate {
|
|
|
138
168
|
}
|
|
139
169
|
|
|
140
170
|
extension FireworkSDKModule {
|
|
141
|
-
@objc(setDataTrackingLevel:)
|
|
142
|
-
func setDataTrackingLevel(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
171
|
+
@objc(setDataTrackingLevel:resolver:rejecter:)
|
|
172
|
+
func setDataTrackingLevel(
|
|
173
|
+
_ level: String,
|
|
174
|
+
resolver: @escaping RCTPromiseResolveBlock,
|
|
175
|
+
rejecter: @escaping RCTPromiseRejectBlock
|
|
176
|
+
) {
|
|
177
|
+
if let dataTrackingLevel = RCTConvert.dataTrackingLevel(level) {
|
|
178
|
+
FireworkVideoSDK.dataTrackingLevel = dataTrackingLevel
|
|
179
|
+
resolver(true)
|
|
180
|
+
} else {
|
|
181
|
+
resolver(false)
|
|
182
|
+
}
|
|
146
183
|
}
|
|
147
184
|
}
|
|
@@ -22,6 +22,7 @@ RCT_EXTERN_METHOD(trackPurchase:(NSDictionary *)parameters)
|
|
|
22
22
|
RCT_EXTERN_METHOD(changeAppLanguage:(NSString * __nullable)language resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
23
23
|
RCT_EXTERN_METHOD(pausePlayer:(NSString *)callbackId)
|
|
24
24
|
RCT_EXTERN_METHOD(resumePlayer:(NSString *)callbackId)
|
|
25
|
-
RCT_EXTERN_METHOD(setDataTrackingLevel:(NSString *)level)
|
|
25
|
+
RCT_EXTERN_METHOD(setDataTrackingLevel:(NSString *)level resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
26
|
+
RCT_EXTERN_METHOD(setLivestreamPlayerDesignVersion:(NSString *)version resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
26
27
|
|
|
27
28
|
@end
|
|
@@ -13,6 +13,7 @@ var gShareBaseURL: String?
|
|
|
13
13
|
var gAdBadgeConfiguration: AdBadgeConfiguration?
|
|
14
14
|
var gVideoLaunchBehavior: FWRVideoLaunchBehavior?
|
|
15
15
|
|
|
16
|
+
// swiftlint:disable type_body_length
|
|
16
17
|
@objc(FireworkSDKModule)
|
|
17
18
|
class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
18
19
|
static var shared: FireworkSDKModule?
|
|
@@ -232,6 +233,20 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
232
233
|
resolver(result)
|
|
233
234
|
}
|
|
234
235
|
|
|
236
|
+
@objc(setLivestreamPlayerDesignVersion:resolver:rejecter:)
|
|
237
|
+
func setLivestreamPlayerDesignVersion(
|
|
238
|
+
_ version: String,
|
|
239
|
+
resolver: @escaping RCTPromiseResolveBlock,
|
|
240
|
+
rejecter: @escaping RCTPromiseRejectBlock
|
|
241
|
+
) {
|
|
242
|
+
if let livestreamPlayerDesignVersion = RCTConvert.livestreamPlayerDesignVersion(version) {
|
|
243
|
+
FireworkVideoSDK.livestreamPlayerDesignVersion = livestreamPlayerDesignVersion
|
|
244
|
+
resolver(true)
|
|
245
|
+
} else {
|
|
246
|
+
resolver(false)
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
235
250
|
override func startObserving() {
|
|
236
251
|
super.startObserving()
|
|
237
252
|
hasListeners = true
|
|
@@ -349,3 +364,4 @@ extension FireworkSDKModule {
|
|
|
349
364
|
return fwAdBadgeConfiguration
|
|
350
365
|
}
|
|
351
366
|
}
|
|
367
|
+
// swiftlint:enable type_body_length
|