react-native-firework-sdk 2.0.0 → 2.2.0-beta.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/FireworkVideoUI.xcframework/Info.plist +40 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +280 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +18 -0
- 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 +1327 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +41 -0
- 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 +41 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +11 -0
- 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 +556 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +18 -0
- 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 +1327 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +41 -0
- 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 +41 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +1327 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +41 -0
- 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 +41 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +11 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +245 -0
- package/README.md +1 -1
- package/android/build.gradle +5 -4
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +6 -0
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/StoryBlockFragment.kt +129 -0
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/StoryBlockFrameLayout.kt +90 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModelDeserializer.kt +3 -3
- package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +5 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModelDeserializer.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfiguration.kt +18 -5
- package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationDeserializer.kt +36 -8
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +3 -3
- package/android/src/main/java/com/fireworksdk/bridge/models/FWShoppingCtaResult.kt +17 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWShoppingCtaResultDeserializer.kt +33 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModelDeserializer.kt +14 -12
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelDeserializer.kt +11 -7
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedSource.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +8 -8
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +19 -12
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoShoppingProductDeserializer.kt +11 -11
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +131 -45
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +11 -3
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +2 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +45 -4
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +9 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +83 -50
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +112 -36
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +16 -6
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +26 -32
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +10 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +48 -16
- package/android/src/main/res/layout/fw_bridge_story_block.xml +24 -0
- package/ios/Components/StoryBlock.swift +32 -2
- package/ios/Components/StoryBlockManager.m +33 -0
- package/ios/Components/StoryBlockManager.swift +4 -0
- package/ios/Components/VideoFeed.swift +16 -32
- package/ios/Components/VideoFeedManager.m +12 -6
- package/ios/Components/VideoFeedManager.swift +4 -0
- package/ios/Components/VideoPlayerConfiguration.swift +1 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +276 -212
- package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +13 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +18 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +147 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +58 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +25 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +69 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +91 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +98 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +97 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +97 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +38 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +46 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +26 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +43 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +42 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +160 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +35 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +199 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +59 -0
- package/ios/{Utils/DispatchQueue+FWOnce.swift → FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift} +5 -5
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +18 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +46 -0
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +37 -0
- package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +766 -0
- package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +10 -0
- package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +37 -0
- package/ios/FireworkVideoUI/Podfile +15 -0
- package/ios/FireworkVideoUI/Podfile.lock +16 -0
- package/ios/Models/NativeToRN/FireworkEventName.swift +7 -1
- package/ios/Models/NativeToRN/FireworkSDK+Json.swift +5 -1
- package/ios/Models/RNToNative/RCTConvert+Shopping.swift +21 -0
- package/ios/Models/RNToNative/RCTConvert+StoryBlock.swift +2 -1
- package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +29 -1
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +13 -101
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +34 -16
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +48 -2
- package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +0 -1
- package/ios/Modules/LiveStream/LiveStreamModule.swift +1 -0
- package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +7 -2
- package/ios/Modules/Shopping/ShoppingCTAResult.swift +16 -0
- package/ios/Modules/Shopping/ShoppingModule.m +2 -1
- package/ios/Modules/Shopping/ShoppingModule.swift +92 -34
- package/ios/Support/MultiHostStreaming/FWMultiHostStreaming.podspec +22 -0
- package/ios/Support/MultiHostStreaming/Sources/MultiHostStreamingSDK.swift +17 -0
- package/ios/Utils/{UINavigationController+FWSwizzle.swift → Extensions/Swizzle/UINavigationController+FWSwizzle.swift} +9 -8
- package/ios/Utils/FWSwizzleLoader.m +6 -1
- package/ios/Utils/FWSwizzleLoader.swift +13 -0
- package/ios/react_native_firework_sdk.h +1 -0
- package/ios/scripts/react_native_firework_sdk_pods.rb +27 -0
- package/lib/commonjs/FireworkSDK.js +55 -15
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/LiveStream.js +2 -2
- package/lib/commonjs/LiveStream.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +21 -38
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +193 -128
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +17 -5
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +3 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/models/ShoppingCTAResult.js +2 -0
- package/lib/commonjs/models/VideoPlaybackEventName.js +3 -0
- package/lib/commonjs/models/VideoPlaybackEventName.js.map +1 -1
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +54 -15
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/LiveStream.js +2 -2
- package/lib/module/LiveStream.js.map +1 -1
- package/lib/module/VideoShopping.js +21 -40
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/StoryBlock.js +183 -133
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +16 -5
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +3 -0
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/models/ShoppingCTAResult.js +2 -0
- package/lib/module/models/VideoPlaybackEventName.js +3 -0
- package/lib/module/models/VideoPlaybackEventName.js.map +1 -1
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +15 -8
- package/lib/typescript/LiveStream.d.ts +2 -2
- package/lib/typescript/VideoShopping.d.ts +10 -12
- package/lib/typescript/components/StoryBlock.d.ts +25 -24
- package/lib/typescript/components/VideoFeed.d.ts +7 -0
- package/lib/typescript/index.d.ts +6 -6
- package/lib/typescript/models/FWEventName.d.ts +3 -0
- package/lib/typescript/models/FWEvents.d.ts +14 -1
- package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +12 -8
- package/lib/typescript/models/SDKInitOptions.d.ts +6 -1
- package/lib/typescript/models/ShoppingCTAResult.d.ts +11 -0
- package/lib/typescript/models/StoryBlockSource.d.ts +1 -1
- package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
- package/lib/typescript/models/VideoPlaybackDetails.d.ts +16 -0
- package/lib/typescript/models/VideoPlaybackEventName.d.ts +13 -1
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +4 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -2
- package/lib/typescript/modules/ShoppingModule.d.ts +2 -1
- package/package.json +8 -3
- package/react-native-firework-sdk.podspec +31 -24
- package/src/FireworkSDK.ts +54 -15
- package/src/LiveStream.ts +2 -2
- package/src/VideoShopping.ts +41 -54
- package/src/components/StoryBlock.tsx +210 -98
- package/src/components/VideoFeed.tsx +23 -4
- package/src/index.ts +15 -9
- package/src/models/FWEventName.ts +3 -0
- package/src/models/FWEvents.ts +14 -1
- package/src/models/ProductInfoViewConfiguration.ts +13 -8
- package/src/models/SDKInitOptions.ts +6 -1
- package/src/models/ShoppingCTAResult.ts +11 -0
- package/src/models/StoryBlockSource.ts +2 -1
- package/src/models/VideoFeedSource.ts +2 -1
- package/src/models/VideoPlaybackDetails.ts +16 -0
- package/src/models/VideoPlaybackEventName.ts +13 -1
- package/src/models/VideoPlayerConfiguration.ts +4 -0
- package/src/modules/FireworkSDKModule.ts +1 -2
- package/src/modules/ShoppingModule.ts +5 -5
- package/android/src/main/java/com/fireworksdk/bridge/constants/FWCommandConstant.kt +0 -6
- package/ios/Utils/FWSwizzleUtil.swift +0 -29
- package/ios/Utils/UIView+ParentViewController.swift +0 -21
- package/lib/commonjs/models/AddToCartResult.js +0 -2
- package/lib/module/models/AddToCartResult.js +0 -2
- package/lib/typescript/models/AddToCartResult.d.ts +0 -10
- package/src/models/AddToCartResult.ts +0 -10
- /package/ios/Utils/{String+Color.swift → Extensions/String+Color.swift} +0 -0
- /package/ios/Utils/{UIView+Constraints.swift → Extensions/UIView+Constraints.swift} +0 -0
- /package/ios/Utils/{UIViewController+AttachChild.swift → Extensions/UIViewController+AttachChild.swift} +0 -0
- /package/lib/commonjs/models/{AddToCartResult.js.map → ShoppingCTAResult.js.map} +0 -0
- /package/lib/module/models/{AddToCartResult.js.map → ShoppingCTAResult.js.map} +0 -0
package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt
CHANGED
|
@@ -3,10 +3,7 @@ package com.fireworksdk.bridge.reactnative.manager
|
|
|
3
3
|
import android.view.Choreographer
|
|
4
4
|
import android.view.View
|
|
5
5
|
import android.view.ViewGroup
|
|
6
|
-
import android.widget.FrameLayout
|
|
7
|
-
import androidx.annotation.Nullable
|
|
8
6
|
import androidx.appcompat.app.AppCompatActivity
|
|
9
|
-
import com.facebook.react.bridge.Dynamic
|
|
10
7
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
11
8
|
import com.facebook.react.bridge.ReadableArray
|
|
12
9
|
import com.facebook.react.bridge.ReadableMap
|
|
@@ -14,78 +11,107 @@ import com.facebook.react.common.MapBuilder
|
|
|
14
11
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
15
12
|
import com.facebook.react.uimanager.ViewGroupManager
|
|
16
13
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
17
|
-
import com.
|
|
18
|
-
import com.fireworksdk.bridge.
|
|
19
|
-
import com.fireworksdk.bridge.
|
|
14
|
+
import com.firework.storyblock.FeedLoadState
|
|
15
|
+
import com.fireworksdk.bridge.components.videofeed.StoryBlockFragment
|
|
16
|
+
import com.fireworksdk.bridge.components.videofeed.StoryBlockFrameLayout
|
|
17
|
+
import com.fireworksdk.bridge.models.*
|
|
18
|
+
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
19
|
+
import com.fireworksdk.bridge.utils.FWGlobalDataUtil
|
|
20
20
|
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
21
|
+
import org.json.JSONObject
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
class FWStoryBlockManager(
|
|
24
25
|
private val reactContext: ReactApplicationContext
|
|
25
|
-
) : ViewGroupManager<
|
|
26
|
-
|
|
27
|
-
private val videoFeedPropsModel: FWVideoFeedPropsModel by lazy { FWVideoFeedPropsModel() }
|
|
28
|
-
|
|
29
|
-
private var viewId: Int? = null
|
|
26
|
+
) : ViewGroupManager<StoryBlockFrameLayout>() {
|
|
30
27
|
|
|
31
28
|
override fun getName(): String {
|
|
32
29
|
return REACT_CLASS
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
override fun createViewInstance(reactContext: ThemedReactContext):
|
|
36
|
-
return
|
|
32
|
+
override fun createViewInstance(reactContext: ThemedReactContext): StoryBlockFrameLayout {
|
|
33
|
+
return StoryBlockFrameLayout(reactContext)
|
|
37
34
|
}
|
|
38
35
|
|
|
39
|
-
override fun onAfterUpdateTransaction(view:
|
|
36
|
+
override fun onAfterUpdateTransaction(view: StoryBlockFrameLayout) {
|
|
40
37
|
super.onAfterUpdateTransaction(view)
|
|
38
|
+
// after createFragment
|
|
41
39
|
FWLogUtils.d { "FWStoryBlockManager onAfterUpdateTransaction" }
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
override fun getCommandsMap(): Map<String, Int> {
|
|
43
|
+
val map: MutableMap<String, Int> = HashMap()
|
|
44
|
+
map["create"] = COMMAND_CREATE
|
|
45
|
+
map["play"] = COMMAND_PLAY
|
|
46
|
+
map["pause"] = COMMAND_PAUSE
|
|
47
|
+
map["toggle_full_screen"] = COMMAND_TOGGLE_FULL_SCREEN
|
|
48
|
+
return map
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
override fun receiveCommand(
|
|
50
|
-
root:
|
|
52
|
+
root: StoryBlockFrameLayout,
|
|
51
53
|
commandId: String?,
|
|
52
54
|
args: ReadableArray?
|
|
53
55
|
) {
|
|
54
56
|
super.receiveCommand(root, commandId, args)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
FWLogUtils.d { "FWStoryBlockManager receiveCommand commandId: $commandId, reactNativeViewId: $reactNativeViewId" }
|
|
57
|
+
FWLogUtils.d { "FWStoryBlockManager receiveCommand commandId: $commandId, root.isAttachedToWindow: ${root.isAttachedToWindow}" }
|
|
58
58
|
when (commandId?.toInt()) {
|
|
59
|
-
COMMAND_CREATE ->
|
|
59
|
+
COMMAND_CREATE -> {
|
|
60
|
+
val reactNativeViewId = requireNotNull(args).getInt(0)
|
|
61
|
+
createFragment(root, reactNativeViewId)
|
|
62
|
+
}
|
|
63
|
+
COMMAND_PLAY -> root.play()
|
|
64
|
+
COMMAND_PAUSE -> root.pause()
|
|
65
|
+
COMMAND_TOGGLE_FULL_SCREEN -> root.toggleFullScreen()
|
|
60
66
|
else -> {}
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
@ReactProp(name = "source")
|
|
65
|
-
fun setSource(view:
|
|
66
|
-
|
|
71
|
+
fun setSource(view: StoryBlockFrameLayout, source: String?) {
|
|
72
|
+
view.setSource(source)
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
@ReactProp(name = "channel")
|
|
70
|
-
fun setChannel(view:
|
|
71
|
-
|
|
76
|
+
fun setChannel(view: StoryBlockFrameLayout, channel: String?) {
|
|
77
|
+
view.setChannel(channel)
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
@ReactProp(name = "playlist")
|
|
75
|
-
fun setPlaylist(view:
|
|
76
|
-
|
|
81
|
+
fun setPlaylist(view: StoryBlockFrameLayout, playlist: String?) {
|
|
82
|
+
view.setPlaylist(playlist)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@ReactProp(name = "hashtagFilterExpression")
|
|
86
|
+
fun setHashtagFilterExpression(view: StoryBlockFrameLayout, hashtagFilterExpression: String?) {
|
|
87
|
+
view.setHashtagFilterExpressionProps(hashtagFilterExpression)
|
|
77
88
|
}
|
|
78
89
|
|
|
79
90
|
@ReactProp(name = "dynamicContentParameters")
|
|
80
|
-
fun setDynamicContentParameters(view:
|
|
91
|
+
fun setDynamicContentParameters(view: StoryBlockFrameLayout, parameters: ReadableMap?) {
|
|
81
92
|
val parametersMap = parameters?.toHashMap() as? HashMap<String, List<String>>
|
|
82
|
-
|
|
93
|
+
view.setDynamicContentParameters(parametersMap)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@ReactProp(name = "enablePictureInPicture")
|
|
97
|
+
fun setEnablePictureInPicture(view: StoryBlockFrameLayout, enablePictureInPicture: Boolean?) {
|
|
98
|
+
view.setEnablePictureInPicture(enablePictureInPicture)
|
|
83
99
|
}
|
|
84
100
|
|
|
85
|
-
@
|
|
86
|
-
fun
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
@ReactProp(name = "videoFeedConfiguration")
|
|
102
|
+
fun setVideoFeedConfig(view: StoryBlockFrameLayout, config: ReadableMap?) {
|
|
103
|
+
val configMap = config?.toHashMap() ?: hashMapOf()
|
|
104
|
+
val jsonObject = JSONObject(configMap)
|
|
105
|
+
val videoFeedConfigModel = FWVideoFeedConfigModelDeserializer.deserialize(jsonObject)
|
|
106
|
+
view.setVideoFeedConfig(videoFeedConfigModel)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@ReactProp(name = "videoPlayerConfiguration")
|
|
110
|
+
fun setVideoPlayerConfig(view: StoryBlockFrameLayout, config: ReadableMap?) {
|
|
111
|
+
val configMap = config?.toHashMap() ?: hashMapOf()
|
|
112
|
+
val jsonObject = JSONObject(configMap)
|
|
113
|
+
val videoPlayerConfigModel = FWVideoPlayerConfigModelDeserializer.deserialize(jsonObject)
|
|
114
|
+
view.setVideoPlayerConfig(videoPlayerConfigModel)
|
|
89
115
|
}
|
|
90
116
|
|
|
91
117
|
private fun setupLayout(view: View) {
|
|
@@ -100,46 +126,106 @@ class FWStoryBlockManager(
|
|
|
100
126
|
})
|
|
101
127
|
}
|
|
102
128
|
|
|
103
|
-
/**
|
|
104
|
-
* Layout all children properly
|
|
105
|
-
*/
|
|
106
129
|
private fun manuallyLayoutChildren(view: View) {
|
|
107
130
|
view.measure(
|
|
108
131
|
View.MeasureSpec.makeMeasureSpec(view.measuredWidth, View.MeasureSpec.EXACTLY),
|
|
109
132
|
View.MeasureSpec.makeMeasureSpec(view.measuredHeight, View.MeasureSpec.EXACTLY)
|
|
110
133
|
)
|
|
111
|
-
|
|
112
134
|
view.layout(view.left, view.top, view.right, view.bottom)
|
|
113
135
|
}
|
|
114
136
|
|
|
137
|
+
private fun addStoryBlockListener(fragment: StoryBlockFragment, reactNativeViewId: Int) {
|
|
138
|
+
fragment.setFeedLoadListener { feedLoadState ->
|
|
139
|
+
when (feedLoadState) {
|
|
140
|
+
FeedLoadState.FeedLoaded -> {
|
|
141
|
+
FWEventUtils.receiveStoryBlockLoadFinishedSuccessEvent(reactContext, reactNativeViewId)
|
|
142
|
+
}
|
|
143
|
+
FeedLoadState.FeedLoadFailed -> {
|
|
144
|
+
FWEventUtils.receiveStoryBlockLoadFinishedFailedEvent(
|
|
145
|
+
reactContext,
|
|
146
|
+
reactNativeViewId,
|
|
147
|
+
"FeedLoadFailed",
|
|
148
|
+
"FeedLoadFailed"
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
else -> {}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
115
154
|
|
|
116
|
-
|
|
155
|
+
fragment.setOnFullScreenStateChangedListener { isFullScreen ->
|
|
156
|
+
if (isFullScreen) {
|
|
157
|
+
FWGlobalDataUtil.storyBlockFragment = fragment
|
|
158
|
+
}
|
|
159
|
+
FWEventUtils.receiveStoryBlockFullScreenStateChangedEvent(
|
|
160
|
+
reactContext,
|
|
161
|
+
reactNativeViewId,
|
|
162
|
+
isFullScreen
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
private fun createFragment(root: StoryBlockFrameLayout, reactNativeViewId: Int?) {
|
|
117
169
|
FWLogUtils.d { "FWStoryBlockManager createFragment, reactNativeViewId = $reactNativeViewId" }
|
|
118
170
|
reactNativeViewId ?: return
|
|
119
171
|
val activity = (reactContext.currentActivity as AppCompatActivity?) ?: return
|
|
120
172
|
|
|
121
|
-
viewId = reactNativeViewId
|
|
122
|
-
|
|
123
173
|
val parentView = root.findViewById(reactNativeViewId) as ViewGroup
|
|
124
174
|
// parentView.setBackgroundColor(Color.YELLOW)
|
|
125
175
|
setupLayout(parentView)
|
|
176
|
+
|
|
177
|
+
val fragment = StoryBlockFragment()
|
|
178
|
+
root.setFragment(fragment)
|
|
179
|
+
addStoryBlockListener(fragment, reactNativeViewId)
|
|
180
|
+
|
|
181
|
+
if (parentView.isAttachedToWindow) {
|
|
182
|
+
if (!fragment.isAdded) {
|
|
183
|
+
activity.supportFragmentManager
|
|
184
|
+
.beginTransaction()
|
|
185
|
+
.replace(reactNativeViewId, fragment, reactNativeViewId.toString())
|
|
186
|
+
.commit()
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
parentView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
|
|
190
|
+
override fun onViewAttachedToWindow(v: View?) {
|
|
191
|
+
FWLogUtils.d { "FWStoryBlockManager createFragment doOnAttach" }
|
|
192
|
+
if (!fragment.isAdded) {
|
|
193
|
+
activity.supportFragmentManager
|
|
194
|
+
.beginTransaction()
|
|
195
|
+
.replace(reactNativeViewId, fragment, reactNativeViewId.toString())
|
|
196
|
+
.commit()
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
override fun onViewDetachedFromWindow(v: View?) {
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
}
|
|
126
204
|
}
|
|
127
205
|
|
|
128
|
-
override fun onDropViewInstance(view:
|
|
206
|
+
override fun onDropViewInstance(view: StoryBlockFrameLayout) {
|
|
207
|
+
val activity = reactContext.currentActivity as AppCompatActivity
|
|
208
|
+
val fragment = view.getFragment()
|
|
209
|
+
fragment?.let {
|
|
210
|
+
activity.supportFragmentManager.beginTransaction().remove(it).commit()
|
|
211
|
+
}
|
|
212
|
+
view.destroy()
|
|
129
213
|
super.onDropViewInstance(view)
|
|
130
214
|
}
|
|
131
215
|
|
|
132
216
|
override fun getExportedCustomBubblingEventTypeConstants(): MutableMap<String, Any>? {
|
|
133
217
|
return MapBuilder.builder<String, Any>()
|
|
134
218
|
.put(FWStoryBlockEventName.StoryBlockLoadFinished.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWStoryBlockEventName.StoryBlockLoadFinished.rawValue)))
|
|
219
|
+
.put(FWStoryBlockEventName.StoryBlockFullScreenStateChanged.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWStoryBlockEventName.StoryBlockFullScreenStateChanged.rawValue)))
|
|
135
220
|
.build()
|
|
136
221
|
}
|
|
137
222
|
|
|
138
223
|
companion object {
|
|
139
224
|
private const val REACT_CLASS = "FWStoryBlock"
|
|
140
|
-
const val
|
|
141
|
-
const val
|
|
142
|
-
private const val
|
|
225
|
+
private const val COMMAND_CREATE = 1000000
|
|
226
|
+
private const val COMMAND_PLAY = 1000001
|
|
227
|
+
private const val COMMAND_PAUSE = 1000002
|
|
228
|
+
private const val COMMAND_TOGGLE_FULL_SCREEN = 1000003
|
|
143
229
|
}
|
|
144
230
|
|
|
145
231
|
}
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt
CHANGED
|
@@ -7,7 +7,6 @@ import com.facebook.react.uimanager.SimpleViewManager
|
|
|
7
7
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
8
8
|
|
|
9
9
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
10
|
-
import com.fireworksdk.bridge.constants.FWCommandConstant
|
|
11
10
|
import com.facebook.react.common.MapBuilder
|
|
12
11
|
import com.firework.videofeed.FeedItemClickListener
|
|
13
12
|
import com.firework.videofeed.FeedViewState
|
|
@@ -67,6 +66,11 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
|
|
|
67
66
|
view.setPlaylistGroupProps(playlistGroup)
|
|
68
67
|
}
|
|
69
68
|
|
|
69
|
+
@ReactProp(name = "hashtagFilterExpression")
|
|
70
|
+
fun setHashtagFilterExpression(view: FWVideoFeed, hashtagFilterExpression: String?) {
|
|
71
|
+
view.setHashtagFilterExpressionProps(hashtagFilterExpression)
|
|
72
|
+
}
|
|
73
|
+
|
|
70
74
|
@ReactProp(name = "mode")
|
|
71
75
|
fun setMode(view: FWVideoFeed, mode: String?) {
|
|
72
76
|
view.setModeProps(mode)
|
|
@@ -148,7 +152,7 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
|
|
|
148
152
|
|
|
149
153
|
override fun getCommandsMap(): MutableMap<String, Int> {
|
|
150
154
|
val map: MutableMap<String, Int> = HashMap()
|
|
151
|
-
map["refresh"] =
|
|
155
|
+
map["refresh"] = COMMAND_REFRESH
|
|
152
156
|
return map
|
|
153
157
|
}
|
|
154
158
|
|
|
@@ -156,7 +160,7 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
|
|
|
156
160
|
super.receiveCommand(root, commandId, args)
|
|
157
161
|
FWLogUtils.d { "FWVideoFeedManager receiveCommand commandId: $commandId" }
|
|
158
162
|
when (commandId?.toInt()) {
|
|
159
|
-
|
|
163
|
+
COMMAND_REFRESH -> {
|
|
160
164
|
FWLogUtils.d { "FWVideoFeedManager call refresh" }
|
|
161
165
|
root.refresh()
|
|
162
166
|
}
|
|
@@ -175,4 +179,8 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
|
|
|
175
179
|
.build()
|
|
176
180
|
}
|
|
177
181
|
|
|
182
|
+
companion object {
|
|
183
|
+
private const val COMMAND_REFRESH = 1000001
|
|
184
|
+
}
|
|
185
|
+
|
|
178
186
|
}
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt
CHANGED
|
@@ -8,8 +8,8 @@ interface FWVideoShoppingInterface {
|
|
|
8
8
|
|
|
9
9
|
fun init()
|
|
10
10
|
fun updateVideoProducts(productArray: ReadableArray?, callbackId: String?)
|
|
11
|
-
fun
|
|
12
|
-
fun
|
|
11
|
+
fun setProductInfoViewConfiguration(config: ReadableMap?)
|
|
12
|
+
fun updateShoppingCTAResult(result: ReadableMap?, callbackId: Int?)
|
|
13
13
|
fun jumpToCartPage(callbackId: Int?, props: ReadableMap?)
|
|
14
14
|
fun setCartIconVisible(visible: Boolean?)
|
|
15
15
|
fun setCartItemCount(count: Int?)
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt
CHANGED
|
@@ -3,7 +3,14 @@ package com.fireworksdk.bridge.reactnative.module
|
|
|
3
3
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
4
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
5
5
|
import com.facebook.react.bridge.ReactMethod
|
|
6
|
+
import com.firework.analyticsevents.livestream.LivestreamAnalyticEvent
|
|
7
|
+
import com.firework.bus.FwAnalyticCallable
|
|
8
|
+
import com.firework.sdk.FireworkSdk
|
|
9
|
+
import com.fireworksdk.bridge.models.FWLiveStreamEventDetailsModel
|
|
10
|
+
import com.fireworksdk.bridge.models.FWLiveStreamEventName
|
|
11
|
+
import com.fireworksdk.bridge.models.FWLiveStreamMessageDetailsModel
|
|
6
12
|
import com.fireworksdk.bridge.reactnative.models.FWLiveStreamInterface
|
|
13
|
+
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
7
14
|
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
8
15
|
|
|
9
16
|
|
|
@@ -13,14 +20,48 @@ class FWLiveStreamModule(
|
|
|
13
20
|
|
|
14
21
|
@ReactMethod
|
|
15
22
|
override fun init() {
|
|
16
|
-
|
|
23
|
+
FireworkSdk.analytics.register(this)
|
|
17
24
|
}
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
@FwAnalyticCallable
|
|
27
|
+
fun onLivestreamEvent(event: LivestreamAnalyticEvent) {
|
|
28
|
+
when (event) {
|
|
29
|
+
is LivestreamAnalyticEvent.UserSentChatMessage -> {
|
|
30
|
+
FWLogUtils.d { "userSentChat: $event" }
|
|
31
|
+
FWEventUtils.sendLiveStreamChatEvent(
|
|
32
|
+
reactApplicationContext,
|
|
33
|
+
FWLiveStreamEventName.UserSendChat.rawValue,
|
|
34
|
+
FWLiveStreamMessageDetailsModel(event.messageId, event.username, event.messageText),
|
|
35
|
+
FWLiveStreamEventDetailsModel(event.livestreamId)
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
is LivestreamAnalyticEvent.UserJoined -> {
|
|
39
|
+
FWLogUtils.d { "userJoined: $event" }
|
|
40
|
+
FWEventUtils.sendLiveStreamEvent(
|
|
41
|
+
reactApplicationContext,
|
|
42
|
+
FWLiveStreamEventName.UserJoin.rawValue,
|
|
43
|
+
FWLiveStreamEventDetailsModel(event.livestreamId)
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
is LivestreamAnalyticEvent.UserLeft -> {
|
|
47
|
+
FWLogUtils.d { "userLeft: $event" }
|
|
48
|
+
FWEventUtils.sendLiveStreamEvent(
|
|
49
|
+
reactApplicationContext,
|
|
50
|
+
FWLiveStreamEventName.UserLeave.rawValue,
|
|
51
|
+
FWLiveStreamEventDetailsModel(event.livestreamId)
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
is LivestreamAnalyticEvent.UserSentLike -> {
|
|
55
|
+
FWLogUtils.d { "userSentLike: $event" }
|
|
56
|
+
FWEventUtils.sendLiveStreamEvent(
|
|
57
|
+
reactApplicationContext,
|
|
58
|
+
FWLiveStreamEventName.UserSendLike.rawValue,
|
|
59
|
+
FWLiveStreamEventDetailsModel(event.livestreamId)
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
21
63
|
}
|
|
22
64
|
|
|
23
|
-
|
|
24
65
|
@ReactMethod
|
|
25
66
|
fun addListener(eventName: String?) {
|
|
26
67
|
// Set up any upstream listeners or background tasks as necessary
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt
CHANGED
|
@@ -3,10 +3,10 @@ package com.fireworksdk.bridge.reactnative.module
|
|
|
3
3
|
import android.app.Activity
|
|
4
4
|
import com.facebook.react.bridge.*
|
|
5
5
|
import com.firework.sdk.FireworkSdk
|
|
6
|
-
import com.firework.videofeed.PlayerActivity
|
|
7
6
|
import com.fireworksdk.bridge.FWInitializationProvider
|
|
8
7
|
import com.fireworksdk.bridge.reactnative.models.FWNavigatorInterface
|
|
9
8
|
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
9
|
+
import com.fireworksdk.bridge.utils.FWGlobalDataUtil
|
|
10
10
|
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
11
11
|
|
|
12
12
|
|
|
@@ -30,6 +30,14 @@ class FWNavigatorModule(
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
if (isTaskRoot(activity)) {
|
|
33
|
+
if (FWGlobalDataUtil.storyBlockFragment?.isFullScreen() == true) {
|
|
34
|
+
UiThreadUtil.runOnUiThread {
|
|
35
|
+
FWGlobalDataUtil.storyBlockFragment?.toggleFullScreen()
|
|
36
|
+
}
|
|
37
|
+
promise.resolve(true)
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
promise.resolve(false)
|
|
34
42
|
return
|
|
35
43
|
}
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt
CHANGED
|
@@ -7,12 +7,9 @@ import com.firework.common.product.CurrencyCode
|
|
|
7
7
|
import com.firework.common.product.Product
|
|
8
8
|
import com.firework.error.shopping.ShoppingError
|
|
9
9
|
import com.firework.sdk.FireworkSdk
|
|
10
|
-
import com.firework.shopping
|
|
11
|
-
import com.firework.shopping.Shopping
|
|
10
|
+
import com.firework.shopping.*
|
|
12
11
|
import com.fireworksdk.bridge.FWInitializationProvider
|
|
13
|
-
import com.fireworksdk.bridge.models
|
|
14
|
-
import com.fireworksdk.bridge.models.FWVideoShoppingProduct
|
|
15
|
-
import com.fireworksdk.bridge.models.FWVideoShoppingProductDeserializer
|
|
12
|
+
import com.fireworksdk.bridge.models.*
|
|
16
13
|
import com.fireworksdk.bridge.reactnative.models.FWVideoShoppingInterface
|
|
17
14
|
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
18
15
|
import com.fireworksdk.bridge.utils.FWDateUtils
|
|
@@ -28,7 +25,7 @@ class FWVideoShoppingModule(
|
|
|
28
25
|
reactContext: ReactApplicationContext
|
|
29
26
|
) : ReactContextBaseJavaModule(reactContext), FWVideoShoppingInterface {
|
|
30
27
|
|
|
31
|
-
private var
|
|
28
|
+
private var ctaHandler: Triple<Int, String, String>? = null
|
|
32
29
|
private var cartClickHandler: Pair<Int, Activity>? = null
|
|
33
30
|
private val updateProductHandler: HashMap<String, List<Product>> = HashMap()
|
|
34
31
|
private val updateProductHydratorHandler: HashMap<String, ProductHydrator> = HashMap()
|
|
@@ -115,6 +112,8 @@ class FWVideoShoppingModule(
|
|
|
115
112
|
else unit.price.currencyCode
|
|
116
113
|
|
|
117
114
|
variant(variantId) {
|
|
115
|
+
imageUrl((vpu.imageUrl ?: unit.image?.url) ?: "")
|
|
116
|
+
url(vpu.url ?: unit.url)
|
|
118
117
|
currency(currency)
|
|
119
118
|
price(price = vpu.price?.amount ?: unit.price.amount)
|
|
120
119
|
name((vpu.name ?: unit.name) ?: "")
|
|
@@ -129,47 +128,80 @@ class FWVideoShoppingModule(
|
|
|
129
128
|
}
|
|
130
129
|
|
|
131
130
|
@ReactMethod
|
|
132
|
-
override fun
|
|
133
|
-
FWLogUtils.d { "FWVideoShoppingModule
|
|
131
|
+
override fun setProductInfoViewConfiguration(config: ReadableMap?) {
|
|
132
|
+
FWLogUtils.d { "FWVideoShoppingModule setProductInfoViewConfiguration: $callbackId, config: $config" }
|
|
134
133
|
val configMap = config?.toHashMap() ?: hashMapOf()
|
|
135
134
|
val jsonObject = JSONObject(configMap)
|
|
136
135
|
val configModel = FWProductInfoViewConfigurationDeserializer.deserialize(jsonObject)
|
|
137
|
-
FWLogUtils.d { "FWVideoShoppingModule
|
|
136
|
+
FWLogUtils.d { "FWVideoShoppingModule setProductInfoViewConfiguration: $callbackId, configModel: $configModel" }
|
|
137
|
+
|
|
138
|
+
if (configModel == null) {
|
|
139
|
+
return
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
val isLinkButtonHidden = configModel.linkButton?.isHidden == true
|
|
143
|
+
var text = ShoppingCtaButtonOptions.Text.ADD_TO_CART
|
|
144
|
+
when (configModel.ctaButton?.text) {
|
|
145
|
+
FWProductInfoViewConfiguration.CtaButtonConfiguration.TextValue.ShopNow -> {
|
|
146
|
+
text = ShoppingCtaButtonOptions.Text.SHOP_NOW
|
|
147
|
+
}
|
|
148
|
+
else -> {}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
FireworkSdk.shopping.setShoppingViewOptions(
|
|
152
|
+
ShoppingViewOptions(
|
|
153
|
+
ProductDetailsOptions(
|
|
154
|
+
linkButtonOptions = LinkButtonOptions(isVisible = !isLinkButtonHidden),
|
|
155
|
+
shoppingCtaButtonOptions = ShoppingCtaButtonOptions(text = text),
|
|
156
|
+
),
|
|
157
|
+
),
|
|
158
|
+
)
|
|
138
159
|
}
|
|
139
160
|
|
|
140
161
|
@ReactMethod
|
|
141
|
-
override fun
|
|
142
|
-
FWLogUtils.d { "FWVideoShoppingModule
|
|
143
|
-
|
|
162
|
+
override fun updateShoppingCTAResult(result: ReadableMap?, callbackId: Int?) {
|
|
163
|
+
FWLogUtils.d { "FWVideoShoppingModule updateShoppingCTAResult: $callbackId, result: $result, ctaHandler: ${ctaHandler?.first}" }
|
|
164
|
+
val resultMap = result?.toHashMap() ?: hashMapOf()
|
|
165
|
+
val jsonObject = JSONObject(resultMap)
|
|
166
|
+
val resultModel = FWShoppingCtaResultDeserializer.deserialize(jsonObject)
|
|
167
|
+
FWLogUtils.d { "FWVideoShoppingModule updateShoppingCTAResult: $callbackId, resultModel: $resultModel" }
|
|
168
|
+
|
|
169
|
+
if (resultModel == null) {
|
|
170
|
+
return
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (callbackId == null || ctaHandler?.first != callbackId) {
|
|
144
174
|
return
|
|
145
175
|
}
|
|
146
176
|
|
|
147
|
-
val productId =
|
|
177
|
+
val productId = ctaHandler?.second
|
|
148
178
|
productId ?: return
|
|
149
179
|
|
|
150
|
-
val unitId =
|
|
180
|
+
val unitId = ctaHandler?.third
|
|
151
181
|
if (unitId.isNullOrBlank()) {
|
|
152
182
|
return
|
|
153
183
|
}
|
|
154
184
|
|
|
155
|
-
when {
|
|
156
|
-
|
|
157
|
-
val
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
185
|
+
when (resultModel.res) {
|
|
186
|
+
FWShoppingCtaResult.Res.Success -> {
|
|
187
|
+
val numberOfItemsInCart = FireworkSdk.shopping.numberOfItemsInCart
|
|
188
|
+
FireworkSdk.shopping.setCtaButtonStatus(Shopping.CtaButtonStatus.Success)
|
|
189
|
+
FireworkSdk.shopping.numberOfItemsInCart = numberOfItemsInCart
|
|
190
|
+
}
|
|
191
|
+
FWShoppingCtaResult.Res.Fail -> {
|
|
192
|
+
FireworkSdk.shopping.setCtaButtonStatus(Shopping.CtaButtonStatus.Error)
|
|
163
193
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
FireworkSdk.shopping.setAddToCartStatus(status)
|
|
167
|
-
Toast.makeText(currentActivity, tip, Toast.LENGTH_LONG).show()
|
|
194
|
+
FWShoppingCtaResult.Res.Loading -> {
|
|
195
|
+
FireworkSdk.shopping.setCtaButtonStatus(Shopping.CtaButtonStatus.Loading)
|
|
168
196
|
}
|
|
169
|
-
|
|
170
|
-
|
|
197
|
+
else -> {
|
|
198
|
+
// throw IllegalStateException("Not allowed: ${resultModel.res}")
|
|
171
199
|
}
|
|
172
200
|
}
|
|
201
|
+
|
|
202
|
+
if (!resultModel.tips.isNullOrBlank()) {
|
|
203
|
+
Toast.makeText(currentActivity, resultModel.tips, Toast.LENGTH_LONG).show()
|
|
204
|
+
}
|
|
173
205
|
}
|
|
174
206
|
|
|
175
207
|
@ReactMethod
|
|
@@ -196,33 +228,32 @@ class FWVideoShoppingModule(
|
|
|
196
228
|
}
|
|
197
229
|
|
|
198
230
|
private fun cartListener() {
|
|
199
|
-
FireworkSdk.shopping.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
231
|
+
FireworkSdk.shopping.setOnCartClickListener(object : Shopping.OnCartClickListener {
|
|
232
|
+
override fun onCartClick() {
|
|
233
|
+
FWLogUtils.d { "FWVideoShoppingModule cartClicked" }
|
|
234
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity
|
|
235
|
+
activity ?: return
|
|
236
|
+
val callbackId = generateCallbackId()
|
|
237
|
+
cartClickHandler = Pair(callbackId, activity)
|
|
238
|
+
FWEventUtils.sendCartIconClickEvent(reactApplicationContext, callbackId)
|
|
239
|
+
}
|
|
240
|
+
})
|
|
203
241
|
|
|
204
|
-
|
|
242
|
+
FireworkSdk.shopping.setOnCtaButtonClicked { productId, unitId, productWebUrl ->
|
|
243
|
+
FWLogUtils.d { "FWVideoShoppingModule updateCart, productId: $productId, unitId: $unitId" }
|
|
205
244
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
245
|
+
FireworkSdk.shopping.setCtaButtonStatus(Shopping.CtaButtonStatus.Loading)
|
|
246
|
+
|
|
247
|
+
val callbackId = generateCallbackId()
|
|
248
|
+
ctaHandler = Triple(callbackId, productId, unitId)
|
|
249
|
+
FWEventUtils.sendShoppingCtaButtonClickEvent(reactApplicationContext, productId, unitId, productWebUrl, callbackId)
|
|
250
|
+
}
|
|
210
251
|
|
|
211
|
-
override fun onCartClicked() {
|
|
212
|
-
FWLogUtils.d { "FWVideoShoppingModule cartClicked" }
|
|
213
|
-
val activity = FWInitializationProvider.INSTANCE.resumedActivity
|
|
214
|
-
activity ?: return
|
|
215
|
-
val callbackId = generateCallbackId()
|
|
216
|
-
cartClickHandler = Pair(callbackId, activity)
|
|
217
|
-
FWEventUtils.sendCartIconClickEvent(reactApplicationContext, callbackId)
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
)
|
|
221
252
|
FireworkSdk.shopping.setOnShoppingErrorListener(
|
|
222
253
|
object : Shopping.OnShoppingErrorListener {
|
|
223
254
|
override fun onShoppingError(error: ShoppingError) {
|
|
224
255
|
when (error) {
|
|
225
|
-
is ShoppingError.
|
|
256
|
+
is ShoppingError.CtaButtonClickError.Timeout -> {
|
|
226
257
|
}
|
|
227
258
|
else -> {}
|
|
228
259
|
}
|
|
@@ -232,7 +263,7 @@ class FWVideoShoppingModule(
|
|
|
232
263
|
}
|
|
233
264
|
|
|
234
265
|
private fun productListener() {
|
|
235
|
-
FireworkSdk.shopping.
|
|
266
|
+
FireworkSdk.shopping.setOnProductHydrationListener(object : Shopping.OnProductHydrationListener {
|
|
236
267
|
override fun onProductHydration(products: List<Product>, hydrator: ProductHydrator) {
|
|
237
268
|
FWLogUtils.d { "FWVideoShoppingModule hydrateProducts, hydrator: ${hydrator.hashCode()}" }
|
|
238
269
|
if (products.isEmpty()) {
|
|
@@ -243,8 +274,10 @@ class FWVideoShoppingModule(
|
|
|
243
274
|
updateProductHydratorHandler[callbackId] = hydrator
|
|
244
275
|
FWEventUtils.sendUpdateProductsDetailsEvent(reactApplicationContext, products, callbackId)
|
|
245
276
|
}
|
|
277
|
+
})
|
|
246
278
|
|
|
247
|
-
|
|
279
|
+
FireworkSdk.shopping.setOnProductLinkClickListener(object : Shopping.OnProductLinkClickListener {
|
|
280
|
+
override fun onProductLinkClick(
|
|
248
281
|
productId: String,
|
|
249
282
|
unitId: String,
|
|
250
283
|
productWebUrl: String?
|