react-native-firework-sdk 2.10.1 → 2.11.1
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 +20 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +4 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWCountdownTimerConfigurationModel.kt +8 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWCountdownTimerConfigurationModelDeserializer.kt +22 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWCountdownTimerConfigurationModelSerializer.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModel.kt +2 -2
- 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 +3 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +7 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +4 -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/FWAppearanceMode.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/FWVideoShoppingModule.kt +22 -9
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +74 -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/CountdownTimerConfiguration.swift +43 -0
- package/ios/Components/ReplayBadgeConfiguration.swift +12 -0
- package/ios/Components/StoryBlock.swift +37 -0
- package/ios/Components/StoryBlockConfiguration.swift +2 -0
- package/ios/Components/StoryBlockManager.m +24 -0
- package/ios/Components/StoryBlockManager.swift +6 -3
- package/ios/Components/VideoFeed.swift +23 -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 +2 -0
- package/ios/FWReactNativeSDK.swift +14 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +16 -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 +56 -3
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +48 -4
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js +7 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/CountdownTimerConfiguration.js +2 -0
- package/lib/commonjs/models/CountdownTimerConfiguration.js.map +1 -0
- 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 +55 -3
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +44 -4
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js +5 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/CountdownTimerConfiguration.js +2 -0
- package/lib/module/models/CountdownTimerConfiguration.js.map +1 -0
- 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 +15 -13
- package/lib/typescript/models/CountdownTimerConfiguration.d.ts +12 -0
- 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 +13 -1
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +6 -0
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +12 -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 +73 -7
- package/src/components/VideoFeed.tsx +61 -12
- package/src/index.ts +36 -30
- package/src/models/CountdownTimerConfiguration.ts +12 -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 +13 -1
- package/src/models/VideoFeedConfiguration.ts +6 -0
- package/src/models/VideoPlayerConfiguration.ts +12 -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,15 +1,11 @@
|
|
|
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 android.provider.Settings
|
|
12
|
-
import android.util.Base64
|
|
13
9
|
import androidx.annotation.Keep
|
|
14
10
|
import com.facebook.react.bridge.*
|
|
15
11
|
import com.firework.analyticsevents.cta.CtaButtonClickAnalyticsEvent
|
|
@@ -17,17 +13,14 @@ import com.firework.analyticsevents.player.PlayerLifecycleAnalyticsEvent
|
|
|
17
13
|
import com.firework.analyticsevents.share.ShareButtonAnalyticsEvent
|
|
18
14
|
import com.firework.bus.FwAnalyticCallable
|
|
19
15
|
import com.firework.sdk.FireworkSdk
|
|
20
|
-
import com.firework.sdk.FireworkSdkConfig
|
|
21
16
|
import com.fireworksdk.bridge.FWInitializationProvider
|
|
22
17
|
import com.fireworksdk.bridge.models.*
|
|
23
|
-
import com.fireworksdk.bridge.models.enums.FWPlayerLaunchBehavior
|
|
24
18
|
import com.fireworksdk.bridge.models.enums.FWVideoPlaybackSubEventName
|
|
19
|
+
import com.fireworksdk.bridge.reactnative.FWReactNativeSDK
|
|
25
20
|
import com.fireworksdk.bridge.reactnative.models.FireworkSDKInterface
|
|
26
21
|
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
27
22
|
import com.fireworksdk.bridge.utils.*
|
|
28
23
|
import org.json.JSONObject
|
|
29
|
-
import java.nio.charset.StandardCharsets
|
|
30
|
-
import java.security.MessageDigest
|
|
31
24
|
import java.util.*
|
|
32
25
|
import kotlin.system.exitProcess
|
|
33
26
|
|
|
@@ -53,16 +46,39 @@ class FireworkSDKModule(
|
|
|
53
46
|
@ReactMethod
|
|
54
47
|
override fun init(config: ReadableMap?, promise: Promise) {
|
|
55
48
|
FWColorUtil.useRgba = true
|
|
49
|
+
FWGlobalDataUtil.pauseWhenNotVisible = true
|
|
56
50
|
|
|
57
51
|
val configMap = config?.toHashMap() ?: hashMapOf()
|
|
58
52
|
val jsonObject = JSONObject(configMap)
|
|
59
53
|
val sdkInitOptionsModel = FWSDKInitOptionsModelDeserializer.deserialize(jsonObject)
|
|
60
54
|
|
|
61
55
|
UiThreadUtil.runOnUiThread {
|
|
62
|
-
|
|
56
|
+
initCalled(sdkInitOptionsModel)
|
|
57
|
+
FireworkSdk.analytics.register(this)
|
|
63
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
|
+
|
|
64
75
|
FireworkSdk.analytics.register(this)
|
|
76
|
+
promise.resolve(true)
|
|
77
|
+
|
|
78
|
+
return
|
|
65
79
|
}
|
|
80
|
+
|
|
81
|
+
promise.resolve(false)
|
|
66
82
|
}
|
|
67
83
|
|
|
68
84
|
/**
|
|
@@ -129,87 +145,6 @@ class FireworkSDKModule(
|
|
|
129
145
|
FWGlobalDataUtil.videoPlaybackEventEnabled = value?:false
|
|
130
146
|
}
|
|
131
147
|
|
|
132
|
-
private fun initSdk(sdkInitOptions: FWSDKInitOptionsModel?) {
|
|
133
|
-
val clientId = getAppid()
|
|
134
|
-
if (clientId.isNullOrBlank()) {
|
|
135
|
-
val errorMsg = "The appid is invalid"
|
|
136
|
-
FWLogUtils.d { errorMsg }
|
|
137
|
-
FWEventUtils.sendInitFailedEvent(reactApplicationContext, errorMsg)
|
|
138
|
-
return
|
|
139
|
-
}
|
|
140
|
-
val userId = sdkInitOptions?.userId
|
|
141
|
-
|
|
142
|
-
val uid = if (userId.isNullOrBlank()) { getHashedAndroidId() } else userId
|
|
143
|
-
val shareBaseURL = sdkInitOptions?.shareBaseURL
|
|
144
|
-
val videoLaunchBehavior = sdkInitOptions?.videoLaunchBehavior
|
|
145
|
-
|
|
146
|
-
val configBuilder = FireworkSdkConfig.Builder(reactApplicationContext)
|
|
147
|
-
.checksumRequired(false)
|
|
148
|
-
.clientId(clientId)
|
|
149
|
-
.userId(uid)
|
|
150
|
-
.enableCache(true)
|
|
151
|
-
shareBaseURL?.let {
|
|
152
|
-
FWGlobalDataUtil.shareBaseUrl = it
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
val livestreamPlayerInitializerList = FWLiveStreamUtil.livestreamPlayerInitializers()
|
|
156
|
-
for (livestreamPlayerInitializer in livestreamPlayerInitializerList) {
|
|
157
|
-
configBuilder.addLivestreamPlayerInitializer(livestreamPlayerInitializer)
|
|
158
|
-
}
|
|
159
|
-
when (videoLaunchBehavior) {
|
|
160
|
-
FWPlayerLaunchBehavior.Default -> {}
|
|
161
|
-
FWPlayerLaunchBehavior.MuteOnFirstLaunch -> {
|
|
162
|
-
configBuilder.muteOnLaunch(true)
|
|
163
|
-
}
|
|
164
|
-
else -> {}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
val imageLoader = FWImageLoaderUtil.getImageLoader()
|
|
168
|
-
if (imageLoader != null) {
|
|
169
|
-
configBuilder.imageLoader(imageLoader)
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
val config = configBuilder.build()
|
|
173
|
-
|
|
174
|
-
FireworkSdk.init(
|
|
175
|
-
config,
|
|
176
|
-
onSuccess = {
|
|
177
|
-
FWEventUtils.sendInitSuccessEvent(reactApplicationContext)
|
|
178
|
-
},
|
|
179
|
-
onError = { error ->
|
|
180
|
-
FWEventUtils.sendInitFailedEvent(reactApplicationContext, "$error")
|
|
181
|
-
},
|
|
182
|
-
)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
private fun getAppid(): String? {
|
|
186
|
-
val ai = reactApplicationContext.packageManager.getApplicationInfo(
|
|
187
|
-
reactApplicationContext.packageName,
|
|
188
|
-
PackageManager.GET_META_DATA
|
|
189
|
-
)
|
|
190
|
-
val value = ai.metaData.get("Firework:Appid")
|
|
191
|
-
return value?.let {
|
|
192
|
-
it as String
|
|
193
|
-
} ?: run {
|
|
194
|
-
null
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
@SuppressLint("HardwareIds")
|
|
199
|
-
private fun getHashedAndroidId(): String {
|
|
200
|
-
val androidId = Settings.Secure.getString(
|
|
201
|
-
reactApplicationContext.contentResolver,
|
|
202
|
-
Settings.Secure.ANDROID_ID
|
|
203
|
-
)
|
|
204
|
-
return getHash(androidId)
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
private fun getHash(text: String): String {
|
|
208
|
-
val digest: MessageDigest = MessageDigest.getInstance("SHA-256")
|
|
209
|
-
val hash: ByteArray = digest.digest(text.toByteArray(StandardCharsets.UTF_8))
|
|
210
|
-
return Base64.encodeToString(hash, Base64.DEFAULT)
|
|
211
|
-
}
|
|
212
|
-
|
|
213
148
|
@Keep
|
|
214
149
|
@FwAnalyticCallable
|
|
215
150
|
fun onCtaButtonClicked(event: CtaButtonClickAnalyticsEvent) {
|
|
@@ -217,24 +152,17 @@ class FireworkSDKModule(
|
|
|
217
152
|
Date()
|
|
218
153
|
)}")
|
|
219
154
|
|
|
155
|
+
val videoPlaybackDetails = FWModelUtils.convertCtaEvent2PlaybackDetails(event)
|
|
156
|
+
|
|
220
157
|
if (FWGlobalDataUtil.videoPlaybackEventEnabled) {
|
|
221
158
|
FWEventUtils.sendVideoPlaybackEvent(
|
|
222
159
|
reactApplicationContext,
|
|
223
160
|
FWVideoPlaybackSubEventName.ClickCTA.rawValue,
|
|
224
|
-
|
|
225
|
-
badge = event.videoInfo.badge,
|
|
226
|
-
caption = event.videoInfo.caption,
|
|
227
|
-
duration = event.videoInfo.duration,
|
|
228
|
-
hasCta = true,
|
|
229
|
-
playerHeight = event.videoInfo.playerHeight,
|
|
230
|
-
playerWidth = event.videoInfo.playerWidth,
|
|
231
|
-
id = event.videoInfo.id,
|
|
232
|
-
actionUrl = event.actionUrl,
|
|
233
|
-
)
|
|
161
|
+
videoPlaybackDetails
|
|
234
162
|
)
|
|
235
163
|
}
|
|
236
164
|
|
|
237
|
-
FWEventUtils.sendCustomCTAClickEvent(reactApplicationContext, event.actionUrl)
|
|
165
|
+
FWEventUtils.sendCustomCTAClickEvent(reactApplicationContext, event.actionUrl, videoPlaybackDetails)
|
|
238
166
|
}
|
|
239
167
|
|
|
240
168
|
@Keep
|
|
@@ -244,15 +172,7 @@ class FireworkSDKModule(
|
|
|
244
172
|
FWEventUtils.sendVideoPlaybackEvent(
|
|
245
173
|
reactApplicationContext,
|
|
246
174
|
FWVideoPlaybackSubEventName.ClickShare.rawValue,
|
|
247
|
-
|
|
248
|
-
badge = event.videoInfo.badge,
|
|
249
|
-
caption = event.videoInfo.caption,
|
|
250
|
-
duration = event.videoInfo.duration,
|
|
251
|
-
hasCta = event.videoInfo.hasCta,
|
|
252
|
-
playerHeight = event.videoInfo.playerHeight,
|
|
253
|
-
playerWidth = event.videoInfo.playerWidth,
|
|
254
|
-
id = event.videoInfo.id,
|
|
255
|
-
)
|
|
175
|
+
FWModelUtils.convertShareButtonEvent2PlaybackDetails(event)
|
|
256
176
|
)
|
|
257
177
|
}
|
|
258
178
|
}
|
|
@@ -263,18 +183,7 @@ class FireworkSDKModule(
|
|
|
263
183
|
if (!FWGlobalDataUtil.videoPlaybackEventEnabled) {
|
|
264
184
|
return
|
|
265
185
|
}
|
|
266
|
-
val
|
|
267
|
-
|
|
268
|
-
val videoPlaybackDetails = FWVideoPlaybackDetails(
|
|
269
|
-
badge = event.videoInfo.badge,
|
|
270
|
-
caption = event.videoInfo.caption,
|
|
271
|
-
duration = event.videoInfo.duration,
|
|
272
|
-
hasCta = event.videoInfo.hasCta,
|
|
273
|
-
playerHeight = event.videoInfo.playerHeight,
|
|
274
|
-
playerWidth = event.videoInfo.playerWidth,
|
|
275
|
-
id = event.videoInfo.id,
|
|
276
|
-
progress = progress
|
|
277
|
-
)
|
|
186
|
+
val videoPlaybackDetails = FWModelUtils.convertPlayerEvent2PlaybackDetails(event)
|
|
278
187
|
when (event) {
|
|
279
188
|
is PlayerLifecycleAnalyticsEvent.OnStarted -> {
|
|
280
189
|
if (event.videoInfo.isAd) {
|
|
@@ -367,6 +276,29 @@ class FireworkSDKModule(
|
|
|
367
276
|
}, 300)
|
|
368
277
|
}
|
|
369
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
|
+
|
|
370
302
|
@ReactMethod
|
|
371
303
|
fun addListener(eventName: String?, promise: Promise) {
|
|
372
304
|
// Set up any upstream listeners or background tasks as necessary
|
|
@@ -385,4 +317,24 @@ class FireworkSDKModule(
|
|
|
385
317
|
return "FireworkSDK"
|
|
386
318
|
}
|
|
387
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
|
+
|
|
388
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
|
+
}
|