react-native-firework-sdk 1.2.0-beta.1 → 1.2.0-beta.7
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/FWEventName.kt +1 -0
- 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 +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +10 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +23 -5
- 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 +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWDateUtils.kt +15 -0
- 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/FireworkSdk.xcodeproj/project.pbxproj +4 -4
- package/ios/Models/NativeToRN/FireworkEventName.swift +1 -0
- package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +0 -20
- package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
- package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +1 -1
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +15 -7
- package/ios/Modules/FireworkSDKModule/FWCustomCTALinkContentContainerViewController.swift +31 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +14 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +2 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +43 -31
- package/lib/commonjs/FWNavigator.js +19 -7
- package/lib/commonjs/FWNavigator.js.map +1 -1
- package/lib/commonjs/FireworkSDK.js +35 -3
- 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/CustomCTALinkContentContainer.js +43 -0
- package/lib/commonjs/components/CustomCTALinkContentContainer.js.map +1 -0
- package/lib/commonjs/components/FWVideoFeed.js.map +1 -1
- package/lib/commonjs/components/NavigationContainer.js +4 -0
- package/lib/commonjs/components/NavigationContainer.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 +4 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +3 -2
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/models/VideoFeedSource.js +0 -4
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/modules/LiveStreamModule.js.map +1 -1
- package/lib/commonjs/utils/FWLoggerUtil.js +41 -0
- package/lib/commonjs/utils/FWLoggerUtil.js.map +1 -0
- package/lib/module/FWNavigator.js +12 -7
- package/lib/module/FWNavigator.js.map +1 -1
- package/lib/module/FireworkSDK.js +31 -3
- 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/CustomCTALinkContentContainer.js +26 -0
- package/lib/module/components/CustomCTALinkContentContainer.js.map +1 -0
- package/lib/module/components/FWVideoFeed.js +1 -1
- package/lib/module/components/FWVideoFeed.js.map +1 -1
- package/lib/module/components/NavigationContainer.js +2 -0
- package/lib/module/components/NavigationContainer.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 +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +3 -2
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/models/VideoFeedSource.js +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 +32 -0
- package/lib/module/utils/FWLoggerUtil.js.map +1 -0
- package/lib/typescript/FWNavigator.d.ts +1 -0
- package/lib/typescript/FireworkSDK.d.ts +10 -3
- package/lib/typescript/LiveStream.d.ts +1 -1
- package/lib/typescript/components/CustomCTALinkContentContainer.d.ts +6 -0
- 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 -4
- package/lib/typescript/models/FWEventName.d.ts +4 -3
- package/lib/typescript/models/FeedItemDetails.d.ts +1 -1
- package/lib/typescript/models/VideoFeedSource.d.ts +1 -2
- package/lib/typescript/modules/FireworkSDKModule.d.ts +4 -4
- package/lib/typescript/utils/FWLoggerUtil.d.ts +5 -0
- package/package.json +3 -1
- package/react-native-firework-sdk.podspec +1 -1
- package/src/FWNavigator.tsx +11 -2
- package/src/FireworkSDK.ts +39 -4
- package/src/LiveStream.ts +9 -7
- package/src/VideoShopping.ts +6 -5
- package/src/components/CartContainer.tsx +1 -1
- package/src/components/CustomCTALinkContentContainer.tsx +28 -0
- package/src/components/FWVideoFeed.tsx +5 -5
- package/src/components/NavigationContainer.tsx +2 -0
- package/src/components/VideoFeed.tsx +46 -14
- package/src/constants/FWErrorMessage.ts +1 -3
- package/src/index.tsx +8 -3
- package/src/models/AdBadgeConfiguration.ts +1 -1
- package/src/models/FWError.ts +1 -1
- package/src/models/FWEventName.ts +3 -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/FireworkSDKModule.ts +4 -6
- package/src/modules/LiveStreamModule.ts +1 -5
- package/src/utils/FWLoggerUtil.ts +39 -0
- package/ios/Modules/FireworkSDKModule/MobileADConfiguration.swift +0 -17
- package/lib/commonjs/models/AdConfig.js +0 -2
- package/lib/commonjs/models/AdConfig.js.map +0 -1
- package/lib/module/models/AdConfig.js +0 -2
- package/lib/module/models/AdConfig.js.map +0 -1
- package/lib/typescript/models/AdConfig.d.ts +0 -10
- package/src/models/AdConfig.ts +0 -10
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
|
@@ -5,10 +5,11 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
5
5
|
|
|
6
6
|
interface FireworkSDKInterface {
|
|
7
7
|
|
|
8
|
-
fun init(userId: String
|
|
8
|
+
fun init(userId: String?)
|
|
9
9
|
fun openVideoPlayer(url: String, config: ReadableMap?)
|
|
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/FWNavigatorModule.kt
CHANGED
|
@@ -4,7 +4,10 @@ import com.facebook.react.bridge.*
|
|
|
4
4
|
import com.fireworksdk.bridge.reactnative.FWInitializationProvider
|
|
5
5
|
import com.fireworksdk.bridge.reactnative.models.FWNavigatorInterface
|
|
6
6
|
import com.fireworksdk.bridge.reactnative.pages.FWContainerActivity
|
|
7
|
+
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
8
|
+
import com.fireworksdk.bridge.utils.FWDateUtils
|
|
7
9
|
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
10
|
+
import java.util.*
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
class FWNavigatorModule(
|
|
@@ -21,8 +24,15 @@ class FWNavigatorModule(
|
|
|
21
24
|
return
|
|
22
25
|
}
|
|
23
26
|
|
|
27
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Enter pushNativeContainer ${FWDateUtils.getDateString(Date())}")
|
|
28
|
+
|
|
24
29
|
UiThreadUtil.runOnUiThread {
|
|
30
|
+
|
|
31
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Before Starting container activity ${FWDateUtils.getDateString(Date())}")
|
|
32
|
+
|
|
25
33
|
activity.startActivity(FWContainerActivity.createIntent(activity, callbackId))
|
|
34
|
+
|
|
35
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] After Starting container activity ${FWDateUtils.getDateString(Date())}")
|
|
26
36
|
}
|
|
27
37
|
promise.resolve(true)
|
|
28
38
|
}
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt
CHANGED
|
@@ -11,9 +11,12 @@ 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.*
|
|
19
|
+
import java.util.*
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
class FireworkSDKModule(
|
|
@@ -35,8 +38,10 @@ class FireworkSDKModule(
|
|
|
35
38
|
* If id passed is not unique, it will affect the quality of content recommended to the user.
|
|
36
39
|
*/
|
|
37
40
|
@ReactMethod
|
|
38
|
-
override fun init(userId: String
|
|
39
|
-
|
|
41
|
+
override fun init(userId: String?) {
|
|
42
|
+
initSdk(userId)
|
|
43
|
+
|
|
44
|
+
handleCustomCTAClick()
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
/**
|
|
@@ -97,7 +102,11 @@ class FireworkSDKModule(
|
|
|
97
102
|
@ReactMethod
|
|
98
103
|
override fun setCustomCTAClickEnabled(value: Boolean?) {
|
|
99
104
|
FWVideoPlayerUtils.customCTAClickEnabled = value?:false
|
|
100
|
-
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@ReactMethod
|
|
108
|
+
override fun setCustomCTALinkContentRenderEnabled(value: Boolean?) {
|
|
109
|
+
FWVideoPlayerUtils.customCTALinkContentRenderEnabled = value?:false
|
|
101
110
|
}
|
|
102
111
|
|
|
103
112
|
@ReactMethod
|
|
@@ -106,7 +115,7 @@ class FireworkSDKModule(
|
|
|
106
115
|
handleVideoPlaybackEvent()
|
|
107
116
|
}
|
|
108
117
|
|
|
109
|
-
private fun
|
|
118
|
+
private fun initSdk(userId: String?) {
|
|
110
119
|
val clientId = getAppid()
|
|
111
120
|
if (clientId.isNullOrBlank()) {
|
|
112
121
|
val errorMsg = "The appid is invalid"
|
|
@@ -166,8 +175,17 @@ class FireworkSDKModule(
|
|
|
166
175
|
FwSDK.ctaClickHandler = object: FwSDK.CtaClickHandler {
|
|
167
176
|
override fun ctaClicked(label: String, actionUrl: String?): Boolean {
|
|
168
177
|
FWLogUtils.d { "ctaClicked" }
|
|
178
|
+
|
|
179
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Receive CustomCTAClick event ${FWDateUtils.getDateString(Date())}")
|
|
180
|
+
|
|
169
181
|
FWEventUtils.sendCustomCTAClickEvent(reactApplicationContext, actionUrl)
|
|
170
|
-
|
|
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
|
|
171
189
|
}
|
|
172
190
|
}
|
|
173
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
|
+
}
|
|
@@ -6,6 +6,7 @@ import com.facebook.react.bridge.WritableMap
|
|
|
6
6
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
7
7
|
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
8
8
|
import com.fireworksdk.bridge.models.*
|
|
9
|
+
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
9
10
|
import com.loopnow.fireworklibrary.data.Product
|
|
10
11
|
|
|
11
12
|
object FWEventUtils {
|
|
@@ -109,6 +110,14 @@ object FWEventUtils {
|
|
|
109
110
|
.emit(eventName, params)
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
fun sendLogMessageEvent(reactContext: ReactContext, message: String?) {
|
|
114
|
+
FWLogUtils.d { message }
|
|
115
|
+
|
|
116
|
+
val eventMap = Arguments.createMap()
|
|
117
|
+
eventMap.putString("message", message)
|
|
118
|
+
sendEvent(reactContext, FWEventName.LogMessage.rawValue, eventMap)
|
|
119
|
+
}
|
|
120
|
+
|
|
112
121
|
fun receiveVideoFeedLoadFinishedSuccessEvent(reactContext: ReactContext, targetTag: Int) {
|
|
113
122
|
receiveEvent(reactContext, targetTag, FWFeedViewEventName.VideoFeedLoadFinished.rawValue, null)
|
|
114
123
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.utils
|
|
2
|
+
|
|
3
|
+
import org.jetbrains.annotations.NotNull
|
|
4
|
+
import java.text.DateFormat
|
|
5
|
+
import java.text.SimpleDateFormat
|
|
6
|
+
import java.util.*
|
|
7
|
+
|
|
8
|
+
object FWDateUtils {
|
|
9
|
+
|
|
10
|
+
fun getDateString(@NotNull date: Date): String {
|
|
11
|
+
val dateFormat: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())
|
|
12
|
+
dateFormat.timeZone = TimeZone.getDefault()
|
|
13
|
+
return dateFormat.format(date)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -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) {
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
897523962817DEF80070EBB6 /* ProductInfoViewConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8975237A2817DEF80070EBB6 /* ProductInfoViewConfiguration.swift */; };
|
|
31
31
|
897523972817DEF80070EBB6 /* Product.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8975237B2817DEF80070EBB6 /* Product.swift */; };
|
|
32
32
|
897523982817DEF80070EBB6 /* ShoppingModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8975237C2817DEF80070EBB6 /* ShoppingModule.swift */; };
|
|
33
|
-
897523992817DEF80070EBB6 /* MobileADConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8975237E2817DEF80070EBB6 /* MobileADConfiguration.swift */; };
|
|
34
33
|
8975239A2817DEF80070EBB6 /* FireworkSDKModule+EventTracking.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8975237F2817DEF80070EBB6 /* FireworkSDKModule+EventTracking.swift */; };
|
|
35
34
|
8975239B2817DEF80070EBB6 /* FireworkSDKModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 897523802817DEF80070EBB6 /* FireworkSDKModule.swift */; };
|
|
36
35
|
8975239C2817DEF80070EBB6 /* AdBadgeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 897523812817DEF80070EBB6 /* AdBadgeConfiguration.swift */; };
|
|
@@ -38,6 +37,7 @@
|
|
|
38
37
|
8975239E2817DEF80070EBB6 /* FireworkSDKModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 897523832817DEF80070EBB6 /* FireworkSDKModule.m */; };
|
|
39
38
|
8975239F2817DEF80070EBB6 /* LiveStreamModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 897523852817DEF80070EBB6 /* LiveStreamModule.swift */; };
|
|
40
39
|
897523A02817DEF80070EBB6 /* LiveStreamModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 897523862817DEF80070EBB6 /* LiveStreamModule.m */; };
|
|
40
|
+
89BA1734283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89BA1733283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift */; };
|
|
41
41
|
/* End PBXBuildFile section */
|
|
42
42
|
|
|
43
43
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
8975237A2817DEF80070EBB6 /* ProductInfoViewConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductInfoViewConfiguration.swift; sourceTree = "<group>"; };
|
|
80
80
|
8975237B2817DEF80070EBB6 /* Product.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Product.swift; sourceTree = "<group>"; };
|
|
81
81
|
8975237C2817DEF80070EBB6 /* ShoppingModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShoppingModule.swift; sourceTree = "<group>"; };
|
|
82
|
-
8975237E2817DEF80070EBB6 /* MobileADConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MobileADConfiguration.swift; sourceTree = "<group>"; };
|
|
83
82
|
8975237F2817DEF80070EBB6 /* FireworkSDKModule+EventTracking.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FireworkSDKModule+EventTracking.swift"; sourceTree = "<group>"; };
|
|
84
83
|
897523802817DEF80070EBB6 /* FireworkSDKModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FireworkSDKModule.swift; sourceTree = "<group>"; };
|
|
85
84
|
897523812817DEF80070EBB6 /* AdBadgeConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdBadgeConfiguration.swift; sourceTree = "<group>"; };
|
|
@@ -87,6 +86,7 @@
|
|
|
87
86
|
897523832817DEF80070EBB6 /* FireworkSDKModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FireworkSDKModule.m; sourceTree = "<group>"; };
|
|
88
87
|
897523852817DEF80070EBB6 /* LiveStreamModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LiveStreamModule.swift; sourceTree = "<group>"; };
|
|
89
88
|
897523862817DEF80070EBB6 /* LiveStreamModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LiveStreamModule.m; sourceTree = "<group>"; };
|
|
89
|
+
89BA1733283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FWCustomCTALinkContentContainerViewController.swift; sourceTree = "<group>"; };
|
|
90
90
|
/* End PBXFileReference section */
|
|
91
91
|
|
|
92
92
|
/* Begin PBXFrameworksBuildPhase section */
|
|
@@ -209,12 +209,12 @@
|
|
|
209
209
|
8975237D2817DEF80070EBB6 /* FireworkSDKModule */ = {
|
|
210
210
|
isa = PBXGroup;
|
|
211
211
|
children = (
|
|
212
|
-
8975237E2817DEF80070EBB6 /* MobileADConfiguration.swift */,
|
|
213
212
|
8975237F2817DEF80070EBB6 /* FireworkSDKModule+EventTracking.swift */,
|
|
214
213
|
897523802817DEF80070EBB6 /* FireworkSDKModule.swift */,
|
|
215
214
|
897523812817DEF80070EBB6 /* AdBadgeConfiguration.swift */,
|
|
216
215
|
897523822817DEF80070EBB6 /* FireworkSDKModule+CTA.swift */,
|
|
217
216
|
897523832817DEF80070EBB6 /* FireworkSDKModule.m */,
|
|
217
|
+
89BA1733283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift */,
|
|
218
218
|
);
|
|
219
219
|
path = FireworkSDKModule;
|
|
220
220
|
sourceTree = "<group>";
|
|
@@ -290,7 +290,6 @@
|
|
|
290
290
|
897523952817DEF80070EBB6 /* ShoppingModule.m in Sources */,
|
|
291
291
|
897523A02817DEF80070EBB6 /* LiveStreamModule.m in Sources */,
|
|
292
292
|
8975238E2817DEF80070EBB6 /* FireworkSDK+Json.swift in Sources */,
|
|
293
|
-
897523992817DEF80070EBB6 /* MobileADConfiguration.swift in Sources */,
|
|
294
293
|
8975235F2817DEEE0070EBB6 /* VideoFeedConfiguration.swift in Sources */,
|
|
295
294
|
897523612817DEEE0070EBB6 /* VideoPlayerConfiguration.swift in Sources */,
|
|
296
295
|
897523972817DEF80070EBB6 /* Product.swift in Sources */,
|
|
@@ -305,6 +304,7 @@
|
|
|
305
304
|
8975239A2817DEF80070EBB6 /* FireworkSDKModule+EventTracking.swift in Sources */,
|
|
306
305
|
8975239E2817DEF80070EBB6 /* FireworkSDKModule.m in Sources */,
|
|
307
306
|
897523962817DEF80070EBB6 /* ProductInfoViewConfiguration.swift in Sources */,
|
|
307
|
+
89BA1734283619FE00C2287A /* FWCustomCTALinkContentContainerViewController.swift in Sources */,
|
|
308
308
|
8975238D2817DEF80070EBB6 /* RCTConvert+VideoFeed.swift in Sources */,
|
|
309
309
|
8975238C2817DEF80070EBB6 /* RCTConvert+Shopping.swift in Sources */,
|
|
310
310
|
897523602817DEEE0070EBB6 /* VideoFeed.swift in Sources */,
|
|
@@ -15,6 +15,7 @@ enum FWEventName: String, CaseIterable {
|
|
|
15
15
|
case VideoFeedClick = "fw:video-feed-click"
|
|
16
16
|
case ShareBaseURLUpdated = "fw:share-base-url-updated" //emitted in JS side
|
|
17
17
|
case AdBadgeConfigurationUpdated = "fw:ad-badge-configuration-updated" //emitted in JS side
|
|
18
|
+
case LogMessage = "fw:log-message"
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
enum VideoPlaybackSubEventName: String {
|
|
@@ -69,26 +69,6 @@ extension RCTConvert {
|
|
|
69
69
|
return btnContentConfig
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
static func mobileADConfiguration(_ config: [String: AnyObject]?) -> MobileADConfiguration? {
|
|
73
|
-
guard let rConfig = config else {
|
|
74
|
-
return nil
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
let jsonData = try? JSONSerialization.data(withJSONObject: rConfig, options: .prettyPrinted)
|
|
78
|
-
guard let rJsonData = jsonData else {
|
|
79
|
-
return nil
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var result: MobileADConfiguration?
|
|
83
|
-
do {
|
|
84
|
-
result = try JSONDecoder().decode(MobileADConfiguration.self, from: rJsonData)
|
|
85
|
-
} catch let error {
|
|
86
|
-
print(error.localizedDescription)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return result
|
|
90
|
-
}
|
|
91
|
-
|
|
92
72
|
static func adBadgeConfiguration(_ config: [String: AnyObject]?) -> AdBadgeConfiguration? {
|
|
93
73
|
guard let rConfig = config else {
|
|
94
74
|
return nil
|
|
@@ -10,7 +10,7 @@ import FireworkVideo
|
|
|
10
10
|
@objc(FWNavigatorModule)
|
|
11
11
|
class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
12
12
|
override func supportedEvents() -> [String]! {
|
|
13
|
-
return []
|
|
13
|
+
return [FWEventName.LogMessage.rawValue]
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
override class func requiresMainQueueSetup() -> Bool {
|
|
@@ -19,6 +19,10 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
19
19
|
|
|
20
20
|
@objc(pushNativeContainer:resolver:rejecter:)
|
|
21
21
|
func pushNativeContainer(_ callbackId: String?, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
|
|
22
|
+
let formatter = DateFormatter()
|
|
23
|
+
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
24
|
+
sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Enter pushNativeContainer \(formatter.string(from: Date()))"])
|
|
25
|
+
|
|
22
26
|
DispatchQueue.main.async {
|
|
23
27
|
guard let callbackId = callbackId else {
|
|
24
28
|
resolver(false)
|
|
@@ -29,10 +33,18 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
29
33
|
resolver(false)
|
|
30
34
|
return
|
|
31
35
|
}
|
|
36
|
+
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Before creating containerViewController \(formatter.string(from: Date()))"])
|
|
37
|
+
|
|
32
38
|
let containerViewController = FWNavigatorContainerViewController(callbackId: callbackId)
|
|
39
|
+
|
|
40
|
+
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] After creating containerViewController \(formatter.string(from: Date()))"])
|
|
41
|
+
|
|
33
42
|
containerViewController.modalPresentationStyle = .fullScreen
|
|
34
43
|
|
|
44
|
+
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Present containerViewController \(formatter.string(from: Date()))"])
|
|
45
|
+
|
|
35
46
|
presentedVC.present(containerViewController, animated: true) {
|
|
47
|
+
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Finish presenting containerViewController \(formatter.string(from: Date()))"])
|
|
36
48
|
resolver(true)
|
|
37
49
|
}
|
|
38
50
|
}
|
|
@@ -46,12 +58,8 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
46
58
|
return
|
|
47
59
|
}
|
|
48
60
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
resolver(true)
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
resolver(false)
|
|
61
|
+
presentedVC.dismiss(animated: true) {
|
|
62
|
+
resolver(true)
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
65
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FWCustomCTALinkContentContainerViewController.swift
|
|
3
|
+
// FireworkSdk
|
|
4
|
+
//
|
|
5
|
+
// Created by linjie jiang on 2022/5/19.
|
|
6
|
+
// Copyright © 2022 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import UIKit
|
|
10
|
+
|
|
11
|
+
class FWCustomCTALinkContentContainerViewController: UIViewController {
|
|
12
|
+
var url: String?
|
|
13
|
+
|
|
14
|
+
override func viewDidLoad() {
|
|
15
|
+
super.viewDidLoad()
|
|
16
|
+
loadContent()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private func loadContent() {
|
|
20
|
+
let rctRootView = RCTRootView.init(bridge: RCTBridge.current(), moduleName: "FWCustomCTALinkContentContainer", initialProperties: ["url": url ?? ""])
|
|
21
|
+
view.addSubview(rctRootView)
|
|
22
|
+
rctRootView.translatesAutoresizingMaskIntoConstraints = false
|
|
23
|
+
|
|
24
|
+
NSLayoutConstraint.activate([
|
|
25
|
+
rctRootView.leftAnchor.constraint(equalTo: view.leftAnchor),
|
|
26
|
+
rctRootView.topAnchor.constraint(equalTo: view.topAnchor),
|
|
27
|
+
rctRootView.rightAnchor.constraint(equalTo: view.rightAnchor),
|
|
28
|
+
rctRootView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
|
29
|
+
])
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -10,8 +10,21 @@ import FireworkVideo
|
|
|
10
10
|
|
|
11
11
|
extension FireworkSDKModule: FireworkVideoCTADelegate {
|
|
12
12
|
func handleCustomCTAClick(_ viewController: PlayerViewController, url: URL) -> Bool {
|
|
13
|
+
let formatter = DateFormatter()
|
|
14
|
+
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
15
|
+
sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Receive CustomCTAClick event \(formatter.string(from: Date()))"])
|
|
16
|
+
|
|
13
17
|
sendEvent(withName: FWEventName.CustomCTAClick.rawValue, body: ["url": url.absoluteString])
|
|
18
|
+
|
|
19
|
+
if customCTALinkContentRenderEnabled, let presentedVC = RCTPresentedViewController() {
|
|
20
|
+
let customCTALinkContentContainerVC = FWCustomCTALinkContentContainerViewController()
|
|
21
|
+
customCTALinkContentContainerVC.modalPresentationStyle = .fullScreen
|
|
22
|
+
customCTALinkContentContainerVC.url = url.absoluteString
|
|
23
|
+
presentedVC.present(customCTALinkContentContainerVC, animated: true) {
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
}
|
|
14
27
|
|
|
15
|
-
return customCTAClickEnabled
|
|
28
|
+
return customCTAClickEnabled || customCTALinkContentRenderEnabled
|
|
16
29
|
}
|
|
17
30
|
}
|