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/module/FireworkSDKModule.kt
CHANGED
|
@@ -11,11 +11,13 @@ import android.os.Process
|
|
|
11
11
|
import android.provider.Settings
|
|
12
12
|
import android.util.Base64
|
|
13
13
|
import com.facebook.react.bridge.*
|
|
14
|
+
import com.firework.analyticsevents.cta.CtaButtonClickAnalyticsEvent
|
|
15
|
+
import com.firework.analyticsevents.player.PlayerLifecycleAnalyticsEvent
|
|
16
|
+
import com.firework.analyticsevents.share.ShareButtonAnalyticsEvent
|
|
17
|
+
import com.firework.bus.FwAnalyticCallable
|
|
14
18
|
import com.firework.imageloading.glide.GlideImageLoaderFactory
|
|
15
19
|
import com.firework.livestream.multihost.MultihostLivestreamPlayerInitializer
|
|
16
20
|
import com.firework.livestream.singlehost.LivestreamPlayerInitializer
|
|
17
|
-
import com.firework.player.lifecycle.LifecycleState
|
|
18
|
-
import com.firework.player.lifecycle.PlaybackLifecycleObserver
|
|
19
21
|
import com.firework.sdk.FireworkSdk
|
|
20
22
|
import com.firework.sdk.FireworkSdkConfig
|
|
21
23
|
import com.fireworksdk.bridge.FWInitializationProvider
|
|
@@ -57,8 +59,8 @@ class FireworkSDKModule(
|
|
|
57
59
|
val sdkInitOptionsModel = FWSDKInitOptionsModelDeserializer.deserialize(jsonObject)
|
|
58
60
|
|
|
59
61
|
initSdk(sdkInitOptionsModel)
|
|
60
|
-
handleCustomCTAClick()
|
|
61
62
|
promise.resolve(Arguments.createMap())
|
|
63
|
+
FireworkSdk.analytics.register(this)
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
/**
|
|
@@ -97,6 +99,9 @@ class FireworkSDKModule(
|
|
|
97
99
|
*/
|
|
98
100
|
@ReactMethod
|
|
99
101
|
override fun setShareBaseURL(url: String?, promise: Promise) {
|
|
102
|
+
url?.let {
|
|
103
|
+
FWGlobalDataUtil.shareBaseUrl = it
|
|
104
|
+
}
|
|
100
105
|
promise.resolve(Arguments.createMap())
|
|
101
106
|
}
|
|
102
107
|
|
|
@@ -117,7 +122,6 @@ class FireworkSDKModule(
|
|
|
117
122
|
@ReactMethod
|
|
118
123
|
override fun setVideoPlaybackEventEnabled(value: Boolean?) {
|
|
119
124
|
FWGlobalDataUtil.videoPlaybackEventEnabled = value?:false
|
|
120
|
-
handleVideoPlaybackEvent()
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
private fun initSdk(sdkInitOptions: FWSDKInitOptionsModel?) {
|
|
@@ -145,7 +149,7 @@ class FireworkSDKModule(
|
|
|
145
149
|
// .shareBaseUrl("https://www.mytest.com")
|
|
146
150
|
// .muteOnLaunch(true)
|
|
147
151
|
shareBaseURL?.let {
|
|
148
|
-
|
|
152
|
+
FWGlobalDataUtil.shareBaseUrl = it
|
|
149
153
|
}
|
|
150
154
|
when (videoLaunchBehavior) {
|
|
151
155
|
FWVideoPlayerConstant.FW_PLAYER_LAUNCH_BEHAVIOR_DEFAULT -> {}
|
|
@@ -196,54 +200,132 @@ class FireworkSDKModule(
|
|
|
196
200
|
return Base64.encodeToString(hash, Base64.DEFAULT)
|
|
197
201
|
}
|
|
198
202
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
@FwAnalyticCallable
|
|
204
|
+
fun onCtaButtonClicked(event: CtaButtonClickAnalyticsEvent) {
|
|
205
|
+
FWEventUtils.sendLogMessageEvent(reactApplicationContext, "[Android] Receive CustomCTAClick event ${FWDateUtils.getDateString(
|
|
206
|
+
Date()
|
|
207
|
+
)}")
|
|
208
|
+
|
|
209
|
+
if (FWGlobalDataUtil.videoPlaybackEventEnabled) {
|
|
210
|
+
FWEventUtils.sendVideoPlaybackEvent(
|
|
211
|
+
reactApplicationContext,
|
|
212
|
+
FWVideoPlaybackSubEventName.ClickCTA.rawValue,
|
|
213
|
+
FWVideoPlaybackDetails(
|
|
214
|
+
badge = event.videoInfo.badge,
|
|
215
|
+
caption = event.videoInfo.caption,
|
|
216
|
+
duration = event.videoInfo.duration,
|
|
217
|
+
hasCta = true,
|
|
218
|
+
height = event.videoInfo.playerHeight,
|
|
219
|
+
width = event.videoInfo.playerWidth,
|
|
220
|
+
videoId = event.videoInfo.id,
|
|
221
|
+
)
|
|
222
|
+
)
|
|
223
|
+
}
|
|
205
224
|
|
|
206
|
-
|
|
225
|
+
FWEventUtils.sendCustomCTAClickEvent(reactApplicationContext, event.actionUrl)
|
|
207
226
|
|
|
208
|
-
|
|
209
|
-
|
|
227
|
+
if (!FWGlobalDataUtil.appComponentName.isNullOrBlank() && !FWGlobalDataUtil.customCTALinkContentPageRouteName.isNullOrBlank()) {
|
|
228
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity
|
|
210
229
|
|
|
211
|
-
|
|
212
|
-
|
|
230
|
+
activity?.startActivity(
|
|
231
|
+
FWContainerActivity.createIntent(activity, FWGlobalDataUtil.appComponentName,
|
|
213
232
|
hashMapOf(
|
|
214
|
-
"initialRouteName" to customCTALinkContentPageRouteName,
|
|
215
|
-
"initialParams" to hashMapOf("url" to actionUrl)
|
|
233
|
+
"initialRouteName" to FWGlobalDataUtil.customCTALinkContentPageRouteName,
|
|
234
|
+
"initialParams" to hashMapOf("url" to event.actionUrl)
|
|
216
235
|
)
|
|
217
236
|
))
|
|
218
|
-
|
|
219
|
-
|
|
237
|
+
}
|
|
238
|
+
}
|
|
220
239
|
|
|
221
|
-
|
|
240
|
+
@FwAnalyticCallable
|
|
241
|
+
fun onShareButtonClicked(event: ShareButtonAnalyticsEvent) {
|
|
242
|
+
if (FWGlobalDataUtil.videoPlaybackEventEnabled) {
|
|
243
|
+
FWEventUtils.sendVideoPlaybackEvent(
|
|
244
|
+
reactApplicationContext,
|
|
245
|
+
FWVideoPlaybackSubEventName.ClickShare.rawValue,
|
|
246
|
+
FWVideoPlaybackDetails(
|
|
247
|
+
badge = event.videoInfo.badge,
|
|
248
|
+
caption = event.videoInfo.caption,
|
|
249
|
+
duration = event.videoInfo.duration,
|
|
250
|
+
hasCta = event.videoInfo.hasCta,
|
|
251
|
+
height = event.videoInfo.playerHeight,
|
|
252
|
+
width = event.videoInfo.playerWidth,
|
|
253
|
+
videoId = event.videoInfo.id,
|
|
254
|
+
)
|
|
255
|
+
)
|
|
222
256
|
}
|
|
223
257
|
}
|
|
224
258
|
|
|
225
|
-
|
|
259
|
+
@FwAnalyticCallable
|
|
260
|
+
fun onPlaybackEvent(event: PlayerLifecycleAnalyticsEvent) {
|
|
226
261
|
if (!FWGlobalDataUtil.videoPlaybackEventEnabled) {
|
|
227
262
|
return
|
|
228
263
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
264
|
+
val progress = event.progress
|
|
265
|
+
|
|
266
|
+
val videoPlaybackDetails = FWVideoPlaybackDetails(
|
|
267
|
+
badge = event.videoInfo.badge,
|
|
268
|
+
caption = event.videoInfo.caption,
|
|
269
|
+
duration = event.videoInfo.duration,
|
|
270
|
+
hasCta = event.videoInfo.hasCta,
|
|
271
|
+
height = event.videoInfo.playerHeight,
|
|
272
|
+
width = event.videoInfo.playerWidth,
|
|
273
|
+
videoId = event.videoInfo.id,
|
|
274
|
+
progress = progress
|
|
275
|
+
)
|
|
276
|
+
when (event) {
|
|
277
|
+
is PlayerLifecycleAnalyticsEvent.OnStarted -> {
|
|
278
|
+
if (event.videoInfo.isAd) {
|
|
279
|
+
FWEventUtils.sendVideoPlaybackEvent(reactApplicationContext, FWVideoPlaybackSubEventName.AdStart.rawValue, videoPlaybackDetails)
|
|
280
|
+
} else {
|
|
281
|
+
FWEventUtils.sendVideoPlaybackEvent(reactApplicationContext, FWVideoPlaybackSubEventName.Start.rawValue, videoPlaybackDetails)
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
is PlayerLifecycleAnalyticsEvent.OnPrepared -> {
|
|
285
|
+
FWEventUtils.sendVideoPlaybackEvent(reactApplicationContext, FWVideoPlaybackSubEventName.Impression.rawValue, videoPlaybackDetails)
|
|
234
286
|
}
|
|
235
|
-
|
|
287
|
+
is PlayerLifecycleAnalyticsEvent.OnBuffering -> {}
|
|
288
|
+
is PlayerLifecycleAnalyticsEvent.OnIdle -> {}
|
|
289
|
+
is PlayerLifecycleAnalyticsEvent.OnRepeat -> {}
|
|
290
|
+
is PlayerLifecycleAnalyticsEvent.OnEnded -> {
|
|
291
|
+
if (event.videoInfo.isAd) {
|
|
292
|
+
FWEventUtils.sendVideoPlaybackEvent(reactApplicationContext, FWVideoPlaybackSubEventName.AdEnd.rawValue, videoPlaybackDetails)
|
|
293
|
+
} else {
|
|
294
|
+
FWEventUtils.sendVideoPlaybackEvent(reactApplicationContext, FWVideoPlaybackSubEventName.Complete.rawValue, videoPlaybackDetails)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
is PlayerLifecycleAnalyticsEvent.OnError -> {}
|
|
298
|
+
is PlayerLifecycleAnalyticsEvent.OnSeek -> {}
|
|
299
|
+
is PlayerLifecycleAnalyticsEvent.OnVideoSizeChanged -> {}
|
|
300
|
+
is PlayerLifecycleAnalyticsEvent.OnFirstQuartile -> {
|
|
301
|
+
FWEventUtils.sendVideoPlaybackEvent(reactApplicationContext, FWVideoPlaybackSubEventName.FirstQuartile.rawValue, videoPlaybackDetails)
|
|
302
|
+
}
|
|
303
|
+
is PlayerLifecycleAnalyticsEvent.OnSecondQuartile -> {
|
|
304
|
+
FWEventUtils.sendVideoPlaybackEvent(reactApplicationContext, FWVideoPlaybackSubEventName.Midpoint.rawValue, videoPlaybackDetails)
|
|
305
|
+
}
|
|
306
|
+
is PlayerLifecycleAnalyticsEvent.OnThirdQuartile -> {
|
|
307
|
+
FWEventUtils.sendVideoPlaybackEvent(reactApplicationContext, FWVideoPlaybackSubEventName.ThirdQuartile.rawValue, videoPlaybackDetails)
|
|
308
|
+
}
|
|
309
|
+
is PlayerLifecycleAnalyticsEvent.OnPlaybackProgressChanged -> {}
|
|
310
|
+
is PlayerLifecycleAnalyticsEvent.OnPaused -> {
|
|
311
|
+
FWEventUtils.sendVideoPlaybackEvent(reactApplicationContext, FWVideoPlaybackSubEventName.Pause.rawValue, videoPlaybackDetails)
|
|
312
|
+
}
|
|
313
|
+
is PlayerLifecycleAnalyticsEvent.OnResumed -> {
|
|
314
|
+
FWEventUtils.sendVideoPlaybackEvent(reactApplicationContext, FWVideoPlaybackSubEventName.Resume.rawValue, videoPlaybackDetails)
|
|
315
|
+
}
|
|
316
|
+
else -> {}
|
|
317
|
+
}
|
|
236
318
|
}
|
|
237
319
|
|
|
238
320
|
@ReactMethod
|
|
239
321
|
override fun setCustomCTALinkContentPageRouteName(name: String?, promise: Promise) {
|
|
240
|
-
customCTALinkContentPageRouteName = name
|
|
322
|
+
FWGlobalDataUtil.customCTALinkContentPageRouteName = name
|
|
241
323
|
promise.resolve(Arguments.createMap())
|
|
242
324
|
}
|
|
243
325
|
|
|
244
326
|
@ReactMethod
|
|
245
327
|
override fun setAppComponentName(name: String?, promise: Promise) {
|
|
246
|
-
appComponentName = name
|
|
328
|
+
FWGlobalDataUtil.appComponentName = name
|
|
247
329
|
promise.resolve(Arguments.createMap())
|
|
248
330
|
}
|
|
249
331
|
|
|
@@ -313,10 +395,4 @@ class FireworkSDKModule(
|
|
|
313
395
|
return "FireworkSDK"
|
|
314
396
|
}
|
|
315
397
|
|
|
316
|
-
companion object {
|
|
317
|
-
var appComponentName: String? = null
|
|
318
|
-
var customCTALinkContentPageRouteName: String? = null
|
|
319
|
-
var initSuccess: Boolean = false
|
|
320
|
-
}
|
|
321
|
-
|
|
322
398
|
}
|
|
@@ -7,9 +7,9 @@ import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
|
7
7
|
import com.firework.common.product.Product
|
|
8
8
|
import com.fireworksdk.bridge.models.*
|
|
9
9
|
import com.fireworksdk.bridge.FWInitializationProvider
|
|
10
|
-
import com.fireworksdk.bridge.reactnative.module.FireworkSDKModule
|
|
11
10
|
import com.fireworksdk.bridge.reactnative.pages.FWContainerActivity
|
|
12
11
|
import com.fireworksdk.bridge.utils.FWDateUtils
|
|
12
|
+
import com.fireworksdk.bridge.utils.FWGlobalDataUtil
|
|
13
13
|
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
14
14
|
import java.util.*
|
|
15
15
|
|
|
@@ -19,7 +19,7 @@ object FWEventUtils {
|
|
|
19
19
|
FWLogUtils.d { "FWNavigatorModule pushNativeContainer: $props" }
|
|
20
20
|
val activity = FWInitializationProvider.INSTANCE.resumedActivity
|
|
21
21
|
|
|
22
|
-
if (activity == null ||
|
|
22
|
+
if (activity == null || FWGlobalDataUtil.appComponentName.isNullOrBlank()) {
|
|
23
23
|
promise?.resolve(false)
|
|
24
24
|
return
|
|
25
25
|
}
|
|
@@ -36,7 +36,7 @@ object FWEventUtils {
|
|
|
36
36
|
Date()
|
|
37
37
|
)}")
|
|
38
38
|
|
|
39
|
-
activity.startActivity(FWContainerActivity.createIntent(activity,
|
|
39
|
+
activity.startActivity(FWContainerActivity.createIntent(activity, FWGlobalDataUtil.appComponentName, props?.toHashMap()))
|
|
40
40
|
|
|
41
41
|
sendLogMessageEvent(reactContext, "[Android] After Starting container activity ${
|
|
42
42
|
FWDateUtils.getDateString(
|
|
@@ -109,7 +109,7 @@ object FWEventUtils {
|
|
|
109
109
|
contentMap.putString("videoId", info?.videoId)
|
|
110
110
|
}
|
|
111
111
|
if (info?.duration != null) {
|
|
112
|
-
contentMap.putDouble("duration", info.duration
|
|
112
|
+
contentMap.putDouble("duration", info.duration)
|
|
113
113
|
}
|
|
114
114
|
if (info?.caption.isNullOrBlank()) {
|
|
115
115
|
contentMap.putString("caption", info?.caption)
|
|
@@ -130,17 +130,21 @@ object FWEventUtils {
|
|
|
130
130
|
if (info?.hasCta != null) {
|
|
131
131
|
contentMap.putBoolean("hasCTA", info.hasCta)
|
|
132
132
|
}
|
|
133
|
+
if (info?.progress != null) {
|
|
134
|
+
contentMap.putDouble("progress", info.progress)
|
|
135
|
+
}
|
|
133
136
|
eventMap.putMap("info", contentMap)
|
|
134
137
|
|
|
135
138
|
sendEvent(reactContext, FWEventName.VideoPlayback.rawValue, eventMap)
|
|
136
139
|
}
|
|
137
140
|
|
|
138
|
-
fun
|
|
141
|
+
fun sendShoppingCtaButtonClickEvent(reactContext: ReactContext, productId: String?, unitId: String?, url: String?, callbackId: Int?) {
|
|
139
142
|
val eventMap = Arguments.createMap()
|
|
140
143
|
eventMap.putString("productId", productId)
|
|
141
144
|
eventMap.putString("unitId", unitId)
|
|
145
|
+
eventMap.putString("url", url)
|
|
142
146
|
eventMap.putInt("callbackId", callbackId?:0)
|
|
143
|
-
sendEvent(reactContext, FWVideoShoppingEventName.
|
|
147
|
+
sendEvent(reactContext, FWVideoShoppingEventName.CtaButtonClick.rawValue, eventMap)
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
fun sendCartIconClickEvent(reactContext: ReactContext, callbackId: Int?) {
|
|
@@ -205,6 +209,12 @@ object FWEventUtils {
|
|
|
205
209
|
receiveEvent(reactContext, targetTag, FWStoryBlockEventName.StoryBlockLoadFinished.rawValue, eventMap)
|
|
206
210
|
}
|
|
207
211
|
|
|
212
|
+
fun receiveStoryBlockFullScreenStateChangedEvent(reactContext: ReactContext, targetTag: Int, isFullScreen: Boolean) {
|
|
213
|
+
val eventMap = Arguments.createMap()
|
|
214
|
+
eventMap.putBoolean("isFullScreen", isFullScreen)
|
|
215
|
+
receiveEvent(reactContext, targetTag, FWStoryBlockEventName.StoryBlockFullScreenStateChanged.rawValue, eventMap)
|
|
216
|
+
}
|
|
217
|
+
|
|
208
218
|
private fun receiveEvent(reactContext: ReactContext, targetTag: Int, eventName: String, event: WritableMap?) {
|
|
209
219
|
reactContext.getJSModule(RCTEventEmitter::class.java).receiveEvent(
|
|
210
220
|
targetTag,
|
|
@@ -14,6 +14,7 @@ import com.firework.viewoptions.*
|
|
|
14
14
|
import com.fireworksdk.bridge.FWInitializationProvider
|
|
15
15
|
import com.fireworksdk.bridge.constants.FWVideoPlayerConstant
|
|
16
16
|
import com.fireworksdk.bridge.models.*
|
|
17
|
+
import com.fireworksdk.bridge.reactnative.module.FireworkSDKModule
|
|
17
18
|
|
|
18
19
|
object FWConfigUtil {
|
|
19
20
|
|
|
@@ -50,6 +51,15 @@ object FWConfigUtil {
|
|
|
50
51
|
}
|
|
51
52
|
FWVideoFeedSource.PlaylistGroup.rawValue -> {
|
|
52
53
|
|
|
54
|
+
}
|
|
55
|
+
FWVideoFeedSource.HashtagPlaylist.rawValue -> {
|
|
56
|
+
videoFeedPropsModel.channel?.let { channel ->
|
|
57
|
+
if (!videoFeedPropsModel.hashtagFilterExpression.isNullOrBlank()) {
|
|
58
|
+
baseOptionBuilder.feedResource(FeedResource.ChannelHashtag(channel, videoFeedPropsModel.hashtagFilterExpression))
|
|
59
|
+
} else {
|
|
60
|
+
baseOptionBuilder.feedResource(FeedResource.Channel(channel))
|
|
61
|
+
}
|
|
62
|
+
}
|
|
53
63
|
}
|
|
54
64
|
else -> {}
|
|
55
65
|
}
|
|
@@ -174,6 +184,21 @@ object FWConfigUtil {
|
|
|
174
184
|
playerOptionBuilder.autoplay(it)
|
|
175
185
|
}
|
|
176
186
|
|
|
187
|
+
FWGlobalDataUtil.shareBaseUrl?.let {
|
|
188
|
+
playerOptionBuilder.shareBaseUrl(it)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
val shareBaseUrl = videoFeedPropsModel.videoPlayerConfiguration?.shareBaseUrl
|
|
192
|
+
shareBaseUrl?.let {
|
|
193
|
+
playerOptionBuilder.shareBaseUrl(it)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (!FWGlobalDataUtil.appComponentName.isNullOrBlank() && !FWGlobalDataUtil.customCTALinkContentPageRouteName.isNullOrBlank()) {
|
|
197
|
+
playerOptionBuilder.sdkHandleCtaButtonClick(false)
|
|
198
|
+
} else {
|
|
199
|
+
playerOptionBuilder.sdkHandleCtaButtonClick(!FWGlobalDataUtil.customCTAClickEnabled)
|
|
200
|
+
}
|
|
201
|
+
|
|
177
202
|
val gridColumns = videoFeedPropsModel.videoFeedConfiguration?.gridColumns
|
|
178
203
|
if (gridColumns != null && gridColumns > 0) {
|
|
179
204
|
layoutOptionBuilder.columnCount(gridColumns)
|
|
@@ -281,59 +306,28 @@ object FWConfigUtil {
|
|
|
281
306
|
private fun getDefaultLayoutOptionBuilder(): LayoutOption.Builder {
|
|
282
307
|
val context = FWInitializationProvider.INSTANCE.resumedActivity ?: return LayoutOption.Builder()
|
|
283
308
|
return LayoutOption.Builder()
|
|
284
|
-
.
|
|
285
|
-
.columnCount(2)
|
|
286
|
-
.backgroundColor(Color.WHITE)
|
|
287
|
-
// .itemSpacing()
|
|
288
|
-
.roundedCorner(false)
|
|
289
|
-
// .roundedCornerRadius(FWCommonUtil.dpToPx("20".toFloat(), context))
|
|
290
|
-
.showPlayIcon(true)
|
|
291
|
-
.playIconWidth(FWCommonUtil.dpToPx("24".toFloat(), context))
|
|
292
|
-
.feedTitlePosition(FeedTitlePosition.NESTED)
|
|
309
|
+
.playIconWidth(FWCommonUtil.dpToPx("36".toFloat(), context))
|
|
293
310
|
}
|
|
294
311
|
|
|
295
312
|
private fun getDefaultTitleOptionBuilder(): TitleOption.Builder {
|
|
296
313
|
return TitleOption.Builder()
|
|
297
|
-
.showFeedTitle(true)
|
|
298
|
-
// .feedTitleTextTypeface(titleTypeface.toTypeface())
|
|
299
|
-
// .feedTitleTextColor(ContextCompat.getColor(context, R.color.white))
|
|
300
|
-
// .feedTitleBackgroundColor(titleBackColor.toBackgroundColor())
|
|
301
|
-
// .feedTitleTextNumberOfLines(titleMaxLines.toInt())
|
|
302
|
-
// .feedTitleTextPadding(titlePadding.dpToPixel())
|
|
303
|
-
// .feedTitleTextSize(titleTextSize.spToPixel())
|
|
304
314
|
}
|
|
305
315
|
|
|
306
316
|
private fun getDefaultPlayerOptionBuilder(): PlayerOption.Builder {
|
|
307
317
|
return PlayerOption.Builder()
|
|
308
|
-
.playerMode(PlayerMode.FULL_BLEED_MODE)
|
|
309
|
-
.autoPlayOnComplete(true)
|
|
310
|
-
.showShareButton(true)
|
|
311
|
-
.showFireworkLogo(true)
|
|
312
|
-
.showMuteButton(true)
|
|
313
|
-
.showPlayPauseButton(true)
|
|
314
|
-
.autoplay(false)
|
|
315
|
-
.enablePipMode(false)
|
|
316
318
|
}
|
|
317
319
|
|
|
318
320
|
private fun getDefaultBaseOptionBuilder(): BaseOption.Builder {
|
|
319
321
|
return BaseOption.Builder()
|
|
320
|
-
.feedResource(FeedResource.Discovery)
|
|
321
322
|
}
|
|
322
323
|
|
|
323
324
|
private fun getDefaultAdBadgeOptionBuilder(): AdBadgeOption.Builder {
|
|
324
325
|
|
|
325
326
|
return AdBadgeOption.Builder()
|
|
326
|
-
// .adBadgeBackColor(Color.parseColor("#FF6200EE"))
|
|
327
|
-
.adBadgeTextColor(Color.parseColor("#FFFFFFFF"))
|
|
328
|
-
.adBadgeLabel(AdBadgeTextType.SPONSORED)
|
|
329
|
-
.adBadgeIsHidden(false)
|
|
330
|
-
.adBadgeShowOnThumbnails(false)
|
|
331
|
-
.adBadgeTypeface(Typeface.DEFAULT)
|
|
332
327
|
}
|
|
333
328
|
|
|
334
329
|
private fun getDefaultCtaOptionBuilder(): CtaOption.Builder {
|
|
335
330
|
return CtaOption.Builder()
|
|
336
|
-
.ctaDelay(CtaDelay(3.0f, CtaDelayUnit.SECONDS))
|
|
337
331
|
}
|
|
338
332
|
|
|
339
333
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
package com.fireworksdk.bridge.utils
|
|
2
2
|
|
|
3
|
+
import com.fireworksdk.bridge.components.videofeed.StoryBlockFragment
|
|
3
4
|
import com.fireworksdk.bridge.models.FWAdBadgeConfigModel
|
|
5
|
+
import com.fireworksdk.bridge.models.weakProperty
|
|
4
6
|
|
|
5
7
|
object FWGlobalDataUtil {
|
|
6
8
|
|
|
@@ -11,4 +13,12 @@ object FWGlobalDataUtil {
|
|
|
11
13
|
var videoPlaybackEventEnabled: Boolean = false
|
|
12
14
|
|
|
13
15
|
var customClickLinkButtonEnabled: Boolean = false
|
|
16
|
+
|
|
17
|
+
var storyBlockFragment by weakProperty<StoryBlockFragment?>()
|
|
18
|
+
|
|
19
|
+
var shareBaseUrl: String? = null
|
|
20
|
+
|
|
21
|
+
var appComponentName: String? = null
|
|
22
|
+
|
|
23
|
+
var customCTALinkContentPageRouteName: String? = null
|
|
14
24
|
}
|
|
@@ -10,40 +10,66 @@ object FWLanguageUtil {
|
|
|
10
10
|
private const val LOCALE_SP = "fw_locale_sp"
|
|
11
11
|
private const val LOCALE_KEY = "fw_locale_key"
|
|
12
12
|
|
|
13
|
-
private
|
|
13
|
+
private var systemLocale: Locale? = null
|
|
14
|
+
|
|
15
|
+
private fun readLocaleFromSp(context: Context) {
|
|
14
16
|
locale = context.getSharedPreferences(LOCALE_SP, Context.MODE_PRIVATE)
|
|
15
17
|
.getString(LOCALE_KEY, null)
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
fun changeLanguage(context: Context, l: String?): Boolean {
|
|
19
|
-
|
|
21
|
+
readLocaleFromSp(context)
|
|
22
|
+
val sharedPreferences =
|
|
23
|
+
context.getSharedPreferences(LOCALE_SP, Context.MODE_PRIVATE)
|
|
24
|
+
if (l.isNullOrBlank()) {
|
|
25
|
+
if (locale.isNullOrBlank()) {
|
|
26
|
+
return true
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
locale = null
|
|
30
|
+
sharedPreferences.edit().apply {
|
|
31
|
+
remove(LOCALE_KEY)
|
|
32
|
+
}.commit()
|
|
33
|
+
|
|
34
|
+
// change sdk locale to system locale
|
|
35
|
+
// val sysLocale = getSystemLocale()
|
|
36
|
+
// if (sysLocale.country.isNullOrBlank()) {
|
|
37
|
+
// FwSDK.changeAppLocale(context, sysLocale.language)
|
|
38
|
+
// } else {
|
|
39
|
+
// FwSDK.changeAppLocale(context, "${sysLocale.language}-${sysLocale.country}")
|
|
40
|
+
// }
|
|
41
|
+
|
|
42
|
+
restartActivity(context)
|
|
43
|
+
return true
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!isValidLocale(l)) {
|
|
20
47
|
return false
|
|
21
48
|
}
|
|
22
49
|
|
|
23
|
-
if (
|
|
50
|
+
if (locale == l) {
|
|
24
51
|
return true
|
|
25
52
|
}
|
|
26
53
|
|
|
27
54
|
locale = l
|
|
28
55
|
|
|
29
56
|
// save to sp
|
|
30
|
-
val sharedPreferences =
|
|
31
|
-
context.getSharedPreferences(LOCALE_SP, Context.MODE_PRIVATE)
|
|
32
57
|
sharedPreferences.edit().apply {
|
|
33
58
|
putString(LOCALE_KEY, l)
|
|
34
59
|
}.apply()
|
|
35
60
|
|
|
36
|
-
|
|
37
|
-
context.recreate()
|
|
38
|
-
}
|
|
61
|
+
restartActivity(context)
|
|
39
62
|
|
|
40
63
|
return true
|
|
41
64
|
}
|
|
42
65
|
|
|
43
|
-
fun updateBaseContextLocale(context: Context
|
|
44
|
-
|
|
66
|
+
fun updateBaseContextLocale(context: Context): Context {
|
|
67
|
+
if (systemLocale == null) {
|
|
68
|
+
systemLocale = Locale.getDefault()
|
|
69
|
+
}
|
|
70
|
+
|
|
45
71
|
if (locale.isNullOrBlank()) {
|
|
46
|
-
|
|
72
|
+
readLocaleFromSp(context)
|
|
47
73
|
}
|
|
48
74
|
locale?.let {
|
|
49
75
|
val locale = getLocale(it)
|
|
@@ -51,7 +77,10 @@ object FWLanguageUtil {
|
|
|
51
77
|
|
|
52
78
|
return updateResourcesLocale(context, locale)
|
|
53
79
|
}
|
|
54
|
-
|
|
80
|
+
|
|
81
|
+
val l = getSystemLocale()
|
|
82
|
+
Locale.setDefault(l)
|
|
83
|
+
return updateResourcesLocale(context, l)
|
|
55
84
|
}
|
|
56
85
|
|
|
57
86
|
private fun updateResourcesLocale(context: Context, locale: Locale): Context {
|
|
@@ -78,11 +107,14 @@ object FWLanguageUtil {
|
|
|
78
107
|
return Locale(locale)
|
|
79
108
|
}
|
|
80
109
|
|
|
81
|
-
private fun
|
|
82
|
-
if (
|
|
83
|
-
|
|
110
|
+
private fun restartActivity(context: Context) {
|
|
111
|
+
if (context is Activity) {
|
|
112
|
+
context.recreate()
|
|
84
113
|
}
|
|
85
|
-
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
private fun getSystemLocale(): Locale {
|
|
117
|
+
return systemLocale ?: Locale.getDefault()
|
|
86
118
|
}
|
|
87
119
|
|
|
88
120
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
4
|
+
android:layout_width="match_parent"
|
|
5
|
+
android:layout_height="match_parent"
|
|
6
|
+
android:layout_gravity="center"
|
|
7
|
+
android:layout_marginVertical="16dp">
|
|
8
|
+
|
|
9
|
+
<FrameLayout
|
|
10
|
+
android:id="@+id/story_block_container"
|
|
11
|
+
android:layout_width="0dp"
|
|
12
|
+
android:layout_height="0dp"
|
|
13
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
|
14
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
15
|
+
app:layout_constraintStart_toStartOf="parent"
|
|
16
|
+
app:layout_constraintTop_toTopOf="parent">
|
|
17
|
+
|
|
18
|
+
<com.firework.storyblock.FwStoryBlockView
|
|
19
|
+
android:id="@+id/story_block"
|
|
20
|
+
android:layout_width="match_parent"
|
|
21
|
+
android:layout_height="match_parent" />
|
|
22
|
+
|
|
23
|
+
</FrameLayout>
|
|
24
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -10,7 +10,7 @@ import UIKit
|
|
|
10
10
|
|
|
11
11
|
@objc
|
|
12
12
|
public enum StoryBlockSourceType: Int {
|
|
13
|
-
case discover, channel, playlist, dynamicContent
|
|
13
|
+
case discover, channel, playlist, dynamicContent, hashtagPlaylist
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
public protocol StoryBlockViewDelegate: AnyObject {
|
|
@@ -24,7 +24,9 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
|
|
|
24
24
|
@objc public var channel: String = ""
|
|
25
25
|
@objc public var playlist: String = ""
|
|
26
26
|
@objc public var dynamicContentParameters: [String: [String]] = [:]
|
|
27
|
+
@objc public var hashtagFilterExpression: String = ""
|
|
27
28
|
@objc public var enablePictureInPicture: Bool = false
|
|
29
|
+
@objc public var adConfiguration: AdConfiguration?
|
|
28
30
|
|
|
29
31
|
public weak var delegate: StoryBlockViewDelegate?
|
|
30
32
|
|
|
@@ -42,6 +44,8 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
|
|
|
42
44
|
return .channelPlaylist(channelID: channel, playlistID: playlist)
|
|
43
45
|
case .dynamicContent:
|
|
44
46
|
return .dynamicContent(channelID: channel, parameters: dynamicContentParameters)
|
|
47
|
+
case .hashtagPlaylist:
|
|
48
|
+
return .hashtagPlaylist(channelID: channel, filterExpression: hashtagFilterExpression)
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
|
|
@@ -68,7 +72,17 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
|
|
|
68
72
|
return
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
|
|
75
|
+
var resultStoryBlockVC: StoryBlockViewController?
|
|
76
|
+
if let fireworkVideoAdConfiguration = RCTConvert.getFireworkVideoAdConfiguration(adConfiguration) {
|
|
77
|
+
resultStoryBlockVC = StoryBlockViewController(source: source, adConfiguration: fireworkVideoAdConfiguration)
|
|
78
|
+
} else {
|
|
79
|
+
resultStoryBlockVC = StoryBlockViewController(source: source)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
guard let storyBlockVC = resultStoryBlockVC else {
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
|
|
72
86
|
if self.enablePictureInPicture {
|
|
73
87
|
storyBlockVC.isPictureInPictureEnabled = true
|
|
74
88
|
}
|
|
@@ -89,6 +103,22 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
|
|
|
89
103
|
self.storyBlockVC = nil
|
|
90
104
|
}
|
|
91
105
|
|
|
106
|
+
@objc
|
|
107
|
+
public func play() {
|
|
108
|
+
guard let storyBlockVC = self.storyBlockVC else {
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
storyBlockVC.play()
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@objc
|
|
115
|
+
public func pause() {
|
|
116
|
+
guard let storyBlockVC = self.storyBlockVC else {
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
storyBlockVC.pause()
|
|
120
|
+
}
|
|
121
|
+
|
|
92
122
|
public func storyBlockDidLoadFeed(_ viewController: StoryBlockViewController) {
|
|
93
123
|
guard let delegate = self.delegate else {
|
|
94
124
|
return
|
|
@@ -8,7 +8,13 @@
|
|
|
8
8
|
#import <React/RCTBridgeModule.h>
|
|
9
9
|
#import <React/RCTViewManager.h>
|
|
10
10
|
#import <React/RCTUIManager.h>
|
|
11
|
+
|
|
12
|
+
#if __has_include(<react_native_firework_sdk/react_native_firework_sdk-Swift.h>)
|
|
13
|
+
#import <react_native_firework_sdk/react_native_firework_sdk-Swift.h>
|
|
14
|
+
#else
|
|
11
15
|
#import "react_native_firework_sdk-Swift.h"
|
|
16
|
+
#endif
|
|
17
|
+
|
|
12
18
|
|
|
13
19
|
@interface RCT_EXTERN_REMAP_MODULE(FWStoryBlock, StoryBlockManager, NSObject)
|
|
14
20
|
|
|
@@ -21,10 +27,37 @@ RCT_CUSTOM_VIEW_PROPERTY(source, StoryBlockSource, StoryBlock) {
|
|
|
21
27
|
RCT_EXPORT_VIEW_PROPERTY(channel, NSString)
|
|
22
28
|
RCT_EXPORT_VIEW_PROPERTY(playlist, NSString)
|
|
23
29
|
RCT_EXPORT_VIEW_PROPERTY(dynamicContentParameters, NSDictionary)
|
|
30
|
+
RCT_EXPORT_VIEW_PROPERTY(hashtagFilterExpression, NSString)
|
|
24
31
|
RCT_EXPORT_VIEW_PROPERTY(enablePictureInPicture, BOOL)
|
|
25
32
|
|
|
33
|
+
RCT_CUSTOM_VIEW_PROPERTY(adConfiguration, AdConfiguration, StoryBlock) {
|
|
34
|
+
AdConfiguration *config = [RCTConvert adConfiguration:json];
|
|
35
|
+
view.adConfiguration = config;
|
|
36
|
+
}
|
|
26
37
|
|
|
27
38
|
RCT_EXPORT_VIEW_PROPERTY(onStoryBlockLoadFinished, RCTBubblingEventBlock)
|
|
28
39
|
|
|
40
|
+
RCT_EXPORT_METHOD(play:(nonnull NSNumber *)reactTag) {
|
|
41
|
+
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
42
|
+
StoryBlock *view = (StoryBlock *)(viewRegistry[reactTag]);
|
|
43
|
+
if (!view || ![view isKindOfClass:[StoryBlock class]]) {
|
|
44
|
+
RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
[view play];
|
|
48
|
+
}];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
RCT_EXPORT_METHOD(pause:(nonnull NSNumber *)reactTag) {
|
|
52
|
+
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
53
|
+
StoryBlock *view = (StoryBlock *)(viewRegistry[reactTag]);
|
|
54
|
+
if (!view || ![view isKindOfClass:[StoryBlock class]]) {
|
|
55
|
+
RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
[view pause];
|
|
59
|
+
}];
|
|
60
|
+
}
|
|
61
|
+
|
|
29
62
|
@end
|
|
30
63
|
|