react-native-firework-sdk 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +18 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +4 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModel.kt +0 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +0 -3
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelSerializer.kt +0 -2
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSdkInitResultModel.kt +6 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModel.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelDeserializer.kt +45 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelSerializer.kt +34 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +4 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModel.kt +8 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelDeserializer.kt +23 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelSerializer.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoPlayerLogoOption.kt +19 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +103 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +12 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +8 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +22 -9
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +78 -122
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +34 -9
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +13 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWFragmentUtil.kt +3 -3
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +5 -2
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +64 -0
- package/ios/Components/ReplayBadgeConfiguration.swift +12 -0
- package/ios/Components/StoryBlock.swift +31 -0
- package/ios/Components/StoryBlockConfiguration.swift +1 -0
- package/ios/Components/StoryBlockManager.m +24 -0
- package/ios/Components/StoryBlockManager.swift +6 -3
- package/ios/Components/VideoFeed.swift +18 -3
- package/ios/Components/VideoFeedConfiguration.swift +1 -0
- package/ios/Components/VideoFeedManager.m +4 -1
- package/ios/Components/VideoFeedManager.swift +6 -3
- package/ios/Components/VideoPlayerConfiguration.swift +1 -0
- package/ios/FWReactNativeSDK.swift +14 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +17 -15
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +1 -11
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +80 -81
- package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +9 -5
- package/ios/Modules/Shopping/ShoppingModule.swift +10 -74
- package/lib/commonjs/FireworkSDK.js +30 -25
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +6 -12
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +54 -3
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +46 -4
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWNativeErrorAction.js +14 -0
- package/lib/commonjs/models/FWNativeErrorAction.js.map +1 -0
- package/lib/commonjs/models/ReplayBadgeConfiguration.js +2 -0
- package/lib/commonjs/models/ReplayBadgeConfiguration.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +29 -25
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +6 -12
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/StoryBlock.js +53 -3
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +42 -4
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWNativeErrorAction.js +7 -0
- package/lib/module/models/FWNativeErrorAction.js.map +1 -0
- package/lib/module/models/ReplayBadgeConfiguration.js +2 -0
- package/lib/module/models/ReplayBadgeConfiguration.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/typescript/VideoShopping.d.ts +2 -2
- package/lib/typescript/components/StoryBlock.d.ts +18 -1
- package/lib/typescript/components/VideoFeed.d.ts +7 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/models/FWEvents.d.ts +26 -3
- package/lib/typescript/models/FWNativeErrorAction.d.ts +4 -0
- package/lib/typescript/models/FeedItemDetails.d.ts +6 -1
- package/lib/typescript/models/ReplayBadgeConfiguration.d.ts +7 -0
- package/lib/typescript/models/StoryBlockConfiguration.d.ts +6 -1
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +6 -0
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +6 -1
- package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -0
- package/package.json +1 -5
- package/react-native-firework-sdk.podspec +3 -5
- package/src/FireworkSDK.ts +27 -24
- package/src/VideoShopping.ts +9 -11
- package/src/components/StoryBlock.tsx +69 -7
- package/src/components/VideoFeed.tsx +57 -12
- package/src/index.ts +2 -0
- package/src/models/FWEvents.ts +28 -3
- package/src/models/FWNativeErrorAction.ts +4 -0
- package/src/models/FeedItemDetails.ts +7 -1
- package/src/models/ReplayBadgeConfiguration.ts +7 -0
- package/src/models/StoryBlockConfiguration.ts +6 -1
- package/src/models/VideoFeedConfiguration.ts +6 -0
- package/src/models/VideoPlayerConfiguration.ts +6 -1
- package/src/modules/FireworkSDKModule.ts +1 -0
- package/FireworkVideoUI.xcframework/Info.plist +0 -40
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -280
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -556
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +0 -245
- package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +0 -13
- package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +0 -18
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +0 -154
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +0 -73
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +0 -25
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +0 -52
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -60
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +0 -98
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +0 -97
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +0 -97
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +0 -71
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +0 -48
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +0 -26
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +0 -43
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +0 -42
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +0 -149
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +0 -35
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +0 -202
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +0 -59
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift +0 -32
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +0 -18
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +0 -46
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +0 -37
- package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +0 -766
- package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +0 -10
- package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +0 -37
- package/ios/FireworkVideoUI/Podfile +0 -15
- package/ios/FireworkVideoUI/Podfile.lock +0 -16
- package/ios/scripts/react_native_firework_sdk_pods.rb +0 -27
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt
CHANGED
|
@@ -2,6 +2,7 @@ package com.fireworksdk.bridge.reactnative.module
|
|
|
2
2
|
|
|
3
3
|
import android.widget.Toast
|
|
4
4
|
import com.facebook.react.bridge.*
|
|
5
|
+
import com.firework.analyticsevents.VideoInfo
|
|
5
6
|
import com.firework.common.product.CurrencyCode
|
|
6
7
|
import com.firework.common.product.Product
|
|
7
8
|
import com.firework.error.shopping.ShoppingError
|
|
@@ -19,6 +20,7 @@ import com.fireworksdk.bridge.utils.FWCommonUtil
|
|
|
19
20
|
import com.fireworksdk.bridge.utils.FWDateUtils
|
|
20
21
|
import com.fireworksdk.bridge.utils.FWGlobalDataUtil
|
|
21
22
|
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
23
|
+
import com.fireworksdk.bridge.utils.FWModelUtils
|
|
22
24
|
import org.json.JSONArray
|
|
23
25
|
import org.json.JSONObject
|
|
24
26
|
import java.util.*
|
|
@@ -186,7 +188,7 @@ class FWVideoShoppingModule(
|
|
|
186
188
|
|
|
187
189
|
FireworkSdk.shopping.setShoppingViewOptions(
|
|
188
190
|
ShoppingViewOptions(
|
|
189
|
-
productCardsOptions = ProductCardsOptions(
|
|
191
|
+
productCardsOptions = ProductCardsOptions.Default(
|
|
190
192
|
ctaButtonText = productCtaButtonText,
|
|
191
193
|
cornerRadius = productCardCornerRadius.toFloat(),
|
|
192
194
|
isPriceVisible = isPriceVisible,
|
|
@@ -266,23 +268,27 @@ class FWVideoShoppingModule(
|
|
|
266
268
|
|
|
267
269
|
private fun cartListener() {
|
|
268
270
|
FireworkSdk.shopping.setOnCartClickListener(object : Shopping.OnCartClickListener {
|
|
269
|
-
override fun onCartClick() {
|
|
271
|
+
override fun onCartClick(videoInfo: VideoInfo) {
|
|
270
272
|
FWLogUtils.d { "FWVideoShoppingModule cartClicked" }
|
|
271
273
|
val activity = FWInitializationProvider.INSTANCE.resumedActivity
|
|
272
274
|
activity ?: return
|
|
275
|
+
val videoPlaybackDetails = FWModelUtils.convertVideoInfo2PlaybackDetails(videoInfo)
|
|
273
276
|
val callbackId = generateCallbackId()
|
|
274
|
-
FWEventUtils.sendCartIconClickEvent(reactApplicationContext, callbackId)
|
|
277
|
+
FWEventUtils.sendCartIconClickEvent(reactApplicationContext, videoPlaybackDetails, callbackId)
|
|
275
278
|
}
|
|
276
279
|
})
|
|
277
280
|
|
|
278
|
-
FireworkSdk.shopping.setOnCtaButtonClicked { productId, unitId, productWebUrl ->
|
|
281
|
+
FireworkSdk.shopping.setOnCtaButtonClicked { productId, unitId, productWebUrl, videoInfo ->
|
|
279
282
|
FWLogUtils.d { "FWVideoShoppingModule updateCart, productId: $productId, unitId: $unitId" }
|
|
280
283
|
|
|
281
284
|
FireworkSdk.shopping.setCtaButtonStatus(Shopping.CtaButtonStatus.Loading)
|
|
282
285
|
|
|
283
286
|
val callbackId = generateCallbackId()
|
|
284
287
|
ctaHandler = Triple(callbackId, productId, unitId)
|
|
285
|
-
|
|
288
|
+
|
|
289
|
+
val videoPlaybackDetails = FWModelUtils.convertVideoInfo2PlaybackDetails(videoInfo)
|
|
290
|
+
|
|
291
|
+
FWEventUtils.sendShoppingCtaButtonClickEvent(reactApplicationContext, productId, unitId, productWebUrl, videoPlaybackDetails, callbackId)
|
|
286
292
|
}
|
|
287
293
|
|
|
288
294
|
FireworkSdk.shopping.setOnShoppingErrorListener(
|
|
@@ -300,25 +306,29 @@ class FWVideoShoppingModule(
|
|
|
300
306
|
|
|
301
307
|
private fun productListener() {
|
|
302
308
|
FireworkSdk.shopping.setOnProductHydrationListener(object : Shopping.OnProductHydrationListener {
|
|
303
|
-
override fun onProductHydration(products: List<Product>, hydrator: ProductHydrator) {
|
|
309
|
+
override fun onProductHydration(products: List<Product>, hydrator: ProductHydrator, videoInfo: VideoInfo) {
|
|
304
310
|
FWLogUtils.d { "FWVideoShoppingModule hydrateProducts, hydrator: ${hydrator.hashCode()}" }
|
|
305
311
|
if (products.isEmpty()) {
|
|
306
312
|
return
|
|
307
313
|
}
|
|
314
|
+
val videoPlaybackDetails = FWModelUtils.convertVideoInfo2PlaybackDetails(videoInfo)
|
|
308
315
|
val callbackId = hydrator.hashCode().toString()
|
|
309
316
|
updateProductHandler[callbackId] = products
|
|
310
317
|
updateProductHydratorHandler[callbackId] = hydrator
|
|
311
|
-
FWEventUtils.sendUpdateProductsDetailsEvent(reactApplicationContext, products, callbackId)
|
|
318
|
+
FWEventUtils.sendUpdateProductsDetailsEvent(reactApplicationContext, products, videoPlaybackDetails, callbackId)
|
|
312
319
|
}
|
|
313
320
|
})
|
|
314
321
|
|
|
315
|
-
FireworkSdk.shopping.setOnProductLinkClickListener { productId, unitId, productWebUrl ->
|
|
322
|
+
FireworkSdk.shopping.setOnProductLinkClickListener { productId, unitId, productWebUrl, videoInfo ->
|
|
316
323
|
if (FWGlobalDataUtil.customClickLinkButtonEnabled) {
|
|
324
|
+
val videoPlaybackDetails = FWModelUtils.convertVideoInfo2PlaybackDetails(videoInfo)
|
|
325
|
+
|
|
317
326
|
FWEventUtils.sendCustomLinkButtonClickEvent(
|
|
318
327
|
reactApplicationContext,
|
|
319
328
|
productWebUrl,
|
|
320
329
|
productId,
|
|
321
330
|
unitId,
|
|
331
|
+
videoPlaybackDetails,
|
|
322
332
|
callbackId
|
|
323
333
|
)
|
|
324
334
|
}
|
|
@@ -336,14 +346,17 @@ class FWVideoShoppingModule(
|
|
|
336
346
|
override fun setCustomTapProductCardEnabled(value: Boolean?, promise: Promise) {
|
|
337
347
|
|
|
338
348
|
if (value == true) {
|
|
339
|
-
FireworkSdk.shopping.setOnProductCardClickListener { productId, unitId, productWebUrl ->
|
|
349
|
+
FireworkSdk.shopping.setOnProductCardClickListener { productId, unitId, productWebUrl, videoInfo ->
|
|
340
350
|
FWLogUtils.d { "FWVideoShoppingModule productCardClick $productId $unitId $productWebUrl" }
|
|
341
351
|
|
|
352
|
+
val videoPlaybackDetails = FWModelUtils.convertVideoInfo2PlaybackDetails(videoInfo)
|
|
353
|
+
|
|
342
354
|
FWEventUtils.sendProductCardClickEvent(
|
|
343
355
|
reactApplicationContext,
|
|
344
356
|
productWebUrl,
|
|
345
357
|
productId,
|
|
346
358
|
unitId,
|
|
359
|
+
videoPlaybackDetails,
|
|
347
360
|
callbackId
|
|
348
361
|
)
|
|
349
362
|
}
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
package com.fireworksdk.bridge.reactnative.module
|
|
2
2
|
|
|
3
|
-
import android.annotation.SuppressLint
|
|
4
3
|
import android.app.Activity
|
|
5
4
|
import android.app.Application
|
|
6
5
|
import android.content.Intent
|
|
7
|
-
import android.content.pm.PackageManager
|
|
8
6
|
import android.os.Handler
|
|
9
7
|
import android.os.Looper
|
|
10
8
|
import android.os.Process
|
|
11
|
-
import
|
|
12
|
-
import android.util.Base64
|
|
9
|
+
import androidx.annotation.Keep
|
|
13
10
|
import com.facebook.react.bridge.*
|
|
14
11
|
import com.firework.analyticsevents.cta.CtaButtonClickAnalyticsEvent
|
|
15
12
|
import com.firework.analyticsevents.player.PlayerLifecycleAnalyticsEvent
|
|
16
13
|
import com.firework.analyticsevents.share.ShareButtonAnalyticsEvent
|
|
17
14
|
import com.firework.bus.FwAnalyticCallable
|
|
18
15
|
import com.firework.sdk.FireworkSdk
|
|
19
|
-
import com.firework.sdk.FireworkSdkConfig
|
|
20
16
|
import com.fireworksdk.bridge.FWInitializationProvider
|
|
21
17
|
import com.fireworksdk.bridge.models.*
|
|
22
|
-
import com.fireworksdk.bridge.models.enums.FWPlayerLaunchBehavior
|
|
23
18
|
import com.fireworksdk.bridge.models.enums.FWVideoPlaybackSubEventName
|
|
19
|
+
import com.fireworksdk.bridge.reactnative.FWReactNativeSDK
|
|
24
20
|
import com.fireworksdk.bridge.reactnative.models.FireworkSDKInterface
|
|
25
21
|
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
26
22
|
import com.fireworksdk.bridge.utils.*
|
|
27
23
|
import org.json.JSONObject
|
|
28
|
-
import java.nio.charset.StandardCharsets
|
|
29
|
-
import java.security.MessageDigest
|
|
30
24
|
import java.util.*
|
|
31
25
|
import kotlin.system.exitProcess
|
|
32
26
|
|
|
@@ -52,16 +46,39 @@ class FireworkSDKModule(
|
|
|
52
46
|
@ReactMethod
|
|
53
47
|
override fun init(config: ReadableMap?, promise: Promise) {
|
|
54
48
|
FWColorUtil.useRgba = true
|
|
49
|
+
FWGlobalDataUtil.pauseWhenNotVisible = true
|
|
55
50
|
|
|
56
51
|
val configMap = config?.toHashMap() ?: hashMapOf()
|
|
57
52
|
val jsonObject = JSONObject(configMap)
|
|
58
53
|
val sdkInitOptionsModel = FWSDKInitOptionsModelDeserializer.deserialize(jsonObject)
|
|
59
54
|
|
|
60
55
|
UiThreadUtil.runOnUiThread {
|
|
61
|
-
|
|
56
|
+
initCalled(sdkInitOptionsModel)
|
|
57
|
+
FireworkSdk.analytics.register(this)
|
|
62
58
|
promise.resolve(Arguments.createMap())
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@ReactMethod
|
|
63
|
+
override fun markInitCalled(promise: Promise) {
|
|
64
|
+
FWColorUtil.useRgba = true
|
|
65
|
+
FWGlobalDataUtil.pauseWhenNotVisible = true
|
|
66
|
+
|
|
67
|
+
val sdkInitResultModel = FWGlobalDataUtil.sdkInitResultModel
|
|
68
|
+
if (sdkInitResultModel != null) { // init in application
|
|
69
|
+
if (sdkInitResultModel.success == true) {
|
|
70
|
+
FWEventUtils.sendInitSuccessEvent(reactApplicationContext)
|
|
71
|
+
} else if (sdkInitResultModel.success == false) {
|
|
72
|
+
FWEventUtils.sendInitFailedEvent(reactApplicationContext, sdkInitResultModel.reason)
|
|
73
|
+
}
|
|
74
|
+
|
|
63
75
|
FireworkSdk.analytics.register(this)
|
|
76
|
+
promise.resolve(true)
|
|
77
|
+
|
|
78
|
+
return
|
|
64
79
|
}
|
|
80
|
+
|
|
81
|
+
promise.resolve(false)
|
|
65
82
|
}
|
|
66
83
|
|
|
67
84
|
/**
|
|
@@ -128,149 +145,45 @@ class FireworkSDKModule(
|
|
|
128
145
|
FWGlobalDataUtil.videoPlaybackEventEnabled = value?:false
|
|
129
146
|
}
|
|
130
147
|
|
|
131
|
-
|
|
132
|
-
val clientId = getAppid()
|
|
133
|
-
if (clientId.isNullOrBlank()) {
|
|
134
|
-
val errorMsg = "The appid is invalid"
|
|
135
|
-
FWLogUtils.d { errorMsg }
|
|
136
|
-
FWEventUtils.sendInitFailedEvent(reactApplicationContext, errorMsg)
|
|
137
|
-
return
|
|
138
|
-
}
|
|
139
|
-
val userId = sdkInitOptions?.userId
|
|
140
|
-
|
|
141
|
-
val uid = if (userId.isNullOrBlank()) { getHashedAndroidId() } else userId
|
|
142
|
-
val shareBaseURL = sdkInitOptions?.shareBaseURL
|
|
143
|
-
val videoLaunchBehavior = sdkInitOptions?.videoLaunchBehavior
|
|
144
|
-
|
|
145
|
-
val configBuilder = FireworkSdkConfig.Builder(reactApplicationContext)
|
|
146
|
-
.checksumRequired(false)
|
|
147
|
-
.clientId(clientId)
|
|
148
|
-
.userId(uid)
|
|
149
|
-
.enableCache(true)
|
|
150
|
-
shareBaseURL?.let {
|
|
151
|
-
FWGlobalDataUtil.shareBaseUrl = it
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
val livestreamPlayerInitializerList = FWLiveStreamUtil.livestreamPlayerInitializers()
|
|
155
|
-
for (livestreamPlayerInitializer in livestreamPlayerInitializerList) {
|
|
156
|
-
configBuilder.addLivestreamPlayerInitializer(livestreamPlayerInitializer)
|
|
157
|
-
}
|
|
158
|
-
when (videoLaunchBehavior) {
|
|
159
|
-
FWPlayerLaunchBehavior.Default -> {}
|
|
160
|
-
FWPlayerLaunchBehavior.MuteOnFirstLaunch -> {
|
|
161
|
-
configBuilder.muteOnLaunch(true)
|
|
162
|
-
}
|
|
163
|
-
else -> {}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
val imageLoader = FWImageLoaderUtil.getImageLoader()
|
|
167
|
-
if (imageLoader != null) {
|
|
168
|
-
configBuilder.imageLoader(imageLoader)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
val config = configBuilder.build()
|
|
172
|
-
|
|
173
|
-
FireworkSdk.init(
|
|
174
|
-
config,
|
|
175
|
-
onSuccess = {
|
|
176
|
-
FWEventUtils.sendInitSuccessEvent(reactApplicationContext)
|
|
177
|
-
},
|
|
178
|
-
onError = { error ->
|
|
179
|
-
FWEventUtils.sendInitFailedEvent(reactApplicationContext, "$error")
|
|
180
|
-
},
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
private fun getAppid(): String? {
|
|
185
|
-
val ai = reactApplicationContext.packageManager.getApplicationInfo(
|
|
186
|
-
reactApplicationContext.packageName,
|
|
187
|
-
PackageManager.GET_META_DATA
|
|
188
|
-
)
|
|
189
|
-
val value = ai.metaData.get("Firework:Appid")
|
|
190
|
-
return value?.let {
|
|
191
|
-
it as String
|
|
192
|
-
} ?: run {
|
|
193
|
-
null
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
@SuppressLint("HardwareIds")
|
|
198
|
-
private fun getHashedAndroidId(): String {
|
|
199
|
-
val androidId = Settings.Secure.getString(
|
|
200
|
-
reactApplicationContext.contentResolver,
|
|
201
|
-
Settings.Secure.ANDROID_ID
|
|
202
|
-
)
|
|
203
|
-
return getHash(androidId)
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
private fun getHash(text: String): String {
|
|
207
|
-
val digest: MessageDigest = MessageDigest.getInstance("SHA-256")
|
|
208
|
-
val hash: ByteArray = digest.digest(text.toByteArray(StandardCharsets.UTF_8))
|
|
209
|
-
return Base64.encodeToString(hash, Base64.DEFAULT)
|
|
210
|
-
}
|
|
211
|
-
|
|
148
|
+
@Keep
|
|
212
149
|
@FwAnalyticCallable
|
|
213
150
|
fun onCtaButtonClicked(event: CtaButtonClickAnalyticsEvent) {
|
|
214
151
|
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Receive CustomCTAClick event ${FWDateUtils.getDateString(
|
|
215
152
|
Date()
|
|
216
153
|
)}")
|
|
217
154
|
|
|
155
|
+
val videoPlaybackDetails = FWModelUtils.convertCtaEvent2PlaybackDetails(event)
|
|
156
|
+
|
|
218
157
|
if (FWGlobalDataUtil.videoPlaybackEventEnabled) {
|
|
219
158
|
FWEventUtils.sendVideoPlaybackEvent(
|
|
220
159
|
reactApplicationContext,
|
|
221
160
|
FWVideoPlaybackSubEventName.ClickCTA.rawValue,
|
|
222
|
-
|
|
223
|
-
badge = event.videoInfo.badge,
|
|
224
|
-
caption = event.videoInfo.caption,
|
|
225
|
-
duration = event.videoInfo.duration,
|
|
226
|
-
hasCta = true,
|
|
227
|
-
playerHeight = event.videoInfo.playerHeight,
|
|
228
|
-
playerWidth = event.videoInfo.playerWidth,
|
|
229
|
-
id = event.videoInfo.id,
|
|
230
|
-
actionUrl = event.actionUrl,
|
|
231
|
-
)
|
|
161
|
+
videoPlaybackDetails
|
|
232
162
|
)
|
|
233
163
|
}
|
|
234
164
|
|
|
235
|
-
FWEventUtils.sendCustomCTAClickEvent(reactApplicationContext, event.actionUrl)
|
|
165
|
+
FWEventUtils.sendCustomCTAClickEvent(reactApplicationContext, event.actionUrl, videoPlaybackDetails)
|
|
236
166
|
}
|
|
237
167
|
|
|
168
|
+
@Keep
|
|
238
169
|
@FwAnalyticCallable
|
|
239
170
|
fun onShareButtonClicked(event: ShareButtonAnalyticsEvent) {
|
|
240
171
|
if (FWGlobalDataUtil.videoPlaybackEventEnabled) {
|
|
241
172
|
FWEventUtils.sendVideoPlaybackEvent(
|
|
242
173
|
reactApplicationContext,
|
|
243
174
|
FWVideoPlaybackSubEventName.ClickShare.rawValue,
|
|
244
|
-
|
|
245
|
-
badge = event.videoInfo.badge,
|
|
246
|
-
caption = event.videoInfo.caption,
|
|
247
|
-
duration = event.videoInfo.duration,
|
|
248
|
-
hasCta = event.videoInfo.hasCta,
|
|
249
|
-
playerHeight = event.videoInfo.playerHeight,
|
|
250
|
-
playerWidth = event.videoInfo.playerWidth,
|
|
251
|
-
id = event.videoInfo.id,
|
|
252
|
-
)
|
|
175
|
+
FWModelUtils.convertShareButtonEvent2PlaybackDetails(event)
|
|
253
176
|
)
|
|
254
177
|
}
|
|
255
178
|
}
|
|
256
179
|
|
|
180
|
+
@Keep
|
|
257
181
|
@FwAnalyticCallable
|
|
258
182
|
fun onPlaybackEvent(event: PlayerLifecycleAnalyticsEvent) {
|
|
259
183
|
if (!FWGlobalDataUtil.videoPlaybackEventEnabled) {
|
|
260
184
|
return
|
|
261
185
|
}
|
|
262
|
-
val
|
|
263
|
-
|
|
264
|
-
val videoPlaybackDetails = FWVideoPlaybackDetails(
|
|
265
|
-
badge = event.videoInfo.badge,
|
|
266
|
-
caption = event.videoInfo.caption,
|
|
267
|
-
duration = event.videoInfo.duration,
|
|
268
|
-
hasCta = event.videoInfo.hasCta,
|
|
269
|
-
playerHeight = event.videoInfo.playerHeight,
|
|
270
|
-
playerWidth = event.videoInfo.playerWidth,
|
|
271
|
-
id = event.videoInfo.id,
|
|
272
|
-
progress = progress
|
|
273
|
-
)
|
|
186
|
+
val videoPlaybackDetails = FWModelUtils.convertPlayerEvent2PlaybackDetails(event)
|
|
274
187
|
when (event) {
|
|
275
188
|
is PlayerLifecycleAnalyticsEvent.OnStarted -> {
|
|
276
189
|
if (event.videoInfo.isAd) {
|
|
@@ -363,6 +276,29 @@ class FireworkSDKModule(
|
|
|
363
276
|
}, 300)
|
|
364
277
|
}
|
|
365
278
|
|
|
279
|
+
@ReactMethod
|
|
280
|
+
override fun trackPurchase(config: ReadableMap?, promise: Promise) {
|
|
281
|
+
val configMap = config?.toHashMap() ?: hashMapOf()
|
|
282
|
+
val jsonObject = JSONObject(configMap)
|
|
283
|
+
val trackPurchaseModel = FWTrackPurchaseModelDeserializer.deserialize(jsonObject)
|
|
284
|
+
|
|
285
|
+
if (trackPurchaseModel?.orderId == null) {
|
|
286
|
+
promise.resolve(false)
|
|
287
|
+
return
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
UiThreadUtil.runOnUiThread {
|
|
291
|
+
FireworkSdk.shopping.trackPurchase(
|
|
292
|
+
trackPurchaseModel.orderId,
|
|
293
|
+
trackPurchaseModel.value,
|
|
294
|
+
trackPurchaseModel.currencyCode,
|
|
295
|
+
trackPurchaseModel.countryCode,
|
|
296
|
+
trackPurchaseModel.additionalInfo ?: mutableMapOf()
|
|
297
|
+
)
|
|
298
|
+
promise.resolve(true)
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
366
302
|
@ReactMethod
|
|
367
303
|
fun addListener(eventName: String?, promise: Promise) {
|
|
368
304
|
// Set up any upstream listeners or background tasks as necessary
|
|
@@ -381,4 +317,24 @@ class FireworkSDKModule(
|
|
|
381
317
|
return "FireworkSDK"
|
|
382
318
|
}
|
|
383
319
|
|
|
320
|
+
private fun initCalled(sdkInitOptionsModel: FWSDKInitOptionsModel? = null) {
|
|
321
|
+
val context = reactApplicationContext
|
|
322
|
+
val sdkInitResultModel = FWGlobalDataUtil.sdkInitResultModel
|
|
323
|
+
if (sdkInitResultModel == null) {
|
|
324
|
+
// not init in application
|
|
325
|
+
FWReactNativeSDK.initSdkInternal(context, sdkInitOptionsModel, onSuccess = {
|
|
326
|
+
FWEventUtils.sendInitSuccessEvent(context)
|
|
327
|
+
}, onError = {
|
|
328
|
+
FWEventUtils.sendInitFailedEvent(context, it)
|
|
329
|
+
})
|
|
330
|
+
} else {
|
|
331
|
+
// init in application
|
|
332
|
+
if (sdkInitResultModel.success == true) {
|
|
333
|
+
FWEventUtils.sendInitSuccessEvent(context)
|
|
334
|
+
} else if (sdkInitResultModel.success == false) {
|
|
335
|
+
FWEventUtils.sendInitFailedEvent(context, sdkInitResultModel.reason)
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
384
340
|
}
|
|
@@ -64,16 +64,22 @@ object FWEventUtils {
|
|
|
64
64
|
sendEvent(reactContext, FWEventName.VideoFeedClick.rawValue, eventMap)
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
fun sendCustomCTAClickEvent(reactContext: ReactContext, url: String?) {
|
|
67
|
+
fun sendCustomCTAClickEvent(reactContext: ReactContext, url: String?, info: FWVideoPlaybackDetails?) {
|
|
68
68
|
val eventMap = Arguments.createMap()
|
|
69
69
|
eventMap.putString("url", url)
|
|
70
|
+
eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
|
|
70
71
|
sendEvent(reactContext, FWEventName.CustomCTAClick.rawValue, eventMap)
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
fun sendVideoPlaybackEvent(reactContext: ReactContext, eventName: String, info: FWVideoPlaybackDetails?) {
|
|
74
75
|
val eventMap = Arguments.createMap()
|
|
75
76
|
eventMap.putString("eventName", eventName)
|
|
77
|
+
eventMap.putMap("info", convertVideoPlaybackDetails2Map(info))
|
|
76
78
|
|
|
79
|
+
sendEvent(reactContext, FWEventName.VideoPlayback.rawValue, eventMap)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private fun convertVideoPlaybackDetails2Map(info: FWVideoPlaybackDetails?): WritableMap {
|
|
77
83
|
val contentMap = Arguments.createMap()
|
|
78
84
|
if (!info?.id.isNullOrBlank()) {
|
|
79
85
|
contentMap.putString("videoId", info?.id)
|
|
@@ -106,27 +112,30 @@ object FWEventUtils {
|
|
|
106
112
|
if (!info?.actionUrl.isNullOrBlank()) {
|
|
107
113
|
contentMap.putString("ctaActionURL", info?.actionUrl)
|
|
108
114
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
if (!info?.feedId.isNullOrBlank()) {
|
|
116
|
+
contentMap.putString("feedId", info?.feedId)
|
|
117
|
+
}
|
|
118
|
+
return contentMap;
|
|
112
119
|
}
|
|
113
120
|
|
|
114
|
-
fun sendShoppingCtaButtonClickEvent(reactContext: ReactContext, productId: String?, unitId: String?, url: String?, callbackId: Int?) {
|
|
121
|
+
fun sendShoppingCtaButtonClickEvent(reactContext: ReactContext, productId: String?, unitId: String?, url: String?, info: FWVideoPlaybackDetails?, callbackId: Int?) {
|
|
115
122
|
val eventMap = Arguments.createMap()
|
|
116
123
|
eventMap.putString("productId", productId)
|
|
117
124
|
eventMap.putString("unitId", unitId)
|
|
118
125
|
eventMap.putString("url", url)
|
|
119
126
|
eventMap.putInt("callbackId", callbackId?:0)
|
|
127
|
+
eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
|
|
120
128
|
sendEvent(reactContext, FWVideoShoppingEventName.CtaButtonClick.rawValue, eventMap)
|
|
121
129
|
}
|
|
122
130
|
|
|
123
|
-
fun sendCartIconClickEvent(reactContext: ReactContext, callbackId: Int?) {
|
|
131
|
+
fun sendCartIconClickEvent(reactContext: ReactContext, info: FWVideoPlaybackDetails?, callbackId: Int?) {
|
|
124
132
|
val eventMap = Arguments.createMap()
|
|
125
133
|
eventMap.putInt("callbackId", callbackId?:0)
|
|
134
|
+
eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
|
|
126
135
|
sendEvent(reactContext, FWVideoShoppingEventName.ClickCartIcon.rawValue, eventMap)
|
|
127
136
|
}
|
|
128
137
|
|
|
129
|
-
fun sendUpdateProductsDetailsEvent(reactContext: ReactContext, products: List<Product>?, callbackId: String?) {
|
|
138
|
+
fun sendUpdateProductsDetailsEvent(reactContext: ReactContext, products: List<Product>?, info: FWVideoPlaybackDetails?, callbackId: String?) {
|
|
130
139
|
val eventMap = Arguments.createMap()
|
|
131
140
|
|
|
132
141
|
val productArray = Arguments.createArray()
|
|
@@ -137,6 +146,7 @@ object FWEventUtils {
|
|
|
137
146
|
}
|
|
138
147
|
|
|
139
148
|
eventMap.putArray("productIds", productArray)
|
|
149
|
+
eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
|
|
140
150
|
eventMap.putString("callbackId", callbackId)
|
|
141
151
|
|
|
142
152
|
sendLogMessageEvent(reactContext, "[Android] Send UpdateProductDetails event callbackId $callbackId ${FWDateUtils.getDateString(Date())}")
|
|
@@ -176,6 +186,12 @@ object FWEventUtils {
|
|
|
176
186
|
receiveEvent(reactContext, targetTag, FWFeedViewEventName.VideoFeedLoadFinished.rawValue, eventMap)
|
|
177
187
|
}
|
|
178
188
|
|
|
189
|
+
fun receiveVideoFeedGetFeedIdEvent(reactContext: ReactContext, targetTag: Int, feedId: String?) {
|
|
190
|
+
val eventMap = Arguments.createMap()
|
|
191
|
+
eventMap.putString("feedId", feedId)
|
|
192
|
+
receiveEvent(reactContext, targetTag, FWFeedViewEventName.VideoFeedGetFeedId.rawValue, eventMap)
|
|
193
|
+
}
|
|
194
|
+
|
|
179
195
|
fun receiveStoryBlockLoadFinishedSuccessEvent(reactContext: ReactContext, targetTag: Int) {
|
|
180
196
|
receiveEvent(reactContext, targetTag, FWStoryBlockEventName.StoryBlockLoadFinished.rawValue, null)
|
|
181
197
|
}
|
|
@@ -197,6 +213,13 @@ object FWEventUtils {
|
|
|
197
213
|
receiveEvent(reactContext, targetTag, FWStoryBlockEventName.StoryBlockFullScreenStateChanged.rawValue, eventMap)
|
|
198
214
|
}
|
|
199
215
|
|
|
216
|
+
fun receiveStoryBlockGetFeedIdEvent(reactContext: ReactContext, targetTag: Int, feedId: String?) {
|
|
217
|
+
val eventMap = Arguments.createMap()
|
|
218
|
+
eventMap.putString("feedId", feedId)
|
|
219
|
+
|
|
220
|
+
receiveEvent(reactContext, targetTag, FWStoryBlockEventName.StoryBlockGetFeedId.rawValue, eventMap)
|
|
221
|
+
}
|
|
222
|
+
|
|
200
223
|
private fun receiveEvent(reactContext: ReactContext, targetTag: Int, eventName: String, event: WritableMap?) {
|
|
201
224
|
reactContext.getJSModule(RCTEventEmitter::class.java).receiveEvent(
|
|
202
225
|
targetTag,
|
|
@@ -256,21 +279,23 @@ object FWEventUtils {
|
|
|
256
279
|
sendEvent(reactContext, FWEventName.LiveStreamChat.rawValue, eventMap)
|
|
257
280
|
}
|
|
258
281
|
|
|
259
|
-
fun sendProductCardClickEvent(reactContext: ReactContext, url: String?, productId: String?, unitId: String?, callbackId: Int?) {
|
|
282
|
+
fun sendProductCardClickEvent(reactContext: ReactContext, url: String?, productId: String?, unitId: String?, info: FWVideoPlaybackDetails?, callbackId: Int?) {
|
|
260
283
|
val eventMap = Arguments.createMap()
|
|
261
284
|
eventMap.putString("url", url ?: "")
|
|
262
285
|
eventMap.putString("productId", productId)
|
|
263
286
|
eventMap.putString("unitId", unitId)
|
|
264
287
|
eventMap.putInt("callbackId", callbackId?:0)
|
|
288
|
+
eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
|
|
265
289
|
sendEvent(reactContext, FWVideoShoppingEventName.CustomProductCardTap.rawValue, eventMap)
|
|
266
290
|
}
|
|
267
291
|
|
|
268
|
-
fun sendCustomLinkButtonClickEvent(reactContext: ReactContext, url: String?, productId: String?, unitId: String?, callbackId: Int?) {
|
|
292
|
+
fun sendCustomLinkButtonClickEvent(reactContext: ReactContext, url: String?, productId: String?, unitId: String?, info: FWVideoPlaybackDetails?, callbackId: Int?) {
|
|
269
293
|
val eventMap = Arguments.createMap()
|
|
270
294
|
eventMap.putString("url", url ?: "")
|
|
271
295
|
eventMap.putString("productId", productId)
|
|
272
296
|
eventMap.putString("unitId", unitId)
|
|
273
297
|
eventMap.putInt("callbackId", callbackId?:0)
|
|
298
|
+
eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
|
|
274
299
|
sendEvent(reactContext, FWVideoShoppingEventName.CustomLinkButtonClick.rawValue, eventMap)
|
|
275
300
|
}
|
|
276
301
|
}
|
|
@@ -32,6 +32,7 @@ import com.fireworksdk.bridge.models.enums.FWVideoFeedMode
|
|
|
32
32
|
import com.fireworksdk.bridge.models.enums.FWVideoFeedSource
|
|
33
33
|
import com.fireworksdk.bridge.models.enums.FWVideoFeedTitlePosition
|
|
34
34
|
import com.fireworksdk.bridge.models.enums.FWVideoPlayerCTAWidth
|
|
35
|
+
import com.fireworksdk.bridge.models.enums.FWVideoPlayerLogoOption
|
|
35
36
|
|
|
36
37
|
object FWConfigUtil {
|
|
37
38
|
|
|
@@ -394,6 +395,18 @@ object FWConfigUtil {
|
|
|
394
395
|
}
|
|
395
396
|
}
|
|
396
397
|
|
|
398
|
+
val logoConfigOption = videoFeedPropsModel.videoPlayerConfiguration?.videoPlayerLogoConfiguration?.option
|
|
399
|
+
val logoConfigChannelId = videoFeedPropsModel.videoPlayerConfiguration?.videoPlayerLogoConfiguration?.encodedId
|
|
400
|
+
when {
|
|
401
|
+
logoConfigOption == FWVideoPlayerLogoOption.Creator && !logoConfigChannelId.isNullOrBlank() -> {
|
|
402
|
+
playerOptionBuilder.logoConfig(LogoConfig.Logo.CreatorLogo(logoConfigChannelId))
|
|
403
|
+
}
|
|
404
|
+
logoConfigOption == FWVideoPlayerLogoOption.ChannelAggregator && !logoConfigChannelId.isNullOrBlank() -> {
|
|
405
|
+
playerOptionBuilder.logoConfig(LogoConfig.Logo.AggregatorLogo(logoConfigChannelId))
|
|
406
|
+
}
|
|
407
|
+
else -> {}
|
|
408
|
+
}
|
|
409
|
+
|
|
397
410
|
return ViewOptions.Builder()
|
|
398
411
|
.layoutOption(layoutOptionBuilder.build())
|
|
399
412
|
.titleOption(titleOptionBuilder.build())
|
|
@@ -17,7 +17,7 @@ object FWFragmentUtil {
|
|
|
17
17
|
fragmentActivity ?: return
|
|
18
18
|
|
|
19
19
|
fragment ?: return
|
|
20
|
-
if (!fragment.isAdded || fragment.isDetached || fragment.isRemoving) {
|
|
20
|
+
if (!fragment.isAdded || fragment.isDetached || fragment.isRemoving || fragmentActivity.isFinishing) {
|
|
21
21
|
return
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ object FWFragmentUtil {
|
|
|
25
25
|
removeChildFragment(fragment)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
fragmentActivity.supportFragmentManager.beginTransaction().remove(fragment).
|
|
28
|
+
fragmentActivity.supportFragmentManager.beginTransaction().remove(fragment).commitAllowingStateLoss()
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
private fun removeChildFragment(fragment: Fragment?) {
|
|
@@ -45,7 +45,7 @@ object FWFragmentUtil {
|
|
|
45
45
|
if (!fragment.isAdded || fragment.isDetached || fragment.isRemoving) {
|
|
46
46
|
continue
|
|
47
47
|
}
|
|
48
|
-
cfm.beginTransaction().remove(f).
|
|
48
|
+
cfm.beginTransaction().remove(f).commitAllowingStateLoss()
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
package com.fireworksdk.bridge.utils
|
|
2
2
|
|
|
3
|
-
import com.fireworksdk.bridge.components.storyblock.StoryBlockFragment
|
|
4
3
|
import com.fireworksdk.bridge.models.FWAdBadgeConfigModel
|
|
5
|
-
import com.fireworksdk.bridge.models.
|
|
4
|
+
import com.fireworksdk.bridge.models.FWSdkInitResultModel
|
|
6
5
|
|
|
7
6
|
object FWGlobalDataUtil {
|
|
8
7
|
|
|
8
|
+
var sdkInitResultModel: FWSdkInitResultModel? = null
|
|
9
|
+
|
|
9
10
|
var adBadgeConfigModel: FWAdBadgeConfigModel = FWAdBadgeConfigModel()
|
|
10
11
|
|
|
11
12
|
var customCTAClickEnabled: Boolean = false
|
|
@@ -15,4 +16,6 @@ object FWGlobalDataUtil {
|
|
|
15
16
|
var customClickLinkButtonEnabled: Boolean = false
|
|
16
17
|
|
|
17
18
|
var shareBaseUrl: String? = null
|
|
19
|
+
|
|
20
|
+
var pauseWhenNotVisible: Boolean = false
|
|
18
21
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.utils
|
|
2
|
+
|
|
3
|
+
import com.firework.analyticsevents.VideoInfo
|
|
4
|
+
import com.firework.analyticsevents.cta.CtaButtonClickAnalyticsEvent
|
|
5
|
+
import com.firework.analyticsevents.player.PlayerLifecycleAnalyticsEvent
|
|
6
|
+
import com.firework.analyticsevents.share.ShareButtonAnalyticsEvent
|
|
7
|
+
import com.fireworksdk.bridge.models.FWVideoPlaybackDetails
|
|
8
|
+
|
|
9
|
+
object FWModelUtils {
|
|
10
|
+
fun convertVideoInfo2PlaybackDetails(videoInfo: VideoInfo): FWVideoPlaybackDetails {
|
|
11
|
+
return FWVideoPlaybackDetails(
|
|
12
|
+
badge = videoInfo.badge,
|
|
13
|
+
caption = videoInfo.caption,
|
|
14
|
+
duration = videoInfo.duration,
|
|
15
|
+
hasCta = videoInfo.hasCta,
|
|
16
|
+
playerHeight = videoInfo.playerHeight,
|
|
17
|
+
playerWidth = videoInfo.playerWidth,
|
|
18
|
+
id = videoInfo.id,
|
|
19
|
+
feedId = videoInfo.feedId,
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
fun convertCtaEvent2PlaybackDetails(event: CtaButtonClickAnalyticsEvent): FWVideoPlaybackDetails {
|
|
24
|
+
return FWVideoPlaybackDetails(
|
|
25
|
+
badge = event.videoInfo.badge,
|
|
26
|
+
caption = event.videoInfo.caption,
|
|
27
|
+
duration = event.videoInfo.duration,
|
|
28
|
+
hasCta = true,
|
|
29
|
+
playerHeight = event.videoInfo.playerHeight,
|
|
30
|
+
playerWidth = event.videoInfo.playerWidth,
|
|
31
|
+
id = event.videoInfo.id,
|
|
32
|
+
actionUrl = event.actionUrl,
|
|
33
|
+
feedId = event.videoInfo.feedId,
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
fun convertPlayerEvent2PlaybackDetails(event: PlayerLifecycleAnalyticsEvent): FWVideoPlaybackDetails {
|
|
38
|
+
return FWVideoPlaybackDetails(
|
|
39
|
+
badge = event.videoInfo.badge,
|
|
40
|
+
caption = event.videoInfo.caption,
|
|
41
|
+
duration = event.videoInfo.duration,
|
|
42
|
+
hasCta = event.videoInfo.hasCta,
|
|
43
|
+
playerHeight = event.videoInfo.playerHeight,
|
|
44
|
+
playerWidth = event.videoInfo.playerWidth,
|
|
45
|
+
id = event.videoInfo.id,
|
|
46
|
+
progress = event.progress,
|
|
47
|
+
feedId = event.videoInfo.feedId,
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
fun convertShareButtonEvent2PlaybackDetails(event: ShareButtonAnalyticsEvent): FWVideoPlaybackDetails {
|
|
52
|
+
return FWVideoPlaybackDetails(
|
|
53
|
+
badge = event.videoInfo.badge,
|
|
54
|
+
caption = event.videoInfo.caption,
|
|
55
|
+
duration = event.videoInfo.duration,
|
|
56
|
+
hasCta = event.videoInfo.hasCta,
|
|
57
|
+
playerHeight = event.videoInfo.playerHeight,
|
|
58
|
+
playerWidth = event.videoInfo.playerWidth,
|
|
59
|
+
id = event.videoInfo.id,
|
|
60
|
+
feedId = event.videoInfo.feedId,
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|