react-native-firework-sdk 1.2.0-beta.2 → 1.2.0-beta.8
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/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +17 -4
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedSource.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +6 -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/FireworkSDKModule.kt +16 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWCustomCTALinkContentContainerActivity.kt +55 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +6 -3
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +1 -0
- package/ios/Components/VideoFeed.swift +6 -25
- package/ios/Components/VideoFeedManager.m +1 -0
- package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
- package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +4 -12
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +2 -2
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +25 -10
- package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +2 -2
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +20 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +2 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +49 -3
- package/lib/commonjs/FWNavigator.js +7 -13
- package/lib/commonjs/FWNavigator.js.map +1 -1
- package/lib/commonjs/FireworkSDK.js +37 -1
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/LiveStream.js +2 -2
- package/lib/commonjs/LiveStream.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +2 -3
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/CartContainer.js +1 -1
- package/lib/commonjs/components/CartContainer.js.map +1 -1
- package/lib/commonjs/components/FWVideoFeed.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +30 -0
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/constants/FWErrorMessage.js.map +1 -1
- package/lib/commonjs/index.js +0 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +2 -2
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/models/VideoFeedSource.js +0 -4
- package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -1
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/modules/LiveStreamModule.js.map +1 -1
- package/lib/commonjs/utils/FWLoggerUtil.js +11 -3
- package/lib/commonjs/utils/FWLoggerUtil.js.map +1 -1
- package/lib/module/FWNavigator.js +8 -14
- package/lib/module/FWNavigator.js.map +1 -1
- package/lib/module/FireworkSDK.js +35 -1
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/LiveStream.js +4 -4
- package/lib/module/LiveStream.js.map +1 -1
- package/lib/module/VideoShopping.js +2 -3
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/CartContainer.js +1 -1
- package/lib/module/components/CartContainer.js.map +1 -1
- package/lib/module/components/FWVideoFeed.js +1 -1
- package/lib/module/components/FWVideoFeed.js.map +1 -1
- package/lib/module/components/VideoFeed.js +30 -0
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/constants/FWErrorMessage.js.map +1 -1
- package/lib/module/index.js +0 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +2 -2
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/models/VideoFeedSource.js +1 -1
- package/lib/module/modules/FWNavigatorModule.js.map +1 -1
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/modules/LiveStreamModule.js.map +1 -1
- package/lib/module/utils/FWLoggerUtil.js +11 -3
- package/lib/module/utils/FWLoggerUtil.js.map +1 -1
- package/lib/typescript/FWNavigator.d.ts +8 -7
- package/lib/typescript/FireworkSDK.d.ts +15 -1
- package/lib/typescript/LiveStream.d.ts +1 -1
- package/lib/typescript/components/VideoFeed.d.ts +8 -1
- package/lib/typescript/constants/FWErrorMessage.d.ts +1 -1
- package/lib/typescript/index.d.ts +3 -3
- package/lib/typescript/models/FWEventName.d.ts +2 -2
- package/lib/typescript/models/FeedItemDetails.d.ts +1 -1
- package/lib/typescript/models/VideoFeedSource.d.ts +1 -2
- package/lib/typescript/modules/FWNavigatorModule.d.ts +3 -1
- package/lib/typescript/modules/FireworkSDKModule.d.ts +3 -1
- package/lib/typescript/utils/FWLoggerUtil.d.ts +1 -0
- package/package.json +3 -1
- package/react-native-firework-sdk.podspec +1 -1
- package/src/FWNavigator.tsx +17 -15
- package/src/FireworkSDK.ts +35 -2
- package/src/LiveStream.ts +9 -7
- package/src/VideoShopping.ts +6 -5
- package/src/components/CartContainer.tsx +1 -1
- package/src/components/FWVideoFeed.tsx +5 -5
- package/src/components/VideoFeed.tsx +46 -14
- package/src/constants/FWErrorMessage.ts +1 -3
- package/src/index.tsx +3 -6
- package/src/models/AdBadgeConfiguration.ts +1 -1
- package/src/models/FWError.ts +1 -1
- package/src/models/FWEventName.ts +2 -2
- package/src/models/FWEvents.ts +1 -1
- package/src/models/FeedItemDetails.ts +2 -2
- package/src/models/LiveStreamEventDetails.ts +1 -1
- package/src/models/LiveStreamMessageDetails.ts +1 -1
- package/src/models/VideoFeedConfiguration.ts +2 -2
- package/src/models/VideoFeedSource.ts +6 -2
- package/src/models/VideoPlayerConfiguration.ts +2 -2
- package/src/modules/FWNavigatorModule.ts +1 -1
- package/src/modules/FireworkSDKModule.ts +3 -3
- package/src/modules/LiveStreamModule.ts +1 -5
- package/src/utils/FWLoggerUtil.ts +11 -6
- package/lib/commonjs/components/NavigationContainer.js +0 -40
- package/lib/commonjs/components/NavigationContainer.js.map +0 -1
- package/lib/module/components/NavigationContainer.js +0 -23
- package/lib/module/components/NavigationContainer.js.map +0 -1
- package/lib/typescript/components/NavigationContainer.d.ts +0 -6
- package/src/components/NavigationContainer.tsx +0 -24
package/android/build.gradle
CHANGED
|
@@ -168,7 +168,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
168
168
|
dependencies {
|
|
169
169
|
|
|
170
170
|
// optional 1: firework sdk release verison
|
|
171
|
-
def firework_sdk_version = 'v5.
|
|
171
|
+
def firework_sdk_version = 'v5.12.0'
|
|
172
172
|
implementation "com.github.loopsocial:firework_sdk:$firework_sdk_version"
|
|
173
173
|
|
|
174
174
|
// optional 2: firework sdk local version,
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
android:name="com.fireworksdk.bridge.reactnative.pages.FWContainerActivity"
|
|
16
16
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
|
17
17
|
/>
|
|
18
|
+
<activity
|
|
19
|
+
android:name="com.fireworksdk.bridge.reactnative.pages.FWCustomCTALinkContentContainerActivity"
|
|
20
|
+
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
|
21
|
+
/>
|
|
18
22
|
<provider
|
|
19
23
|
android:authorities="com.fireworksdk.bridge.reactnative"
|
|
20
24
|
android:name=".reactnative.FWInitializationProvider"
|
|
@@ -40,6 +40,7 @@ class FWVideoFeed(
|
|
|
40
40
|
videoFeedPropsModel.mode = props.mode
|
|
41
41
|
videoFeedPropsModel.videoFeedConfiguration = props.videoFeedConfiguration
|
|
42
42
|
videoFeedPropsModel.videoPlayerConfiguration = props.videoPlayerConfiguration
|
|
43
|
+
videoFeedPropsModel.dynamicContentParameters = props.dynamicContentParameters
|
|
43
44
|
}
|
|
44
45
|
setData()
|
|
45
46
|
}
|
|
@@ -69,6 +70,11 @@ class FWVideoFeed(
|
|
|
69
70
|
setData()
|
|
70
71
|
}
|
|
71
72
|
|
|
73
|
+
fun setDynamicContentParametersProps(dynamicContentParameters: HashMap<String, List<String>>?) {
|
|
74
|
+
videoFeedPropsModel.dynamicContentParameters = dynamicContentParameters
|
|
75
|
+
setData()
|
|
76
|
+
}
|
|
77
|
+
|
|
72
78
|
fun setVideoFeedConfigProps(config: FWVideoFeedConfigModel?) {
|
|
73
79
|
videoFeedPropsModel.videoFeedConfiguration = config
|
|
74
80
|
setData()
|
|
@@ -87,6 +93,7 @@ class FWVideoFeed(
|
|
|
87
93
|
private fun setData() {
|
|
88
94
|
val source = videoFeedPropsModel.source
|
|
89
95
|
val mode = videoFeedPropsModel.mode
|
|
96
|
+
val dynamicContentParameters = videoFeedPropsModel.dynamicContentParameters
|
|
90
97
|
val channel = videoFeedPropsModel.channel
|
|
91
98
|
val playlist = videoFeedPropsModel.playlist
|
|
92
99
|
val playlistGroup = videoFeedPropsModel.playlistGroup
|
|
@@ -100,14 +107,17 @@ class FWVideoFeed(
|
|
|
100
107
|
FWVideoFeedSource.PlaylistGroup.rawValue -> {
|
|
101
108
|
setPlaylistGroupFeed(mode, playlistGroup, videoFeedConfiguration, videoPlayerConfiguration)
|
|
102
109
|
}
|
|
110
|
+
FWVideoFeedSource.DynamicContent.rawValue -> {
|
|
111
|
+
setFeed(mode, channel, playlist, FeedType.DYNAMIC_CONTENT, dynamicContentParameters, videoFeedConfiguration, videoPlayerConfiguration)
|
|
112
|
+
}
|
|
103
113
|
FWVideoFeedSource.Playlist.rawValue -> {
|
|
104
|
-
setFeed(mode, channel, playlist, FeedType.PLAYLIST, videoFeedConfiguration, videoPlayerConfiguration)
|
|
114
|
+
setFeed(mode, channel, playlist, FeedType.PLAYLIST, null, videoFeedConfiguration, videoPlayerConfiguration)
|
|
105
115
|
}
|
|
106
116
|
FWVideoFeedSource.Channel.rawValue -> {
|
|
107
|
-
setFeed(mode, channel, null, FeedType.CHANNEL, videoFeedConfiguration, videoPlayerConfiguration)
|
|
117
|
+
setFeed(mode, channel, null, FeedType.CHANNEL, null, videoFeedConfiguration, videoPlayerConfiguration)
|
|
108
118
|
}
|
|
109
119
|
else -> {
|
|
110
|
-
setFeed(mode, null, null, FeedType.DISCOVER, videoFeedConfiguration, videoPlayerConfiguration)
|
|
120
|
+
setFeed(mode, null, null, FeedType.DISCOVER, null, videoFeedConfiguration, videoPlayerConfiguration)
|
|
111
121
|
}
|
|
112
122
|
}
|
|
113
123
|
}
|
|
@@ -115,6 +125,7 @@ class FWVideoFeed(
|
|
|
115
125
|
private fun setFeed(
|
|
116
126
|
mode: String?,
|
|
117
127
|
channelId: String?, playlistId: String?, feedType: FeedType?,
|
|
128
|
+
dynamicContentParameters: HashMap<String, List<String>>?,
|
|
118
129
|
videoFeedConfiguration: FWVideoFeedConfigModel?,
|
|
119
130
|
videoPlayerConfiguration: FWVideoPlayerConfigModel?,
|
|
120
131
|
) {
|
|
@@ -133,7 +144,9 @@ class FWVideoFeed(
|
|
|
133
144
|
}
|
|
134
145
|
|
|
135
146
|
// set channel playlistId feedType
|
|
136
|
-
if (feedType == FeedType.
|
|
147
|
+
if (feedType == FeedType.DYNAMIC_CONTENT && !channelId.isNullOrBlank()) {
|
|
148
|
+
videoFeedView?.setDynamicContent(channelId, dynamicContentParameters?:hashMapOf())
|
|
149
|
+
} else if (feedType == FeedType.CHANNEL && !channelId.isNullOrBlank()) {
|
|
137
150
|
videoFeedView?.setFeed(channelId, null, FeedType.CHANNEL)
|
|
138
151
|
} else if (feedType == FeedType.PLAYLIST && !channelId.isNullOrBlank() && !playlistId.isNullOrBlank()) {
|
|
139
152
|
videoFeedView?.setFeed(channelId, playlistId, FeedType.PLAYLIST)
|
|
@@ -15,4 +15,5 @@ data class FWVideoFeedPropsModel(
|
|
|
15
15
|
var mode: String? = null,
|
|
16
16
|
var videoFeedConfiguration: FWVideoFeedConfigModel? = null,
|
|
17
17
|
var videoPlayerConfiguration: FWVideoPlayerConfigModel? = null,
|
|
18
|
+
var dynamicContentParameters: HashMap<String, List<String>>? = null,
|
|
18
19
|
) : Parcelable
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt
CHANGED
|
@@ -133,6 +133,12 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
|
|
|
133
133
|
view.setModeProps(mode)
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
@ReactProp(name = "dynamicContentParameters")
|
|
137
|
+
fun setDynamicContentParameters(view: FWVideoFeed, parameters: ReadableMap?) {
|
|
138
|
+
val parametersMap = parameters?.toHashMap() as? HashMap<String, List<String>>
|
|
139
|
+
view.setDynamicContentParametersProps(parametersMap)
|
|
140
|
+
}
|
|
141
|
+
|
|
136
142
|
@ReactProp(name = "videoFeedConfiguration")
|
|
137
143
|
fun setVideoFeedConfig(view: FWVideoFeed, config: ReadableMap?) {
|
|
138
144
|
val configMap = config?.toHashMap()
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt
CHANGED
|
@@ -10,5 +10,6 @@ interface FireworkSDKInterface {
|
|
|
10
10
|
fun setShareBaseURL(url: String?, promise: Promise)
|
|
11
11
|
fun setAdBadgeConfiguration(config: ReadableMap?, promise: Promise)
|
|
12
12
|
fun setCustomCTAClickEnabled(value: Boolean?)
|
|
13
|
+
fun setCustomCTALinkContentRenderEnabled(value: Boolean?)
|
|
13
14
|
fun setVideoPlaybackEventEnabled(value: Boolean?)
|
|
14
15
|
}
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt
CHANGED
|
@@ -11,7 +11,9 @@ import com.fireworksdk.bridge.utils.*
|
|
|
11
11
|
import org.json.JSONObject
|
|
12
12
|
import com.facebook.react.bridge.ReactMethod
|
|
13
13
|
import com.fireworksdk.bridge.models.FWAdBadgeConfigModel
|
|
14
|
+
import com.fireworksdk.bridge.reactnative.FWInitializationProvider
|
|
14
15
|
import com.fireworksdk.bridge.reactnative.models.FireworkSDKInterface
|
|
16
|
+
import com.fireworksdk.bridge.reactnative.pages.FWCustomCTALinkContentContainerActivity
|
|
15
17
|
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
16
18
|
import com.loopnow.fireworklibrary.*
|
|
17
19
|
import java.util.*
|
|
@@ -38,6 +40,8 @@ class FireworkSDKModule(
|
|
|
38
40
|
@ReactMethod
|
|
39
41
|
override fun init(userId: String?) {
|
|
40
42
|
initSdk(userId)
|
|
43
|
+
|
|
44
|
+
handleCustomCTAClick()
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
/**
|
|
@@ -98,7 +102,11 @@ class FireworkSDKModule(
|
|
|
98
102
|
@ReactMethod
|
|
99
103
|
override fun setCustomCTAClickEnabled(value: Boolean?) {
|
|
100
104
|
FWVideoPlayerUtils.customCTAClickEnabled = value?:false
|
|
101
|
-
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@ReactMethod
|
|
108
|
+
override fun setCustomCTALinkContentRenderEnabled(value: Boolean?) {
|
|
109
|
+
FWVideoPlayerUtils.customCTALinkContentRenderEnabled = value?:false
|
|
102
110
|
}
|
|
103
111
|
|
|
104
112
|
@ReactMethod
|
|
@@ -171,7 +179,13 @@ class FireworkSDKModule(
|
|
|
171
179
|
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Receive CustomCTAClick event ${FWDateUtils.getDateString(Date())}")
|
|
172
180
|
|
|
173
181
|
FWEventUtils.sendCustomCTAClickEvent(reactApplicationContext, actionUrl)
|
|
174
|
-
|
|
182
|
+
|
|
183
|
+
if (FWVideoPlayerUtils.customCTALinkContentRenderEnabled) {
|
|
184
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity
|
|
185
|
+
activity?.startActivity(FWCustomCTALinkContentContainerActivity.createIntent(activity, actionUrl))
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return FWVideoPlayerUtils.customCTAClickEnabled || FWVideoPlayerUtils.customCTALinkContentRenderEnabled
|
|
175
189
|
}
|
|
176
190
|
}
|
|
177
191
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.reactnative.pages
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.content.Intent
|
|
5
|
+
import android.os.Bundle
|
|
6
|
+
import androidx.appcompat.app.AppCompatActivity
|
|
7
|
+
import androidx.fragment.app.Fragment
|
|
8
|
+
import com.facebook.react.ReactFragment
|
|
9
|
+
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
|
|
10
|
+
import com.fireworksdk.bridge.R
|
|
11
|
+
|
|
12
|
+
class FWCustomCTALinkContentContainerActivity : AppCompatActivity(), DefaultHardwareBackBtnHandler {
|
|
13
|
+
|
|
14
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
15
|
+
super.onCreate(savedInstanceState)
|
|
16
|
+
setContentView(R.layout.fw_bridge_fragment_container)
|
|
17
|
+
|
|
18
|
+
val url = intent.getStringExtra(KEY_URL)
|
|
19
|
+
|
|
20
|
+
val reactNativeFragment: Fragment = ReactFragment.Builder()
|
|
21
|
+
.setComponentName(COMPONENT_NAME)
|
|
22
|
+
.setLaunchOptions(getLaunchOptions(url))
|
|
23
|
+
.build()
|
|
24
|
+
|
|
25
|
+
supportFragmentManager
|
|
26
|
+
.beginTransaction()
|
|
27
|
+
.add(R.id.fw_bridge_container, reactNativeFragment)
|
|
28
|
+
.commit()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private fun getLaunchOptions(url: String?) = Bundle().apply {
|
|
32
|
+
if (!url.isNullOrEmpty()) {
|
|
33
|
+
putString(KEY_URL, url)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
companion object {
|
|
38
|
+
|
|
39
|
+
private const val KEY_URL = "url"
|
|
40
|
+
private const val COMPONENT_NAME = "FWCustomCTALinkContentContainer"
|
|
41
|
+
|
|
42
|
+
fun createIntent(activity: Activity, url: String?): Intent {
|
|
43
|
+
val intent = Intent(activity, FWCustomCTALinkContentContainerActivity::class.java)
|
|
44
|
+
intent.putExtra(KEY_URL, url)
|
|
45
|
+
intent.flags = Intent.FLAG_ACTIVITY_NO_ANIMATION
|
|
46
|
+
activity.overridePendingTransition(0, 0)
|
|
47
|
+
return intent
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
override fun invokeDefaultOnBackPressed() {
|
|
52
|
+
super.onBackPressed();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.fireworksdk.bridge.reactnative.utils
|
|
2
2
|
|
|
3
|
+
import android.util.Log
|
|
3
4
|
import com.facebook.react.bridge.Arguments
|
|
4
5
|
import com.facebook.react.bridge.ReactContext
|
|
5
6
|
import com.facebook.react.bridge.WritableMap
|
|
@@ -113,9 +114,11 @@ object FWEventUtils {
|
|
|
113
114
|
fun sendLogMessageEvent(reactContext: ReactContext, message: String?) {
|
|
114
115
|
FWLogUtils.d { message }
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
if (Log.DEBUG >= FWLogUtils.logLevel) {
|
|
118
|
+
val eventMap = Arguments.createMap()
|
|
119
|
+
eventMap.putString("message", message)
|
|
120
|
+
sendEvent(reactContext, FWEventName.LogMessage.rawValue, eventMap)
|
|
121
|
+
}
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
fun receiveVideoFeedLoadFinishedSuccessEvent(reactContext: ReactContext, targetTag: Int) {
|
|
@@ -16,6 +16,7 @@ import com.loopnow.fireworklibrary.views.VideoFeedView
|
|
|
16
16
|
object FWVideoPlayerUtils {
|
|
17
17
|
|
|
18
18
|
var customCTAClickEnabled: Boolean = false
|
|
19
|
+
var customCTALinkContentRenderEnabled: Boolean = false
|
|
19
20
|
var videoPlaybackEventEnabled: Boolean = false
|
|
20
21
|
|
|
21
22
|
private var hasAssignedLaunchAppWithMute = false
|
|
@@ -31,7 +31,7 @@ public enum VideoFeedMode: Int {
|
|
|
31
31
|
|
|
32
32
|
@objc
|
|
33
33
|
public enum VideFeedSourceType: Int {
|
|
34
|
-
case discover, channel, playlist, playlistGroup
|
|
34
|
+
case discover, channel, playlist, playlistGroup, dynamicContent
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
public protocol VideoFeedViewDelegate: AnyObject {
|
|
@@ -48,6 +48,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
48
48
|
@objc public var channel: String = ""
|
|
49
49
|
@objc public var playlist: String = ""
|
|
50
50
|
@objc public var playlistGroup: String = ""
|
|
51
|
+
@objc public var dynamicContentParameters: NSDictionary = NSDictionary()
|
|
51
52
|
@objc public var mode: VideoFeedMode = .row
|
|
52
53
|
@objc public var feedViewConfig: VideoFeedConfiguration? {
|
|
53
54
|
didSet {
|
|
@@ -81,6 +82,9 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
81
82
|
return .channelPlaylist(channelID: channel, playlistID: playlist)
|
|
82
83
|
case .playlistGroup:
|
|
83
84
|
return .playlistGroup(groupID: playlistGroup)
|
|
85
|
+
case .dynamicContent:
|
|
86
|
+
let parameters = dynamicContentParameters as? [String: [String]]
|
|
87
|
+
return .dynamicContent(channelID: channel, parameters: parameters ?? [:])
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
90
|
|
|
@@ -153,28 +157,6 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
extension VideoFeed {
|
|
156
|
-
private func convertToFWAdBadgeConfiguration(_ adBadgeConfiguration: AdBadgeConfiguration?) -> FireworkVideo.AdBadgeConfiguration? {
|
|
157
|
-
guard let adBadgeConfiguration = adBadgeConfiguration else {
|
|
158
|
-
return nil
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
var fwAdBadgeConfiguration = FireworkVideo.AdBadgeConfiguration()
|
|
162
|
-
if let textColor = adBadgeConfiguration.textColor {
|
|
163
|
-
fwAdBadgeConfiguration.textColor = textColor.uicolor()
|
|
164
|
-
}
|
|
165
|
-
if let backgroundColor = adBadgeConfiguration.backgroundColor {
|
|
166
|
-
fwAdBadgeConfiguration.backgroundColor = backgroundColor.uicolor()
|
|
167
|
-
}
|
|
168
|
-
switch adBadgeConfiguration.badgeTextType {
|
|
169
|
-
case .sponsored:
|
|
170
|
-
fwAdBadgeConfiguration.badgeText = FireworkVideo.AdBadgeConfiguration.BadgeText.sponsored
|
|
171
|
-
default:
|
|
172
|
-
fwAdBadgeConfiguration.badgeText = FireworkVideo.AdBadgeConfiguration.BadgeText.ad
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return fwAdBadgeConfiguration
|
|
176
|
-
}
|
|
177
|
-
|
|
178
160
|
private func convertToVideoFeedConentConfiguration() -> VideoFeedContentConfiguration {
|
|
179
161
|
var videoConfig = VideoFeedContentConfiguration()
|
|
180
162
|
//set default value so that behavior will the same with Android
|
|
@@ -196,8 +178,7 @@ extension VideoFeed {
|
|
|
196
178
|
if let shareBaseUrl = gShareBaseURL {
|
|
197
179
|
videoConfig.playerView.shareButton.behavior.baseURL = URL(string:shareBaseUrl)
|
|
198
180
|
}
|
|
199
|
-
let adBadge =
|
|
200
|
-
if let adBadge = adBadge {
|
|
181
|
+
if let adBadge = FireworkSDKModule.convertToFWAdBadgeConfiguration(gAdBadgeConfiguration) {
|
|
201
182
|
videoConfig.adBadge = adBadge
|
|
202
183
|
}
|
|
203
184
|
|
|
@@ -22,6 +22,7 @@ RCT_CUSTOM_VIEW_PROPERTY(source, VideFeedSourceType, VideoFeed) {
|
|
|
22
22
|
RCT_EXPORT_VIEW_PROPERTY(channel, NSString)
|
|
23
23
|
RCT_EXPORT_VIEW_PROPERTY(playlist, NSString)
|
|
24
24
|
RCT_EXPORT_VIEW_PROPERTY(playlistGroup, NSString)
|
|
25
|
+
RCT_EXPORT_VIEW_PROPERTY(dynamicContentParameters, NSDictionary)
|
|
25
26
|
|
|
26
27
|
RCT_CUSTOM_VIEW_PROPERTY(mode, VideoFeedMode, VideoFeed) {
|
|
27
28
|
if (json) {
|
|
@@ -2,22 +2,14 @@
|
|
|
2
2
|
// FWNavigatorContainerViewController.swift
|
|
3
3
|
// react-native-firework-sdk
|
|
4
4
|
//
|
|
5
|
-
// Created by
|
|
5
|
+
// Created by Big Bear Xiong on 2022/4/22.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import UIKit
|
|
9
9
|
|
|
10
10
|
class FWNavigatorContainerViewController: UIViewController {
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
init(callbackId: String) {
|
|
14
|
-
self.callbackId = callbackId
|
|
15
|
-
super.init(nibName: nil, bundle: nil)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
required init?(coder: NSCoder) {
|
|
19
|
-
super.init(coder: coder)
|
|
20
|
-
}
|
|
11
|
+
var moduleName: String = ""
|
|
12
|
+
var properties: [String: Any] = [:]
|
|
21
13
|
|
|
22
14
|
override func viewDidLoad() {
|
|
23
15
|
super.viewDidLoad()
|
|
@@ -25,7 +17,7 @@ class FWNavigatorContainerViewController: UIViewController {
|
|
|
25
17
|
}
|
|
26
18
|
|
|
27
19
|
private func loadContent() {
|
|
28
|
-
let rctRootView = RCTRootView.init(bridge: RCTBridge.current(), moduleName:
|
|
20
|
+
let rctRootView = RCTRootView.init(bridge: RCTBridge.current(), moduleName: moduleName, initialProperties: properties)
|
|
29
21
|
view.addSubview(rctRootView)
|
|
30
22
|
rctRootView.translatesAutoresizingMaskIntoConstraints = false
|
|
31
23
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// FWNavigatorModule.m
|
|
3
3
|
// react-native-firework-sdk
|
|
4
4
|
//
|
|
5
|
-
// Created by
|
|
5
|
+
// Created by Big Bear Xiong on 2022/4/22.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
// The FireworkNavigatorModule exposes instances of Objective-C (native) classes to JavaScript (JS) as JS objects
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
@interface RCT_EXTERN_REMAP_MODULE(FWNavigatorModule, FWNavigatorModule, NSObject)
|
|
13
13
|
|
|
14
|
-
RCT_EXTERN_METHOD(pushNativeContainer:(
|
|
14
|
+
RCT_EXTERN_METHOD(pushNativeContainer:(NSDictionary *)props resolver:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
15
15
|
RCT_EXTERN_METHOD(popNativeContainer:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
16
16
|
|
|
17
17
|
@end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// File.swift
|
|
3
3
|
// react-native-firework-sdk
|
|
4
4
|
//
|
|
5
|
-
// Created by
|
|
5
|
+
// Created by Big Bear Xiong on 2022/4/21.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import FireworkVideo
|
|
@@ -18,13 +18,20 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
@objc(pushNativeContainer:resolver:rejecter:)
|
|
21
|
-
func pushNativeContainer(_
|
|
21
|
+
func pushNativeContainer(_ props: NSDictionary?, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
|
|
22
|
+
#if DEBUG
|
|
22
23
|
let formatter = DateFormatter()
|
|
23
24
|
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
24
25
|
sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Enter pushNativeContainer \(formatter.string(from: Date()))"])
|
|
26
|
+
#endif
|
|
25
27
|
|
|
26
28
|
DispatchQueue.main.async {
|
|
27
|
-
guard let
|
|
29
|
+
guard let props = props as? [String: Any] else {
|
|
30
|
+
resolver(false)
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
guard let appComponentName = gAppComponentName else {
|
|
28
35
|
resolver(false)
|
|
29
36
|
return
|
|
30
37
|
}
|
|
@@ -33,18 +40,30 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
33
40
|
resolver(false)
|
|
34
41
|
return
|
|
35
42
|
}
|
|
43
|
+
|
|
44
|
+
#if DEBUG
|
|
36
45
|
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Before creating containerViewController \(formatter.string(from: Date()))"])
|
|
46
|
+
#endif
|
|
37
47
|
|
|
38
|
-
let containerViewController = FWNavigatorContainerViewController(
|
|
48
|
+
let containerViewController = FWNavigatorContainerViewController()
|
|
39
49
|
|
|
50
|
+
#if DEBUG
|
|
40
51
|
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] After creating containerViewController \(formatter.string(from: Date()))"])
|
|
52
|
+
#endif
|
|
41
53
|
|
|
54
|
+
containerViewController.moduleName = appComponentName
|
|
55
|
+
containerViewController.properties = props
|
|
42
56
|
containerViewController.modalPresentationStyle = .fullScreen
|
|
43
57
|
|
|
58
|
+
#if DEBUG
|
|
44
59
|
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Present containerViewController \(formatter.string(from: Date()))"])
|
|
60
|
+
#endif
|
|
45
61
|
|
|
46
62
|
presentedVC.present(containerViewController, animated: true) {
|
|
63
|
+
#if DEBUG
|
|
47
64
|
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Finish presenting containerViewController \(formatter.string(from: Date()))"])
|
|
65
|
+
#endif
|
|
66
|
+
|
|
48
67
|
resolver(true)
|
|
49
68
|
}
|
|
50
69
|
}
|
|
@@ -58,12 +77,8 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
58
77
|
return
|
|
59
78
|
}
|
|
60
79
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
resolver(true)
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
resolver(false)
|
|
80
|
+
presentedVC.dismiss(animated: true) {
|
|
81
|
+
resolver(true)
|
|
67
82
|
}
|
|
68
83
|
}
|
|
69
84
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// FWNavigatorProtocol.swift
|
|
3
3
|
// react-native-firework-sdk
|
|
4
4
|
//
|
|
5
|
-
// Created by
|
|
5
|
+
// Created by Big Bear Xiong on 2022/4/21.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
9
9
|
|
|
10
10
|
protocol FWNavigator {
|
|
11
|
-
func pushNativeContainer(_
|
|
11
|
+
func pushNativeContainer(_ props: NSDictionary?, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
|
|
12
12
|
func popNativeContainer(resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
|
|
13
13
|
}
|
|
@@ -10,12 +10,31 @@ import FireworkVideo
|
|
|
10
10
|
|
|
11
11
|
extension FireworkSDKModule: FireworkVideoCTADelegate {
|
|
12
12
|
func handleCustomCTAClick(_ viewController: PlayerViewController, url: URL) -> Bool {
|
|
13
|
+
#if DEBUG
|
|
13
14
|
let formatter = DateFormatter()
|
|
14
15
|
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
15
16
|
sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Receive CustomCTAClick event \(formatter.string(from: Date()))"])
|
|
17
|
+
#endif
|
|
16
18
|
|
|
17
19
|
sendEvent(withName: FWEventName.CustomCTAClick.rawValue, body: ["url": url.absoluteString])
|
|
20
|
+
|
|
21
|
+
var customCTALinkContentPageEnabled = false
|
|
22
|
+
if let moduleName = gAppComponentName,
|
|
23
|
+
let initialRouteName = customCTALinkContentPageRouteName,
|
|
24
|
+
let presentedVC = RCTPresentedViewController() {
|
|
25
|
+
customCTALinkContentPageEnabled = true
|
|
26
|
+
let containerViewController = FWNavigatorContainerViewController()
|
|
27
|
+
containerViewController.moduleName = moduleName
|
|
28
|
+
containerViewController.properties = [
|
|
29
|
+
"initialRouteName": initialRouteName,
|
|
30
|
+
"initialParams": ["url": url.absoluteString]
|
|
31
|
+
]
|
|
32
|
+
containerViewController.modalPresentationStyle = .fullScreen
|
|
33
|
+
presentedVC.present(containerViewController, animated: true) {
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
}
|
|
18
37
|
|
|
19
|
-
return customCTAClickEnabled
|
|
38
|
+
return customCTAClickEnabled || customCTALinkContentPageEnabled
|
|
20
39
|
}
|
|
21
40
|
}
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
_RCT_EXTERN_REMAP_METHOD(init, initializeSDK:(NSString * __nullable)userId, NO)
|
|
14
14
|
RCT_EXTERN_METHOD(openVideoPlayer:(NSString *)url config:(NSDictionary *)config)
|
|
15
15
|
RCT_EXTERN_METHOD(setCustomCTAClickEnabled:(BOOL)enabled)
|
|
16
|
+
RCT_EXTERN_METHOD(setCustomCTALinkContentPageRouteName:(NSString *)name resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
16
17
|
RCT_EXTERN_METHOD(setShareBaseURL:(NSString *)url resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
17
18
|
RCT_EXTERN_METHOD(setVideoPlaybackEventEnabled:(BOOL)enabled)
|
|
18
19
|
RCT_EXTERN_METHOD(setAdBadgeConfiguration:(NSDictionary *)config resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
20
|
+
RCT_EXTERN_METHOD(setAppComponentName:(NSString *)name resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
19
21
|
|
|
20
22
|
@end
|
|
@@ -11,12 +11,15 @@ import FireworkVideo
|
|
|
11
11
|
|
|
12
12
|
var gShareBaseURL: String?
|
|
13
13
|
var gAdBadgeConfiguration: AdBadgeConfiguration?
|
|
14
|
+
var gAppComponentName: String?
|
|
14
15
|
|
|
15
16
|
@objc(FireworkSDKModule)
|
|
16
17
|
class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
17
18
|
// var shareBaseURL: String?
|
|
18
19
|
var customCTAClickEnabled: Bool = false
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
var customCTALinkContentPageRouteName: String?
|
|
22
|
+
|
|
20
23
|
/// Decide whether to send video playback event to RN.
|
|
21
24
|
var enableVideoPlayBackEvent: Bool = false
|
|
22
25
|
|
|
@@ -48,13 +51,20 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
48
51
|
if let baseUrl = gShareBaseURL {
|
|
49
52
|
finalConfig.shareButton.behavior.baseURL = URL(string: baseUrl)
|
|
50
53
|
}
|
|
54
|
+
|
|
55
|
+
var feedContentConfig = VideoFeedContentConfiguration()
|
|
56
|
+
feedContentConfig.playerView = finalConfig
|
|
57
|
+
if let adBadge = FireworkSDKModule.convertToFWAdBadgeConfiguration(gAdBadgeConfiguration) {
|
|
58
|
+
feedContentConfig.adBadge = adBadge;
|
|
59
|
+
}
|
|
51
60
|
|
|
52
61
|
DispatchQueue.main.async {
|
|
53
62
|
guard let presentedVC = RCTPresentedViewController() else {
|
|
54
63
|
return
|
|
55
64
|
}
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
|
|
66
|
+
VideoFeedViewController.openVideoPlayer(with: urlString, feedContentConfig, presentedVC) { _ in
|
|
67
|
+
|
|
58
68
|
}
|
|
59
69
|
}
|
|
60
70
|
}
|
|
@@ -63,6 +73,12 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
63
73
|
func setCustomCTAClickEnabled(_ enabled: Bool) {
|
|
64
74
|
customCTAClickEnabled = enabled
|
|
65
75
|
}
|
|
76
|
+
|
|
77
|
+
@objc(setCustomCTALinkContentPageRouteName:resolver:rejecter:)
|
|
78
|
+
func setCustomCTALinkContentPageRouteName(_ name: String, resolver: RCTPromiseResolveBlock, rejecter: RCTPromiseRejectBlock) {
|
|
79
|
+
customCTALinkContentPageRouteName = name
|
|
80
|
+
resolver([:])
|
|
81
|
+
}
|
|
66
82
|
|
|
67
83
|
@objc(setShareBaseURL:resolver:rejecter:)
|
|
68
84
|
func setShareBaseURL(_ url: String, resolver: RCTPromiseResolveBlock, rejecter: RCTPromiseRejectBlock) {
|
|
@@ -80,6 +96,12 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
80
96
|
gAdBadgeConfiguration = RCTConvert.adBadgeConfiguration(config)
|
|
81
97
|
resolver([:])
|
|
82
98
|
}
|
|
99
|
+
|
|
100
|
+
@objc(setAppComponentName:resolver:rejecter:)
|
|
101
|
+
func setAppComponentName(_ name: String, resolver: RCTPromiseResolveBlock, rejecter: RCTPromiseRejectBlock) {
|
|
102
|
+
gAppComponentName = name
|
|
103
|
+
resolver([:])
|
|
104
|
+
}
|
|
83
105
|
|
|
84
106
|
// MARK: - FireworkVideoSDKDelegate
|
|
85
107
|
func fireworkVideoDidLoadSuccessfully() {
|
|
@@ -90,3 +112,27 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
90
112
|
sendEvent(withName: FWEventName.SDKInit.rawValue, body: ["error": ["name": error.jsErrorName, "reason": error.recoverySuggestion ?? "default"]])
|
|
91
113
|
}
|
|
92
114
|
}
|
|
115
|
+
|
|
116
|
+
extension FireworkSDKModule {
|
|
117
|
+
static func convertToFWAdBadgeConfiguration(_ adBadgeConfiguration: AdBadgeConfiguration?) -> FireworkVideo.AdBadgeConfiguration? {
|
|
118
|
+
guard let adBadgeConfiguration = adBadgeConfiguration else {
|
|
119
|
+
return nil
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
var fwAdBadgeConfiguration = FireworkVideo.AdBadgeConfiguration()
|
|
123
|
+
if let textColor = adBadgeConfiguration.textColor {
|
|
124
|
+
fwAdBadgeConfiguration.textColor = textColor.uicolor()
|
|
125
|
+
}
|
|
126
|
+
if let backgroundColor = adBadgeConfiguration.backgroundColor {
|
|
127
|
+
fwAdBadgeConfiguration.backgroundColor = backgroundColor.uicolor()
|
|
128
|
+
}
|
|
129
|
+
switch adBadgeConfiguration.badgeTextType {
|
|
130
|
+
case .sponsored:
|
|
131
|
+
fwAdBadgeConfiguration.badgeText = FireworkVideo.AdBadgeConfiguration.BadgeText.sponsored
|
|
132
|
+
default:
|
|
133
|
+
fwAdBadgeConfiguration.badgeText = FireworkVideo.AdBadgeConfiguration.BadgeText.ad
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return fwAdBadgeConfiguration
|
|
137
|
+
}
|
|
138
|
+
}
|