react-native-firework-sdk 1.1.1 → 1.2.0-beta.6
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/gradlew +0 -0
- package/android/src/main/AndroidManifest.xml +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/FireworkSDKPackage.kt +3 -1
- 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/FWInitializationProvider.kt +99 -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/FWNavigatorInterface.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +74 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +6 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +7 -6
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWContainerActivity.kt +54 -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/res/layout/fw_bridge_fragment_container.xml +8 -0
- package/ios/Components/VideoFeed.swift +6 -25
- package/ios/Components/VideoFeedManager.m +1 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +206 -18
- 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 +40 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +17 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +67 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +13 -0
- 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 +72 -0
- package/lib/commonjs/FWNavigator.js.map +1 -0
- package/lib/commonjs/FireworkSDK.js +45 -3
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +0 -1
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/CustomCTALinkContentContainer.js +39 -0
- package/lib/commonjs/components/CustomCTALinkContentContainer.js.map +1 -0
- package/lib/commonjs/components/NavigationContainer.js +40 -0
- package/lib/commonjs/components/NavigationContainer.js.map +1 -0
- package/lib/commonjs/components/VideoFeed.js +30 -0
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js +18 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +1 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/modules/FWNavigatorModule.js +22 -0
- package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.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 +55 -0
- package/lib/module/FWNavigator.js.map +1 -0
- package/lib/module/FireworkSDK.js +40 -3
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +0 -1
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/CustomCTALinkContentContainer.js +24 -0
- package/lib/module/components/CustomCTALinkContentContainer.js.map +1 -0
- package/lib/module/components/NavigationContainer.js +23 -0
- package/lib/module/components/NavigationContainer.js.map +1 -0
- package/lib/module/components/VideoFeed.js +30 -0
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js +7 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +1 -0
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/modules/FWNavigatorModule.js +13 -0
- package/lib/module/modules/FWNavigatorModule.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.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 +23 -0
- package/lib/typescript/FireworkSDK.d.ts +15 -3
- package/lib/typescript/components/CustomCTALinkContentContainer.d.ts +6 -0
- package/lib/typescript/components/NavigationContainer.d.ts +6 -0
- package/lib/typescript/components/VideoFeed.d.ts +7 -0
- package/lib/typescript/index.d.ts +4 -4
- package/lib/typescript/models/FWEventName.d.ts +2 -1
- package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
- package/lib/typescript/modules/FWNavigatorModule.d.ts +9 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +4 -4
- package/lib/typescript/utils/FWLoggerUtil.d.ts +5 -0
- package/package.json +1 -1
- package/react-native-firework-sdk.podspec +1 -1
- package/src/FWNavigator.tsx +47 -0
- package/src/FireworkSDK.ts +50 -5
- package/src/VideoShopping.ts +0 -1
- package/src/components/CustomCTALinkContentContainer.tsx +26 -0
- package/src/components/NavigationContainer.tsx +24 -0
- package/src/components/VideoFeed.tsx +45 -13
- package/src/index.tsx +16 -4
- package/src/models/FWEventName.ts +1 -0
- package/src/models/VideoFeedSource.ts +1 -1
- package/src/modules/FWNavigatorModule.ts +22 -0
- package/src/modules/FireworkSDKModule.ts +4 -6
- 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,
|
package/android/gradlew
CHANGED
|
File without changes
|
|
@@ -11,6 +11,15 @@
|
|
|
11
11
|
android:name="com.fireworksdk.bridge.reactnative.pages.FWVideoShoppingCartActivity"
|
|
12
12
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
|
13
13
|
/>
|
|
14
|
+
<activity
|
|
15
|
+
android:name="com.fireworksdk.bridge.reactnative.pages.FWContainerActivity"
|
|
16
|
+
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
|
17
|
+
/>
|
|
18
|
+
<provider
|
|
19
|
+
android:authorities="com.fireworksdk.bridge.reactnative"
|
|
20
|
+
android:name=".reactnative.FWInitializationProvider"
|
|
21
|
+
android:exported="false"
|
|
22
|
+
/>
|
|
14
23
|
<meta-data
|
|
15
24
|
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
|
|
16
25
|
android:value="true" />
|
|
@@ -6,6 +6,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager
|
|
7
7
|
import com.fireworksdk.bridge.reactnative.manager.FWVideoFeedManager
|
|
8
8
|
import com.fireworksdk.bridge.reactnative.module.FWLiveStreamModule
|
|
9
|
+
import com.fireworksdk.bridge.reactnative.module.FWNavigatorModule
|
|
9
10
|
import com.fireworksdk.bridge.reactnative.module.FWVideoShoppingModule
|
|
10
11
|
import com.fireworksdk.bridge.reactnative.module.FireworkSDKModule
|
|
11
12
|
|
|
@@ -15,7 +16,8 @@ class FireworkSDKPackage : ReactPackage {
|
|
|
15
16
|
return listOf(
|
|
16
17
|
FireworkSDKModule(reactContext),
|
|
17
18
|
FWVideoShoppingModule(reactContext),
|
|
18
|
-
FWLiveStreamModule(reactContext)
|
|
19
|
+
FWLiveStreamModule(reactContext),
|
|
20
|
+
FWNavigatorModule(reactContext)
|
|
19
21
|
)
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -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
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.reactnative
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.app.Application
|
|
5
|
+
import android.content.ContentProvider
|
|
6
|
+
import android.content.ContentValues
|
|
7
|
+
import android.database.Cursor
|
|
8
|
+
import android.net.Uri
|
|
9
|
+
import android.os.Bundle
|
|
10
|
+
import com.fireworksdk.bridge.models.weakProperty
|
|
11
|
+
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
12
|
+
|
|
13
|
+
class FWInitializationProvider: ContentProvider() {
|
|
14
|
+
|
|
15
|
+
var application: Application? = null
|
|
16
|
+
var resumedActivity by weakProperty<Activity?>()
|
|
17
|
+
|
|
18
|
+
override fun onCreate(): Boolean {
|
|
19
|
+
sInstance = this
|
|
20
|
+
val context = context
|
|
21
|
+
if (context != null) {
|
|
22
|
+
// Many Initializer's expect the `applicationContext` to be non-null. This
|
|
23
|
+
// typically happens when `android:sharedUid` is used. In such cases, we postpone
|
|
24
|
+
// initialization altogether, and rely on lazy init.
|
|
25
|
+
// More context: b/196959015
|
|
26
|
+
val applicationContext = context.applicationContext as Application?
|
|
27
|
+
application = applicationContext
|
|
28
|
+
|
|
29
|
+
if (applicationContext != null) {
|
|
30
|
+
applicationContext.registerActivityLifecycleCallbacks(object : Application.ActivityLifecycleCallbacks {
|
|
31
|
+
override fun onActivityCreated(activity: Activity, bundle: Bundle?) {
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun onActivityStarted(activity: Activity) {
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun onActivityResumed(activity: Activity) {
|
|
38
|
+
resumedActivity = activity
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun onActivityPaused(activity: Activity) {
|
|
42
|
+
if (resumedActivity == activity) {
|
|
43
|
+
resumedActivity = null
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override fun onActivityStopped(activity: Activity) {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle) {
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override fun onActivityDestroyed(activity: Activity) {
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
} else {
|
|
59
|
+
FWLogUtils.w {"Deferring initialization because `applicationContext` is null."}
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
throw Exception("Context cannot be null")
|
|
63
|
+
}
|
|
64
|
+
return true
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
override fun query(
|
|
68
|
+
p0: Uri,
|
|
69
|
+
p1: Array<out String>?,
|
|
70
|
+
p2: String?,
|
|
71
|
+
p3: Array<out String>?,
|
|
72
|
+
p4: String?
|
|
73
|
+
): Cursor? {
|
|
74
|
+
throw IllegalStateException("Not allowed.")
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
override fun getType(p0: Uri): String? {
|
|
78
|
+
throw IllegalStateException("Not allowed.")
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
override fun insert(p0: Uri, p1: ContentValues?): Uri? {
|
|
82
|
+
throw IllegalStateException("Not allowed.")
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
override fun delete(p0: Uri, p1: String?, p2: Array<out String>?): Int {
|
|
86
|
+
throw IllegalStateException("Not allowed.")
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
override fun update(p0: Uri, p1: ContentValues?, p2: String?, p3: Array<out String>?): Int {
|
|
90
|
+
throw IllegalStateException("Not allowed.")
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
companion object {
|
|
94
|
+
private lateinit var sInstance: FWInitializationProvider
|
|
95
|
+
|
|
96
|
+
val INSTANCE: FWInitializationProvider
|
|
97
|
+
get() = sInstance
|
|
98
|
+
}
|
|
99
|
+
}
|
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,7 +5,7 @@ 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)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.reactnative.module
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.*
|
|
4
|
+
import com.fireworksdk.bridge.reactnative.FWInitializationProvider
|
|
5
|
+
import com.fireworksdk.bridge.reactnative.models.FWNavigatorInterface
|
|
6
|
+
import com.fireworksdk.bridge.reactnative.pages.FWContainerActivity
|
|
7
|
+
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
8
|
+
import com.fireworksdk.bridge.utils.FWDateUtils
|
|
9
|
+
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
10
|
+
import java.util.*
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class FWNavigatorModule(
|
|
14
|
+
reactContext: ReactApplicationContext
|
|
15
|
+
) : ReactContextBaseJavaModule(reactContext), FWNavigatorInterface {
|
|
16
|
+
|
|
17
|
+
@ReactMethod
|
|
18
|
+
override fun pushNativeContainer(callbackId: String?, promise: Promise) {
|
|
19
|
+
FWLogUtils.d { "FWNavigatorModule pushNativeContainer: $callbackId" }
|
|
20
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity
|
|
21
|
+
|
|
22
|
+
if (activity == null) {
|
|
23
|
+
promise.resolve(false)
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Enter pushNativeContainer ${FWDateUtils.getDateString(Date())}")
|
|
28
|
+
|
|
29
|
+
UiThreadUtil.runOnUiThread {
|
|
30
|
+
|
|
31
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Before Starting container activity ${FWDateUtils.getDateString(Date())}")
|
|
32
|
+
|
|
33
|
+
activity.startActivity(FWContainerActivity.createIntent(activity, callbackId))
|
|
34
|
+
|
|
35
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] After Starting container activity ${FWDateUtils.getDateString(Date())}")
|
|
36
|
+
}
|
|
37
|
+
promise.resolve(true)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@ReactMethod
|
|
41
|
+
override fun popNativeContainer(promise: Promise) {
|
|
42
|
+
FWLogUtils.d { "FWNavigatorModule popNativeContainer" }
|
|
43
|
+
|
|
44
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity
|
|
45
|
+
if (activity == null) {
|
|
46
|
+
promise.resolve(false)
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
UiThreadUtil.runOnUiThread {
|
|
51
|
+
activity.finish()
|
|
52
|
+
}
|
|
53
|
+
promise.resolve(true)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@ReactMethod
|
|
57
|
+
fun addListener(eventName: String?, promise: Promise) {
|
|
58
|
+
// Set up any upstream listeners or background tasks as necessary
|
|
59
|
+
FWLogUtils.d { "addListener: $eventName" }
|
|
60
|
+
promise.resolve(Arguments.createMap())
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@ReactMethod
|
|
64
|
+
fun removeListeners(count: Int?, promise: Promise) {
|
|
65
|
+
// Remove upstream listeners, stop unnecessary background tasks
|
|
66
|
+
FWLogUtils.d { "removeListeners: $count" }
|
|
67
|
+
promise.resolve(Arguments.createMap())
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
override fun getName(): String {
|
|
71
|
+
return "FWNavigatorModule"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt
CHANGED
|
@@ -3,6 +3,7 @@ package com.fireworksdk.bridge.reactnative.module
|
|
|
3
3
|
import android.app.Activity
|
|
4
4
|
import com.facebook.react.bridge.*
|
|
5
5
|
import com.fasterxml.jackson.core.type.TypeReference
|
|
6
|
+
import com.fireworksdk.bridge.reactnative.FWInitializationProvider
|
|
6
7
|
import com.loopnow.fireworklibrary.baya.Baya
|
|
7
8
|
import com.loopnow.fireworklibrary.baya.UpdateCartStatus
|
|
8
9
|
import com.fireworksdk.bridge.reactnative.models.FWVideoShoppingInterface
|
|
@@ -116,7 +117,7 @@ class FWVideoShoppingModule(
|
|
|
116
117
|
if (callbackId == null || cartClickHandler?.first != callbackId) {
|
|
117
118
|
return
|
|
118
119
|
}
|
|
119
|
-
val activity =
|
|
120
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity ?: return
|
|
120
121
|
|
|
121
122
|
UiThreadUtil.runOnUiThread {
|
|
122
123
|
activity.startActivity(FWVideoShoppingCartActivity.createIntent(activity))
|
|
@@ -125,8 +126,11 @@ class FWVideoShoppingModule(
|
|
|
125
126
|
|
|
126
127
|
@ReactMethod
|
|
127
128
|
override fun exitCartPage() {
|
|
129
|
+
|
|
130
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity ?: return
|
|
131
|
+
|
|
128
132
|
UiThreadUtil.runOnUiThread {
|
|
129
|
-
|
|
133
|
+
activity.finish()
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
136
|
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt
CHANGED
|
@@ -14,6 +14,7 @@ import com.fireworksdk.bridge.models.FWAdBadgeConfigModel
|
|
|
14
14
|
import com.fireworksdk.bridge.reactnative.models.FireworkSDKInterface
|
|
15
15
|
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
16
16
|
import com.loopnow.fireworklibrary.*
|
|
17
|
+
import java.util.*
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class FireworkSDKModule(
|
|
@@ -35,8 +36,8 @@ class FireworkSDKModule(
|
|
|
35
36
|
* If id passed is not unique, it will affect the quality of content recommended to the user.
|
|
36
37
|
*/
|
|
37
38
|
@ReactMethod
|
|
38
|
-
override fun init(userId: String
|
|
39
|
-
|
|
39
|
+
override fun init(userId: String?) {
|
|
40
|
+
initSdk(userId)
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
/**
|
|
@@ -106,7 +107,7 @@ class FireworkSDKModule(
|
|
|
106
107
|
handleVideoPlaybackEvent()
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
private fun
|
|
110
|
+
private fun initSdk(userId: String?) {
|
|
110
111
|
val clientId = getAppid()
|
|
111
112
|
if (clientId.isNullOrBlank()) {
|
|
112
113
|
val errorMsg = "The appid is invalid"
|
|
@@ -163,12 +164,12 @@ class FireworkSDKModule(
|
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
private fun handleCustomCTAClick() {
|
|
166
|
-
if (!FWVideoPlayerUtils.customCTAClickEnabled) {
|
|
167
|
-
return
|
|
168
|
-
}
|
|
169
167
|
FwSDK.ctaClickHandler = object: FwSDK.CtaClickHandler {
|
|
170
168
|
override fun ctaClicked(label: String, actionUrl: String?): Boolean {
|
|
171
169
|
FWLogUtils.d { "ctaClicked" }
|
|
170
|
+
|
|
171
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Receive CustomCTAClick event ${FWDateUtils.getDateString(Date())}")
|
|
172
|
+
|
|
172
173
|
FWEventUtils.sendCustomCTAClickEvent(reactApplicationContext, actionUrl)
|
|
173
174
|
return FWVideoPlayerUtils.customCTAClickEnabled
|
|
174
175
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 FWContainerActivity : AppCompatActivity(), DefaultHardwareBackBtnHandler {
|
|
13
|
+
|
|
14
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
15
|
+
super.onCreate(savedInstanceState)
|
|
16
|
+
setContentView(R.layout.fw_bridge_fragment_container)
|
|
17
|
+
|
|
18
|
+
val callbackId = intent.getStringExtra(KEY_CALLBACK_ID)
|
|
19
|
+
|
|
20
|
+
val reactNativeFragment: Fragment = ReactFragment.Builder()
|
|
21
|
+
.setComponentName(COMPONENT_NAME)
|
|
22
|
+
.setLaunchOptions(getLaunchOptions(callbackId))
|
|
23
|
+
.build()
|
|
24
|
+
|
|
25
|
+
supportFragmentManager
|
|
26
|
+
.beginTransaction()
|
|
27
|
+
.add(R.id.fw_bridge_container, reactNativeFragment)
|
|
28
|
+
.commit()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private fun getLaunchOptions(callbackId: String?) = Bundle().apply {
|
|
32
|
+
if (!callbackId.isNullOrEmpty()) {
|
|
33
|
+
putString(KEY_CALLBACK_ID, callbackId)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
companion object {
|
|
38
|
+
|
|
39
|
+
private const val KEY_CALLBACK_ID = "callbackId"
|
|
40
|
+
private const val COMPONENT_NAME = "FWNavigationContainer"
|
|
41
|
+
|
|
42
|
+
fun createIntent(activity: Activity, callbackId: String?): Intent {
|
|
43
|
+
val intent = Intent(activity, FWContainerActivity::class.java)
|
|
44
|
+
intent.putExtra(KEY_CALLBACK_ID, callbackId)
|
|
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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<androidx.constraintlayout.widget.ConstraintLayout
|
|
3
|
+
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
4
|
+
android:id="@+id/fw_bridge_container"
|
|
5
|
+
android:layout_width="match_parent"
|
|
6
|
+
android:layout_height="match_parent">
|
|
7
|
+
|
|
8
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -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) {
|