react-native-firework-sdk 1.0.6-beta.2 → 1.1.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/LICENSE +202 -0
- package/README.md +2 -40
- package/android/build.gradle +6 -3
- package/android/gradle.properties +2 -1
- package/android/proguard-rules.pro +22 -0
- package/android/publish.gradle +4 -3
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +226 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/constants/FWCommandConstant.kt +1 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/constants/FWVideoPlayerConstant.kt +13 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModel.kt +9 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWEventName.kt +10 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamEventDetailsModel.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamMessageDetailsModel.kt +11 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +28 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedItemDetailsModel.kt +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedModel.kt +7 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +18 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedSource.kt +2 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoFeedTitlePosition.kt +1 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoPlaybackDetails.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +23 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/models/FWVideoShoppingProduct.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/WeakProperty.kt +19 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/FireworkSDKPackage.kt +10 -5
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +175 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWLiveStreamInterface.kt +5 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/models/FWVideoShoppingInterface.kt +1 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/models/FireworkSDKInterface.kt +4 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +88 -0
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/module/FWVideoShoppingModule.kt +14 -12
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/module/FireworkSDKModule.kt +23 -13
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/pages/FWVideoShoppingCartActivity.kt +4 -4
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge/reactnative}/utils/FWEventUtils.kt +46 -5
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWJsonUtils.kt +1 -1
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWLogUtils.kt +2 -2
- package/android/src/main/java/com/{reactnativefireworksdk → fireworksdk/bridge}/utils/FWUrlUtils.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +94 -0
- package/android/src/main/res/layout/fw_bridge_fragment_playlistfeed.xml +18 -0
- package/android/src/main/res/layout/{fwrn_fragment_shoppingcart.xml → fw_bridge_fragment_shoppingcart.xml} +1 -1
- package/android/src/main/res/layout/{fwrn_fragment_videofeed.xml → fw_bridge_fragment_videofeed.xml} +2 -1
- package/android/src/main/res/values/colors.xml +4 -0
- package/ios/{Component → Components}/VideoFeed.swift +29 -0
- package/ios/{Component → Components}/VideoFeedConfiguration.swift +1 -0
- package/ios/{Component → Components}/VideoFeedManager.m +0 -0
- package/ios/{Component → Components}/VideoFeedManager.swift +0 -0
- package/ios/{Component → Components}/VideoPlayerConfiguration.swift +0 -0
- package/ios/Models/{FireworkJsEvent.swift → NativeToRN/FireworkEventName.swift} +20 -0
- package/ios/Models/{FireworkSDK+JsModel.swift → NativeToRN/FireworkSDK+Json.swift} +33 -3
- package/ios/Models/{RCTConvert+FireworkSDKModule.swift → RNToNative/RCTConvert+FireworkSDKModule.swift} +20 -0
- package/ios/Models/{RCTConvert+Shopping.swift → RNToNative/RCTConvert+Shopping.swift} +0 -0
- package/ios/Models/{RCTConvert+VideoFeed.swift → RNToNative/RCTConvert+VideoFeed.swift} +0 -0
- package/ios/Modules/FireworkSDKModule/AdBadgeConfiguration.swift +18 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +1 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +10 -19
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +2 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +11 -3
- package/ios/Modules/LiveStream/LiveStreamModule.m +14 -0
- package/ios/Modules/LiveStream/LiveStreamModule.swift +43 -0
- package/lib/commonjs/FireworkSDK.js +61 -38
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/LiveStream.js +60 -0
- package/lib/commonjs/LiveStream.js.map +1 -0
- package/lib/commonjs/VideoShopping.js +16 -15
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +46 -2
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js +24 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/AdBadgeConfiguration.js +2 -0
- package/lib/commonjs/models/{ADConfig.js.map → AdBadgeConfiguration.js.map} +0 -0
- package/lib/commonjs/models/AdConfig.js +2 -0
- package/lib/{module/models/ADConfig.js.map → commonjs/models/AdConfig.js.map} +0 -0
- package/lib/commonjs/models/FWEventName.js +24 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -0
- package/lib/commonjs/models/FWEvents.js +0 -14
- package/lib/commonjs/models/FWEvents.js.map +1 -1
- package/lib/commonjs/models/LiveStreamChatEventName.js +15 -0
- package/lib/commonjs/models/LiveStreamChatEventName.js.map +1 -0
- package/lib/commonjs/models/LiveStreamEventDetails.js +2 -0
- package/lib/commonjs/models/LiveStreamEventDetails.js.map +1 -0
- package/lib/commonjs/models/LiveStreamEventName.js +17 -0
- package/lib/commonjs/models/LiveStreamEventName.js.map +1 -0
- package/lib/commonjs/models/LiveStreamMessageDetails.js +2 -0
- package/lib/commonjs/models/LiveStreamMessageDetails.js.map +1 -0
- package/lib/commonjs/models/VideoFeedSource.js +6 -0
- package/lib/commonjs/models/VideoFeedSource.js.map +1 -0
- package/lib/commonjs/models/VideoPlaybackEventName.js.map +1 -1
- package/lib/commonjs/modules/FireworkSDKModule.js +3 -1
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/modules/LiveStreamModule.js +22 -0
- package/lib/commonjs/modules/LiveStreamModule.js.map +1 -0
- package/lib/commonjs/modules/ShoppingModule.js +3 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +50 -34
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/LiveStream.js +51 -0
- package/lib/module/LiveStream.js.map +1 -0
- package/lib/module/VideoShopping.js +10 -10
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/VideoFeed.js +41 -3
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/AdBadgeConfiguration.js +2 -0
- package/lib/module/models/AdBadgeConfiguration.js.map +1 -0
- package/lib/module/models/AdConfig.js +2 -0
- package/lib/module/models/AdConfig.js.map +1 -0
- package/lib/module/models/FWEventName.js +17 -0
- package/lib/module/models/FWEventName.js.map +1 -0
- package/lib/module/models/FWEvents.js +1 -12
- package/lib/module/models/FWEvents.js.map +1 -1
- package/lib/module/models/LiveStreamChatEventName.js +8 -0
- package/lib/module/models/LiveStreamChatEventName.js.map +1 -0
- package/lib/module/models/LiveStreamEventDetails.js +2 -0
- package/lib/module/models/LiveStreamEventDetails.js.map +1 -0
- package/lib/module/models/LiveStreamEventName.js +10 -0
- package/lib/module/models/LiveStreamEventName.js.map +1 -0
- package/lib/module/models/LiveStreamMessageDetails.js +2 -0
- package/lib/module/models/LiveStreamMessageDetails.js.map +1 -0
- package/lib/module/models/VideoFeedSource.js +2 -0
- package/lib/module/models/VideoFeedSource.js.map +1 -0
- package/lib/module/models/VideoPlaybackEventName.js.map +1 -1
- package/lib/module/modules/FireworkSDKModule.js +3 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/modules/LiveStreamModule.js +12 -0
- package/lib/module/modules/LiveStreamModule.js.map +1 -0
- package/lib/module/modules/ShoppingModule.js +3 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +26 -24
- package/lib/typescript/LiveStream.d.ts +21 -0
- package/lib/typescript/VideoShopping.d.ts +5 -5
- package/lib/typescript/components/VideoFeed.d.ts +7 -4
- package/lib/typescript/index.d.ts +15 -6
- package/lib/typescript/models/AdBadgeConfiguration.d.ts +15 -0
- package/lib/typescript/models/{ADConfig.d.ts → AdConfig.d.ts} +1 -1
- package/lib/typescript/models/FWEventName.d.ts +14 -0
- package/lib/typescript/models/FWEvents.d.ts +14 -11
- package/lib/typescript/models/FeedItemDetails.d.ts +11 -4
- package/lib/typescript/models/LiveStreamChatEventName.d.ts +7 -0
- package/lib/typescript/models/LiveStreamEventDetails.d.ts +3 -0
- package/lib/typescript/models/LiveStreamEventName.d.ts +15 -0
- package/lib/typescript/models/LiveStreamMessageDetails.d.ts +14 -0
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +7 -3
- package/lib/typescript/models/VideoFeedSource.d.ts +2 -0
- package/lib/typescript/models/VideoPlaybackDetails.d.ts +1 -2
- package/lib/typescript/models/VideoPlaybackEventName.d.ts +1 -1
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +5 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +8 -4
- package/lib/typescript/modules/LiveStreamModule.d.ts +8 -0
- package/lib/typescript/modules/ShoppingModule.d.ts +3 -1
- package/package.json +3 -3
- package/react-native-firework-sdk.podspec +3 -1
- package/src/FireworkSDK.ts +49 -33
- package/src/LiveStream.ts +51 -0
- package/src/VideoShopping.ts +10 -9
- package/src/components/VideoFeed.tsx +63 -7
- package/src/index.tsx +31 -12
- package/src/models/AdBadgeConfiguration.ts +16 -0
- package/src/models/{ADConfig.ts → AdConfig.ts} +1 -1
- package/src/models/FWEventName.ts +14 -0
- package/src/models/FWEvents.ts +16 -12
- package/src/models/FeedItemDetails.ts +12 -4
- package/src/models/LiveStreamChatEventName.ts +8 -0
- package/src/models/LiveStreamEventDetails.ts +4 -0
- package/src/models/LiveStreamEventName.ts +16 -0
- package/src/models/LiveStreamMessageDetails.ts +14 -0
- package/src/models/VideoFeedConfiguration.ts +7 -3
- package/src/models/VideoFeedSource.ts +2 -0
- package/src/models/VideoPlaybackDetails.ts +1 -3
- package/src/models/VideoPlaybackEventName.ts +1 -1
- package/src/models/VideoPlayerConfiguration.ts +7 -1
- package/src/modules/FireworkSDKModule.ts +10 -4
- package/src/modules/LiveStreamModule.ts +26 -0
- package/src/modules/ShoppingModule.ts +13 -6
- package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt +0 -143
- package/android/src/main/java/com/reactnativefireworksdk/manager/FWVideoFeedManager.kt +0 -88
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedConfigModel.kt +0 -27
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoFeedMode.kt +0 -7
- package/android/src/main/java/com/reactnativefireworksdk/models/FWVideoPlayerConfigModel.kt +0 -22
- package/android/src/main/java/com/reactnativefireworksdk/utils/FWVideoPlayerUtils.kt +0 -20
- package/lib/commonjs/models/ADConfig.js +0 -2
- package/lib/module/models/ADConfig.js +0 -2
package/android/src/main/java/com/reactnativefireworksdk/components/videofeed/FWVideoFeed.kt
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
package com.reactnativefireworksdk.components.videofeed
|
|
2
|
-
|
|
3
|
-
import android.app.Activity
|
|
4
|
-
import android.graphics.Color
|
|
5
|
-
import android.util.AttributeSet
|
|
6
|
-
import android.view.LayoutInflater
|
|
7
|
-
import android.widget.RelativeLayout
|
|
8
|
-
import com.facebook.react.uimanager.ThemedReactContext
|
|
9
|
-
import com.loopnow.fireworklibrary.FeedType
|
|
10
|
-
import com.loopnow.fireworklibrary.models.FeedLayout
|
|
11
|
-
import com.loopnow.fireworklibrary.models.FeedTitlePosition
|
|
12
|
-
import com.loopnow.fireworklibrary.models.VideoContentStatus
|
|
13
|
-
import com.loopnow.fireworklibrary.views.OnItemClickedListener
|
|
14
|
-
import com.loopnow.fireworklibrary.views.OnVideoContentStatusListener
|
|
15
|
-
import com.loopnow.fireworklibrary.views.VideoFeedView
|
|
16
|
-
import com.reactnativefireworksdk.R
|
|
17
|
-
import com.reactnativefireworksdk.models.*
|
|
18
|
-
import com.reactnativefireworksdk.utils.FWEventUtils
|
|
19
|
-
import com.reactnativefireworksdk.utils.FWLogUtils
|
|
20
|
-
import com.reactnativefireworksdk.utils.FWVideoPlayerUtils
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class FWVideoFeed(
|
|
24
|
-
context: ThemedReactContext,
|
|
25
|
-
attrs: AttributeSet?
|
|
26
|
-
) : RelativeLayout(context, attrs) {
|
|
27
|
-
|
|
28
|
-
private val activity: Activity = context.currentActivity as Activity
|
|
29
|
-
|
|
30
|
-
private val videoFeedView: VideoFeedView
|
|
31
|
-
private var channelId: String? = null
|
|
32
|
-
private var playlistId: String? = null
|
|
33
|
-
private var feedType: FeedType? = null
|
|
34
|
-
private var feedLayout: FeedLayout? = null
|
|
35
|
-
private var titlePosition: FeedTitlePosition? = null
|
|
36
|
-
|
|
37
|
-
constructor(context: ThemedReactContext) : this(context, null)
|
|
38
|
-
|
|
39
|
-
init {
|
|
40
|
-
val view = LayoutInflater.from(activity).inflate(R.layout.fwrn_fragment_videofeed, this, true)
|
|
41
|
-
videoFeedView = view.findViewById(R.id.fwrn_integrated_videofeed)
|
|
42
|
-
videoFeedView.addOnItemClickedListener(object: OnItemClickedListener {
|
|
43
|
-
override fun onItemClicked(index: Int, title: String, id: String, videoDuration: Long) {
|
|
44
|
-
val fwVideoFeedItemDetailsModel = FWVideoFeedItemDetailsModel(index, id, videoDuration.toInt())
|
|
45
|
-
FWEventUtils.sendVideoFeedClickEvent(context, fwVideoFeedItemDetailsModel)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
override fun onItemClicked(index: Int) {
|
|
49
|
-
super.onItemClicked(index)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
override fun onItemClicked(index: Int, feedId: Int): Boolean {
|
|
53
|
-
return super.onItemClicked(index, feedId)
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
videoFeedView.addOnVideoContentStatusListener(object: OnVideoContentStatusListener {
|
|
57
|
-
override fun currentStatus(status: VideoContentStatus, extra: String) {
|
|
58
|
-
when (status) {
|
|
59
|
-
VideoContentStatus.LoadingContent -> {
|
|
60
|
-
FWLogUtils.d { "VideoContentStatus.LoadingContent" }
|
|
61
|
-
}
|
|
62
|
-
VideoContentStatus.LoadingContentFailed -> {
|
|
63
|
-
FWLogUtils.e { "VideoContentStatus.LoadingContentFailed" }
|
|
64
|
-
FWEventUtils.receiveVideoFeedLoadFinishedFailedEvent(context, id, VideoContentStatus.LoadingContentFailed.rawValue, extra)
|
|
65
|
-
}
|
|
66
|
-
VideoContentStatus.ContentLoaded -> {
|
|
67
|
-
FWLogUtils.d { "VideoContentStatus.ContentLoaded" }
|
|
68
|
-
FWEventUtils.receiveVideoFeedLoadFinishedSuccessEvent(context, id)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
fun setSource(source: String?) {
|
|
76
|
-
feedType = when {
|
|
77
|
-
source.equals(FWVideoFeedSource.Channel.rawValue) -> {
|
|
78
|
-
FeedType.CHANNEL
|
|
79
|
-
}
|
|
80
|
-
source.equals(FWVideoFeedSource.Playlist.rawValue) -> {
|
|
81
|
-
FeedType.PLAYLIST
|
|
82
|
-
}
|
|
83
|
-
else -> {
|
|
84
|
-
FeedType.DISCOVER
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
setFeed(channelId, playlistId, feedType)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
fun setChannel(channel: String?) {
|
|
91
|
-
channelId = channel
|
|
92
|
-
setFeed(channelId, playlistId, feedType)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
fun setPlaylist(playlist: String?) {
|
|
96
|
-
playlistId = playlist
|
|
97
|
-
setFeed(channelId, playlistId, feedType)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
fun setMode(mode: String?) {
|
|
101
|
-
feedLayout = when {
|
|
102
|
-
mode.equals(FWVideoFeedMode.Column.rawValue) -> FeedLayout.VERTICAL
|
|
103
|
-
mode.equals(FWVideoFeedMode.Grid.rawValue) -> FeedLayout.GRID
|
|
104
|
-
else -> FeedLayout.HORIZONTAL
|
|
105
|
-
}
|
|
106
|
-
videoFeedView.setLayout(feedLayout)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
fun setVideoFeedConfig(config: FWVideoFeedConfigModel?) {
|
|
110
|
-
val backgroundColor = config?.backgroundColor
|
|
111
|
-
if (!backgroundColor.isNullOrBlank()) {
|
|
112
|
-
videoFeedView.setBackgroundColor(Color.parseColor(backgroundColor))
|
|
113
|
-
} else {
|
|
114
|
-
videoFeedView.setBackgroundColor(Color.TRANSPARENT)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
videoFeedView.setTitleVisible(config?.title?.hidden != true)
|
|
118
|
-
|
|
119
|
-
titlePosition = when {
|
|
120
|
-
config?.titlePosition.equals(FWVideoFeedTitlePosition.Stacked.rawValue) -> FeedTitlePosition.BELOW
|
|
121
|
-
else -> FeedTitlePosition.ALIGN_BOTTOM
|
|
122
|
-
}
|
|
123
|
-
videoFeedView.setTitlePosition(titlePosition)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
fun setVideoPlayerConfig(config: FWVideoPlayerConfigModel?) {
|
|
127
|
-
FWVideoPlayerUtils.setVideoPlayerConfig(config)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
fun refresh() {
|
|
131
|
-
videoFeedView.refreshFeed()
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
private fun setFeed(channelId: String?, playlistId: String?, feedType: FeedType?) {
|
|
135
|
-
if (feedType == FeedType.CHANNEL && !channelId.isNullOrBlank()) {
|
|
136
|
-
videoFeedView.setFeed(channelId, null, FeedType.CHANNEL)
|
|
137
|
-
} else if (feedType == FeedType.PLAYLIST && !channelId.isNullOrBlank() && !playlistId.isNullOrBlank()) {
|
|
138
|
-
videoFeedView.setFeed(channelId, playlistId, FeedType.PLAYLIST)
|
|
139
|
-
} else {
|
|
140
|
-
videoFeedView.setFeed(null, null, FeedType.DISCOVER)
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
package com.reactnativefireworksdk.manager
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.ReadableArray
|
|
4
|
-
import com.facebook.react.bridge.ReadableMap
|
|
5
|
-
import com.facebook.react.uimanager.SimpleViewManager
|
|
6
|
-
import com.facebook.react.uimanager.ThemedReactContext
|
|
7
|
-
|
|
8
|
-
import com.facebook.react.uimanager.annotations.ReactProp
|
|
9
|
-
import com.reactnativefireworksdk.constants.FWCommandConstant
|
|
10
|
-
import com.reactnativefireworksdk.models.FWVideoFeedConfigModel
|
|
11
|
-
import com.reactnativefireworksdk.models.FWVideoPlayerConfigModel
|
|
12
|
-
import com.reactnativefireworksdk.utils.FWJsonUtils
|
|
13
|
-
import com.facebook.react.common.MapBuilder
|
|
14
|
-
import com.reactnativefireworksdk.components.videofeed.FWVideoFeed
|
|
15
|
-
import com.reactnativefireworksdk.models.FWFeedViewEventName
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
|
|
19
|
-
|
|
20
|
-
override fun getName(): String {
|
|
21
|
-
return "FWVideoFeed"
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
override fun createViewInstance(reactContext: ThemedReactContext): FWVideoFeed {
|
|
25
|
-
// currentActivity cannot be null
|
|
26
|
-
return FWVideoFeed(reactContext)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@ReactProp(name = "source")
|
|
30
|
-
fun setSource(view: FWVideoFeed, source: String?) {
|
|
31
|
-
view.setSource(source)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@ReactProp(name = "channel")
|
|
35
|
-
fun setChannel(view: FWVideoFeed, channel: String?) {
|
|
36
|
-
view.setChannel(channel)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@ReactProp(name = "playlist")
|
|
40
|
-
fun setPlaylist(view: FWVideoFeed, playlist: String?) {
|
|
41
|
-
view.setPlaylist(playlist)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@ReactProp(name = "mode")
|
|
45
|
-
fun setMode(view: FWVideoFeed, mode: String?) {
|
|
46
|
-
view.setMode(mode)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@ReactProp(name = "videoFeedConfiguration")
|
|
50
|
-
fun setVideoFeedConfig(view: FWVideoFeed, config: ReadableMap?) {
|
|
51
|
-
val configMap = config?.toHashMap()
|
|
52
|
-
val videoFeedConfigModel = FWJsonUtils.fromMap(configMap, FWVideoFeedConfigModel::class.java)
|
|
53
|
-
view.setVideoFeedConfig(videoFeedConfigModel)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@ReactProp(name = "videoPlayerConfiguration")
|
|
57
|
-
fun setVideoPlayerConfig(view: FWVideoFeed, config: ReadableMap?) {
|
|
58
|
-
val configMap = config?.toHashMap()
|
|
59
|
-
val videoPlayerConfigModel = FWJsonUtils.fromMap(configMap, FWVideoPlayerConfigModel::class.java)
|
|
60
|
-
view.setVideoPlayerConfig(videoPlayerConfigModel)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
override fun getCommandsMap(): MutableMap<String, Int> {
|
|
64
|
-
val map: MutableMap<String, Int> = HashMap()
|
|
65
|
-
map["refresh"] = FWCommandConstant.FW_COMMAND_VIDEO_FEED_REFRESH
|
|
66
|
-
return map
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
override fun receiveCommand(root: FWVideoFeed, commandId: Int, args: ReadableArray?) {
|
|
70
|
-
when (commandId) {
|
|
71
|
-
FWCommandConstant.FW_COMMAND_VIDEO_FEED_REFRESH -> {
|
|
72
|
-
root.refresh()
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* To map the "onVideoFeedLoadFinished" event name to the "onVideoFeedLoadFinished" callback prop in JavaScript
|
|
79
|
-
* first onVideoFeedLoadFinished is event name
|
|
80
|
-
* second onVideoFeedLoadFinished is callback prop in JavaScript
|
|
81
|
-
*/
|
|
82
|
-
override fun getExportedCustomBubblingEventTypeConstants(): MutableMap<String, Any>? {
|
|
83
|
-
return MapBuilder.builder<String, Any>()
|
|
84
|
-
.put(FWFeedViewEventName.VideoFeedLoadFinished.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWFeedViewEventName.VideoFeedLoadFinished.rawValue)))
|
|
85
|
-
.build()
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
package com.reactnativefireworksdk.models
|
|
2
|
-
|
|
3
|
-
import android.os.Parcelable
|
|
4
|
-
import kotlinx.android.parcel.Parcelize
|
|
5
|
-
|
|
6
|
-
@Parcelize
|
|
7
|
-
data class FWVideoFeedConfigModel(
|
|
8
|
-
val backgroundColor: String?,
|
|
9
|
-
val cornerRadius: Int?,
|
|
10
|
-
val title: FWTitleModel?,
|
|
11
|
-
val titlePosition: String?,
|
|
12
|
-
val playIcon: FWPlayIconModel?
|
|
13
|
-
) : Parcelable {
|
|
14
|
-
|
|
15
|
-
@Parcelize
|
|
16
|
-
data class FWTitleModel(
|
|
17
|
-
val hidden: Boolean?,
|
|
18
|
-
val textColor: String?,
|
|
19
|
-
val fontSize: Int?,
|
|
20
|
-
) : Parcelable
|
|
21
|
-
|
|
22
|
-
@Parcelize
|
|
23
|
-
data class FWPlayIconModel(
|
|
24
|
-
val hidden: Boolean?,
|
|
25
|
-
val iconWidth: Int?,
|
|
26
|
-
) : Parcelable
|
|
27
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
package com.reactnativefireworksdk.models
|
|
2
|
-
|
|
3
|
-
import android.os.Parcelable
|
|
4
|
-
import kotlinx.android.parcel.Parcelize
|
|
5
|
-
|
|
6
|
-
@Parcelize
|
|
7
|
-
data class FWVideoPlayerConfigModel(
|
|
8
|
-
val playerStyle: String?,
|
|
9
|
-
val videoCompleteAction: String?,
|
|
10
|
-
val showShareButton: Boolean?,
|
|
11
|
-
val ctaButtonStyle: FWCtaButtonStyleModel?,
|
|
12
|
-
val showMuteButton: Boolean?,
|
|
13
|
-
val showPlaybackButton: Boolean?,
|
|
14
|
-
) : Parcelable {
|
|
15
|
-
|
|
16
|
-
@Parcelize
|
|
17
|
-
data class FWCtaButtonStyleModel(
|
|
18
|
-
val backgroundColor: String?,
|
|
19
|
-
val fontSize: String?,
|
|
20
|
-
val textColor: String?,
|
|
21
|
-
) : Parcelable
|
|
22
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
package com.reactnativefireworksdk.utils
|
|
2
|
-
|
|
3
|
-
import com.loopnow.fireworklibrary.VideoPlayerProperties
|
|
4
|
-
import com.reactnativefireworksdk.constants.FWVideoPlayerConstant
|
|
5
|
-
import com.reactnativefireworksdk.models.FWVideoPlayerConfigModel
|
|
6
|
-
|
|
7
|
-
object FWVideoPlayerUtils {
|
|
8
|
-
|
|
9
|
-
var customCTAClickEnabled: Boolean = false
|
|
10
|
-
var videoPlaybackEventEnabled: Boolean = false
|
|
11
|
-
|
|
12
|
-
fun setVideoPlayerConfig(config: FWVideoPlayerConfigModel?) {
|
|
13
|
-
VideoPlayerProperties.share = config?.showShareButton != false
|
|
14
|
-
VideoPlayerProperties.loop = config?.videoCompleteAction != FWVideoPlayerConstant.FW_VIDEO_COMPLETE_ACTION_ADVANCE_TO_NEXT
|
|
15
|
-
// VideoPlayerProperties.autoPlayOnComplete = config?.videoCompleteAction != FWVideoPlayerConstant.FW_VIDEO_COMPLETE_ACTION_LOOP
|
|
16
|
-
VideoPlayerProperties.fullScreenPlayer = config?.playerStyle == FWVideoPlayerConstant.FW_PLAYER_STYLE_FULL
|
|
17
|
-
VideoPlayerProperties.enableOneTouchMute = config?.showMuteButton == true
|
|
18
|
-
VideoPlayerProperties.enablePlayPauseControl = config?.showPlaybackButton == true
|
|
19
|
-
}
|
|
20
|
-
}
|