react-native-firework-sdk 2.2.5 → 2.3.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 +5 -5
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -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 +2 -9
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -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 +2 -9
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +2 -9
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +9 -9
- package/android/build.gradle +9 -39
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/gradle.properties +7 -5
- package/android/proguard-rules.pro +5 -26
- package/android/src/main/AndroidManifest.xml +0 -3
- package/android/src/main/java/com/fireworksdk/bridge/FireworkSDKPackage.kt +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/base/FWBaseFragment.kt +10 -0
- package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +157 -0
- package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFrameLayout.kt +19 -0
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +15 -5
- package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModel.kt +6 -7
- package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModelDeserializer.kt +5 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModelSerializer.kt +22 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModel.kt +3 -5
- package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModelDeserializer.kt +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModelSerializer.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWGradientDrawableModel.kt +8 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWGradientDrawableModelDeserializer.kt +35 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWGradientDrawableModelSerializer.kt +27 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamEventDetailsModel.kt +1 -5
- package/android/src/main/java/com/fireworksdk/bridge/models/FWLiveStreamMessageDetailsModel.kt +1 -5
- package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfiguration.kt +5 -15
- package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationDeserializer.kt +2 -9
- package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationSerializer.kt +42 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModel.kt +3 -5
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelSerializer.kt +20 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWShoppingCtaResult.kt +3 -12
- package/android/src/main/java/com/fireworksdk/bridge/models/FWShoppingCtaResultDeserializer.kt +2 -13
- package/android/src/main/java/com/fireworksdk/bridge/models/FWShoppingCtaResultSerializer.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +8 -9
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModelDeserializer.kt +17 -6
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModelSerializer.kt +59 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -5
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +14 -15
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelDeserializer.kt +14 -4
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelSerializer.kt +56 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +11 -8
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +11 -12
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +11 -7
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +63 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoShoppingProduct.kt +4 -11
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoShoppingProductSerializer.kt +82 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWBadgeTextType.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWCtaButtonTextValue.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWCtaDelayType.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/{FWEventName.kt → enums/FWEventName.kt} +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWGradientDrawableOrientation.kt +24 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWPlayerLaunchBehavior.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWPlayerStyle.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWShoppingCtaResultRes.kt +19 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWSystemTypeface.kt +21 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoCompleteAction.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoFeedMode.kt +19 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoFeedSource.kt +22 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoFeedTitlePosition.kt +19 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoPlayerCTAWidth.kt +19 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +22 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +61 -32
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +3 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWNavigatorInterface.kt +0 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +0 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +0 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +2 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +0 -6
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +25 -32
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +24 -47
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +17 -44
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWBundleUtils.kt +46 -21
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +165 -86
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWFragmentUtil.kt +51 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +1 -5
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +77 -80
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWLiveStreamUtil.kt +17 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWSingletonHolder.kt +25 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWStatusBarUtil.kt +28 -0
- package/android/src/main/res/layout/fw_bridge_story_block.xml +5 -12
- package/ios/Components/VideoFeed.swift +39 -19
- package/ios/Components/VideoFeedConfiguration.swift +4 -5
- package/ios/Components/VideoFeedManager.swift +1 -1
- package/ios/Components/VideoPlayerConfiguration.swift +17 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +197 -205
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +23 -8
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +1 -18
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +4 -1
- package/ios/FireworkVideoUI/Podfile +1 -1
- package/ios/FireworkVideoUI/Podfile.lock +4 -4
- package/ios/Models/NativeToRN/FireworkEventName.swift +0 -1
- package/ios/Models/NativeToRN/FireworkSDK+Json.swift +1 -1
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +6 -157
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +1 -21
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -2
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +1 -12
- package/ios/Modules/LiveStream/LiveStreamModule.m +1 -1
- package/ios/Modules/LiveStream/LiveStreamModule.swift +4 -2
- package/ios/Modules/Shopping/FWCartViewController.swift +0 -75
- package/ios/Modules/Shopping/ShoppingModule.m +1 -3
- package/ios/Modules/Shopping/ShoppingModule.swift +12 -47
- package/ios/Utils/Extensions/Swizzle/UINavigationController+FWSwizzle.swift +1 -1
- package/lib/commonjs/FireworkSDK.js +31 -15
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/LiveStream.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +43 -30
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +55 -15
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +112 -24
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/GradientDrawable.js +2 -0
- package/lib/commonjs/models/GradientDrawable.js.map +1 -0
- package/lib/commonjs/models/StoryBlockConfiguration.js +6 -0
- package/lib/commonjs/models/StoryBlockConfiguration.js.map +1 -0
- package/lib/commonjs/models/VideoPlayerCTADelay.js +2 -0
- package/lib/commonjs/models/VideoPlayerCTADelay.js.map +1 -0
- package/lib/commonjs/models/VideoPlayerCTAStyle.js +6 -0
- package/lib/commonjs/models/VideoPlayerCTAStyle.js.map +1 -0
- package/lib/commonjs/models/VideoPlayerCTAWidth.js +2 -0
- package/lib/commonjs/models/VideoPlayerCTAWidth.js.map +1 -0
- package/lib/commonjs/models/VideoPlayerCompleteAction.js +2 -0
- package/lib/commonjs/models/VideoPlayerCompleteAction.js.map +1 -0
- package/lib/commonjs/models/VideoPlayerStyle.js +2 -0
- package/lib/commonjs/models/VideoPlayerStyle.js.map +1 -0
- package/lib/commonjs/modules/LiveStreamModule.js.map +1 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/commonjs/utils/FWGlobalState.js +47 -0
- package/lib/commonjs/utils/FWGlobalState.js.map +1 -0
- package/lib/module/FireworkSDK.js +30 -14
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/LiveStream.js.map +1 -1
- package/lib/module/VideoShopping.js +43 -29
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/StoryBlock.js +54 -15
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +113 -24
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/GradientDrawable.js +2 -0
- package/lib/module/models/GradientDrawable.js.map +1 -0
- package/lib/module/models/StoryBlockConfiguration.js +2 -0
- package/lib/module/models/StoryBlockConfiguration.js.map +1 -0
- package/lib/module/models/VideoPlayerCTADelay.js +2 -0
- package/lib/module/models/VideoPlayerCTADelay.js.map +1 -0
- package/lib/module/models/VideoPlayerCTAStyle.js +2 -0
- package/lib/module/models/VideoPlayerCTAStyle.js.map +1 -0
- package/lib/module/models/VideoPlayerCTAWidth.js +2 -0
- package/lib/module/models/VideoPlayerCTAWidth.js.map +1 -0
- package/lib/module/models/VideoPlayerCompleteAction.js +2 -0
- package/lib/module/models/VideoPlayerCompleteAction.js.map +1 -0
- package/lib/module/models/VideoPlayerStyle.js +2 -0
- package/lib/module/models/VideoPlayerStyle.js.map +1 -0
- package/lib/module/modules/LiveStreamModule.js.map +1 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/module/utils/FWGlobalState.js +39 -0
- package/lib/module/utils/FWGlobalState.js.map +1 -0
- package/lib/typescript/FireworkSDK.d.ts +7 -7
- package/lib/typescript/LiveStream.d.ts +2 -2
- package/lib/typescript/VideoShopping.d.ts +17 -18
- package/lib/typescript/components/StoryBlock.d.ts +2 -0
- package/lib/typescript/components/VideoFeed.d.ts +7 -3
- package/lib/typescript/index.d.ts +10 -3
- package/lib/typescript/models/AdBadgeConfiguration.d.ts +9 -2
- package/lib/typescript/models/FWEvents.d.ts +9 -9
- package/lib/typescript/models/GradientDrawable.d.ts +5 -0
- package/lib/typescript/models/IOSFontInfo.d.ts +2 -0
- package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +1 -1
- package/lib/typescript/models/StoryBlockConfiguration.d.ts +37 -0
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +25 -4
- package/lib/typescript/models/VideoPlaybackDetails.d.ts +1 -0
- package/lib/typescript/models/VideoPlayerCTADelay.d.ts +11 -0
- package/lib/typescript/models/VideoPlayerCTAStyle.d.ts +21 -0
- package/lib/typescript/models/VideoPlayerCTAWidth.d.ts +1 -0
- package/lib/typescript/models/VideoPlayerCompleteAction.d.ts +1 -0
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +9 -34
- package/lib/typescript/models/VideoPlayerStyle.d.ts +1 -0
- package/lib/typescript/modules/LiveStreamModule.d.ts +1 -1
- package/lib/typescript/modules/ShoppingModule.d.ts +2 -3
- package/lib/typescript/utils/FWGlobalState.d.ts +10 -0
- package/package.json +5 -3
- package/react-native-firework-sdk.podspec +2 -1
- package/src/FireworkSDK.ts +47 -19
- package/src/LiveStream.ts +4 -2
- package/src/VideoShopping.ts +47 -39
- package/src/components/StoryBlock.tsx +66 -9
- package/src/components/VideoFeed.tsx +147 -23
- package/src/index.ts +14 -6
- package/src/models/AdBadgeConfiguration.ts +10 -2
- package/src/models/FWEvents.ts +11 -11
- package/src/models/GradientDrawable.ts +14 -0
- package/src/models/IOSFontInfo.ts +2 -0
- package/src/models/ProductInfoViewConfiguration.ts +1 -1
- package/src/models/StoryBlockConfiguration.ts +38 -0
- package/src/models/VideoFeedConfiguration.ts +25 -4
- package/src/models/VideoPlaybackDetails.ts +1 -0
- package/src/models/VideoPlayerCTADelay.ts +11 -0
- package/src/models/VideoPlayerCTAStyle.ts +22 -0
- package/src/models/VideoPlayerCTAWidth.ts +1 -0
- package/src/models/VideoPlayerCompleteAction.ts +1 -0
- package/src/models/VideoPlayerConfiguration.ts +9 -36
- package/src/models/VideoPlayerStyle.ts +1 -0
- package/src/modules/LiveStreamModule.ts +1 -1
- package/src/modules/ShoppingModule.ts +2 -3
- package/src/utils/FWGlobalState.ts +31 -0
- package/android/publish.gradle +0 -66
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/StoryBlockFragment.kt +0 -129
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/StoryBlockFrameLayout.kt +0 -90
- package/android/src/main/java/com/fireworksdk/bridge/constants/FWVideoPlayerConstant.kt +0 -39
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSystemTypeface.kt +0 -9
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedModel.kt +0 -7
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedSource.kt +0 -10
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedTitlePosition.kt +0 -7
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWContainerActivity.kt +0 -53
- package/android/src/main/res/layout/fw_bridge_fragment_container.xml +0 -8
- package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +0 -33
- package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +0 -18
|
@@ -2,119 +2,116 @@ package com.fireworksdk.bridge.utils
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity
|
|
4
4
|
import android.content.Context
|
|
5
|
-
import
|
|
5
|
+
import androidx.fragment.app.FragmentActivity
|
|
6
|
+
import com.fireworksdk.bridge.components.base.FWBaseFragment
|
|
7
|
+
import java.util.Locale
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
class FWLanguageUtil private constructor(context: Context) {
|
|
8
10
|
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
private const val LOCALE_KEY = "fw_locale_key"
|
|
12
|
-
|
|
13
|
-
private var systemLocale: Locale? = null
|
|
14
|
-
|
|
15
|
-
private fun readLocaleFromSp(context: Context) {
|
|
16
|
-
locale = context.getSharedPreferences(LOCALE_SP, Context.MODE_PRIVATE)
|
|
17
|
-
.getString(LOCALE_KEY, null)
|
|
11
|
+
private val sharedPreferences by lazy {
|
|
12
|
+
context.getSharedPreferences(LOCALE_SP, Context.MODE_PRIVATE)
|
|
18
13
|
}
|
|
19
14
|
|
|
20
|
-
|
|
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
|
-
}
|
|
15
|
+
private val initAppLocale: Locale = Locale.getDefault()
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
sharedPreferences.edit().apply {
|
|
31
|
-
remove(LOCALE_KEY)
|
|
32
|
-
}.commit()
|
|
17
|
+
private var localeString: String? = null
|
|
33
18
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// FwSDK.changeAppLocale(context, sysLocale.language)
|
|
38
|
-
// } else {
|
|
39
|
-
// FwSDK.changeAppLocale(context, "${sysLocale.language}-${sysLocale.country}")
|
|
40
|
-
// }
|
|
19
|
+
init {
|
|
20
|
+
localeString = sharedPreferences.getString(LOCALE_KEY, null)
|
|
21
|
+
}
|
|
41
22
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
23
|
+
fun updateBaseContextLocale(baseContext: Context): Context {
|
|
24
|
+
val currentLocaleString = localeString
|
|
45
25
|
|
|
46
|
-
if (
|
|
47
|
-
|
|
26
|
+
if (currentLocaleString.isNullOrBlank()) {
|
|
27
|
+
Locale.setDefault(initAppLocale)
|
|
28
|
+
return updateResourcesLocale(baseContext, initAppLocale)
|
|
48
29
|
}
|
|
49
30
|
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
val localeStrings = currentLocaleString.split("-")
|
|
32
|
+
val locale = if (localeStrings.size > 1) {
|
|
33
|
+
Locale(localeStrings[0], localeStrings[1])
|
|
34
|
+
} else {
|
|
35
|
+
Locale(currentLocaleString)
|
|
52
36
|
}
|
|
37
|
+
Locale.setDefault(locale)
|
|
38
|
+
return updateResourcesLocale(baseContext, locale)
|
|
39
|
+
}
|
|
53
40
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
restartActivity(context)
|
|
62
|
-
|
|
63
|
-
return true
|
|
41
|
+
private fun updateResourcesLocale(context: Context, locale: Locale): Context {
|
|
42
|
+
val resources = context.resources
|
|
43
|
+
val configuration = resources.configuration
|
|
44
|
+
configuration.setLocale(locale)
|
|
45
|
+
configuration.setLayoutDirection(locale)
|
|
46
|
+
return context.createConfigurationContext(configuration)
|
|
64
47
|
}
|
|
65
48
|
|
|
66
|
-
fun
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
fun changeLanguage(inputLocaleString: String?, activity: Activity?): Boolean {
|
|
50
|
+
// no change
|
|
51
|
+
if ((inputLocaleString.isNullOrBlank() && localeString.isNullOrBlank())
|
|
52
|
+
|| localeString == inputLocaleString
|
|
53
|
+
) {
|
|
54
|
+
return true
|
|
69
55
|
}
|
|
70
56
|
|
|
71
|
-
if
|
|
72
|
-
|
|
57
|
+
// clear local if empty input locale
|
|
58
|
+
if (inputLocaleString.isNullOrBlank()) {
|
|
59
|
+
localeString = null
|
|
60
|
+
updateSpLanguage(inputLocaleString)
|
|
61
|
+
restartActivity(activity)
|
|
62
|
+
return true
|
|
73
63
|
}
|
|
74
|
-
locale?.let {
|
|
75
|
-
val locale = getLocale(it)
|
|
76
|
-
Locale.setDefault(locale)
|
|
77
64
|
|
|
78
|
-
|
|
65
|
+
// invalid input locale
|
|
66
|
+
if (!isValidLocale(inputLocaleString)) {
|
|
67
|
+
return false
|
|
79
68
|
}
|
|
80
69
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
// update locale
|
|
71
|
+
localeString = inputLocaleString
|
|
72
|
+
updateSpLanguage(inputLocaleString)
|
|
73
|
+
restartActivity(activity)
|
|
74
|
+
return true
|
|
84
75
|
}
|
|
85
76
|
|
|
86
|
-
private fun
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
private fun updateSpLanguage(l: String?) {
|
|
78
|
+
if (l.isNullOrBlank()) {
|
|
79
|
+
sharedPreferences.edit().apply {
|
|
80
|
+
remove(LOCALE_KEY)
|
|
81
|
+
}.apply()
|
|
82
|
+
} else {
|
|
83
|
+
sharedPreferences.edit().apply {
|
|
84
|
+
putString(LOCALE_KEY, l)
|
|
85
|
+
}.apply()
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private fun restartActivity(activity: Activity?) {
|
|
90
|
+
if (activity is FragmentActivity) {
|
|
91
|
+
val fragments = activity.supportFragmentManager.fragments
|
|
92
|
+
for (f in fragments) {
|
|
93
|
+
if (f is FWBaseFragment && f.removeWhenRecreateActivity()) {
|
|
94
|
+
FWFragmentUtil.removeFragment(activity, f)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
activity?.recreate()
|
|
92
99
|
}
|
|
93
100
|
|
|
94
101
|
private fun isValidLocale(locale: String?) : Boolean {
|
|
95
102
|
locale ?: return false
|
|
96
103
|
val list = Locale.getAvailableLocales()
|
|
97
|
-
return list.contains(getLocale(locale))
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
private fun getLocale(locale: String): Locale {
|
|
101
104
|
if (locale.contains("-")) {
|
|
102
105
|
val locales = locale.split("-")
|
|
103
106
|
if (locales.size > 1) {
|
|
104
|
-
return Locale(locales[0], locales[1])
|
|
107
|
+
return list.contains(Locale(locales[0], locales[1]))
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
|
-
return Locale(locale)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
private fun restartActivity(context: Context) {
|
|
111
|
-
if (context is Activity) {
|
|
112
|
-
context.recreate()
|
|
113
|
-
}
|
|
110
|
+
return list.contains(Locale(locale))
|
|
114
111
|
}
|
|
115
112
|
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
companion object : FWSingletonHolder<FWLanguageUtil, Context>(::FWLanguageUtil) {
|
|
114
|
+
private const val LOCALE_SP = "fw_locale_sp"
|
|
115
|
+
private const val LOCALE_KEY = "fw_locale_key"
|
|
118
116
|
}
|
|
119
|
-
|
|
120
117
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.utils
|
|
2
|
+
|
|
3
|
+
import com.firework.livestream.LivestreamPlayerInitializer
|
|
4
|
+
|
|
5
|
+
object FWLiveStreamUtil {
|
|
6
|
+
|
|
7
|
+
private val livestreamPlayerInitializerList: MutableList<LivestreamPlayerInitializer> = mutableListOf()
|
|
8
|
+
|
|
9
|
+
fun addLivestreamPlayerInitializer(initializer: LivestreamPlayerInitializer?) {
|
|
10
|
+
initializer ?: return
|
|
11
|
+
livestreamPlayerInitializerList.add(initializer)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
fun livestreamPlayerInitializers(): List<LivestreamPlayerInitializer> {
|
|
15
|
+
return livestreamPlayerInitializerList
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.utils
|
|
2
|
+
|
|
3
|
+
open class FWSingletonHolder<out T, in A>(creator: (A) -> T) {
|
|
4
|
+
private var creator: ((A) -> T)? = creator
|
|
5
|
+
@Volatile private var instance: T? = null
|
|
6
|
+
|
|
7
|
+
fun getInstance(arg: A): T {
|
|
8
|
+
val i = instance
|
|
9
|
+
if (i != null) {
|
|
10
|
+
return i
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return synchronized(this) {
|
|
14
|
+
val i2 = instance
|
|
15
|
+
if (i2 != null) {
|
|
16
|
+
i2
|
|
17
|
+
} else {
|
|
18
|
+
val created = creator!!(arg)
|
|
19
|
+
instance = created
|
|
20
|
+
creator = null
|
|
21
|
+
created
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.fireworksdk.bridge.utils
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.view.WindowManager
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
object FWStatusBarUtil {
|
|
8
|
+
|
|
9
|
+
private var windowAttrs: WindowManager.LayoutParams? = null
|
|
10
|
+
|
|
11
|
+
private fun saveFlags(activity: Activity) {
|
|
12
|
+
val attr = WindowManager.LayoutParams()
|
|
13
|
+
attr.copyFrom(activity.window.attributes)
|
|
14
|
+
windowAttrs = attr
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fun hideSystemNavigationUI(activity: Activity) {
|
|
18
|
+
saveFlags(activity)
|
|
19
|
+
@Suppress("DEPRECATION")
|
|
20
|
+
activity.window.addFlags(
|
|
21
|
+
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
fun restoreSystemNavigationUI(activity: Activity) {
|
|
26
|
+
activity.window.attributes = windowAttrs
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<
|
|
3
|
-
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
2
|
+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
4
3
|
android:layout_width="match_parent"
|
|
5
|
-
android:layout_height="match_parent"
|
|
6
|
-
android:layout_gravity="center"
|
|
7
|
-
android:layout_marginVertical="16dp">
|
|
4
|
+
android:layout_height="match_parent">
|
|
8
5
|
|
|
9
6
|
<FrameLayout
|
|
10
7
|
android:id="@+id/story_block_container"
|
|
11
|
-
android:layout_width="
|
|
12
|
-
android:layout_height="
|
|
13
|
-
app:layout_constraintBottom_toBottomOf="parent"
|
|
14
|
-
app:layout_constraintEnd_toEndOf="parent"
|
|
15
|
-
app:layout_constraintStart_toStartOf="parent"
|
|
16
|
-
app:layout_constraintTop_toTopOf="parent">
|
|
8
|
+
android:layout_width="match_parent"
|
|
9
|
+
android:layout_height="match_parent">
|
|
17
10
|
|
|
18
11
|
<com.firework.storyblock.FwStoryBlockView
|
|
19
12
|
android:id="@+id/story_block"
|
|
@@ -21,4 +14,4 @@
|
|
|
21
14
|
android:layout_height="match_parent" />
|
|
22
15
|
|
|
23
16
|
</FrameLayout>
|
|
24
|
-
</
|
|
17
|
+
</FrameLayout>
|
|
@@ -23,7 +23,7 @@ public enum VideFeedSourceType: Int {
|
|
|
23
23
|
case discover, channel, playlist, playlistGroup, dynamicContent, hashtagPlaylist
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
public protocol
|
|
26
|
+
public protocol VideoFeedDelegate: AnyObject {
|
|
27
27
|
/// Called once after a video feed has been successfully loaded
|
|
28
28
|
func videoFeedDidLoadFeed(_ view: VideoFeed)
|
|
29
29
|
/// Called if the video feed failed to load
|
|
@@ -64,7 +64,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
64
64
|
@objc var onVideoFeedLoadFinished: RCTBubblingEventBlock?
|
|
65
65
|
// @objc var onVideoFeedClick: RCTBubblingEventBlock?
|
|
66
66
|
|
|
67
|
-
public weak var delegate:
|
|
67
|
+
public weak var delegate: VideoFeedDelegate?
|
|
68
68
|
|
|
69
69
|
private var feedVC: VideoFeedViewController?
|
|
70
70
|
private var source: VideoFeedContentSource {
|
|
@@ -190,7 +190,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
190
190
|
feedVC.viewConfiguration = viewConfiguration
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
if self.enablePictureInPicture
|
|
193
|
+
if self.enablePictureInPicture {
|
|
194
194
|
feedVC.isPictureInPictureEnabled = true
|
|
195
195
|
}
|
|
196
196
|
|
|
@@ -237,7 +237,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
extension VideoFeed {
|
|
240
|
-
// swiftlint:disable:next cyclomatic_complexity
|
|
240
|
+
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
|
241
241
|
private static func convertToVideoFeedItemContentConfiguration(
|
|
242
242
|
_ config: VideoFeedConfiguration?
|
|
243
243
|
) -> VideoFeedItemContentConfiguration? {
|
|
@@ -260,19 +260,15 @@ extension VideoFeed {
|
|
|
260
260
|
if let textcolor = title.textColor {
|
|
261
261
|
vfcConfig.title.textColor = textcolor.uicolor()
|
|
262
262
|
}
|
|
263
|
+
if let numberOfLines = title.numberOfLines {
|
|
264
|
+
vfcConfig.title.numberOfLines = numberOfLines
|
|
265
|
+
}
|
|
263
266
|
if let fontSize = title.fontSize {
|
|
264
267
|
let iOSFontInfo = title.iOSFontInfo ?? FontInfo()
|
|
265
268
|
vfcConfig.title.font = iOSFontInfo.getFont(fontSize)
|
|
266
269
|
}
|
|
267
270
|
}
|
|
268
|
-
|
|
269
|
-
if let hidden = playIcon.hidden {
|
|
270
|
-
vfcConfig.playIcon.isHidden = hidden
|
|
271
|
-
}
|
|
272
|
-
if let iconWidth = playIcon.iconWidth {
|
|
273
|
-
vfcConfig.playIcon.iconWidth = iconWidth
|
|
274
|
-
}
|
|
275
|
-
}
|
|
271
|
+
|
|
276
272
|
if let position = config.titlePosition {
|
|
277
273
|
switch position {
|
|
278
274
|
case .stacked:
|
|
@@ -281,9 +277,31 @@ extension VideoFeed {
|
|
|
281
277
|
vfcConfig.titleLayoutConfiguration.titlePosition = .nested
|
|
282
278
|
}
|
|
283
279
|
}
|
|
284
|
-
|
|
285
|
-
|
|
280
|
+
|
|
281
|
+
if let titlePadding = config.titlePadding {
|
|
282
|
+
if let top = titlePadding.top {
|
|
283
|
+
vfcConfig.titleLayoutConfiguration.insets.top = top
|
|
284
|
+
}
|
|
285
|
+
if let right = titlePadding.right {
|
|
286
|
+
vfcConfig.titleLayoutConfiguration.insets.right = right
|
|
287
|
+
}
|
|
288
|
+
if let bottom = titlePadding.bottom {
|
|
289
|
+
vfcConfig.titleLayoutConfiguration.insets.bottom = bottom
|
|
290
|
+
}
|
|
291
|
+
if let left = titlePadding.left {
|
|
292
|
+
vfcConfig.titleLayoutConfiguration.insets.left = left
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if let playIcon = config.playIcon {
|
|
297
|
+
if let hidden = playIcon.hidden {
|
|
298
|
+
vfcConfig.playIcon.isHidden = hidden
|
|
299
|
+
}
|
|
300
|
+
if let iconWidth = playIcon.iconWidth {
|
|
301
|
+
vfcConfig.playIcon.iconWidth = iconWidth
|
|
302
|
+
}
|
|
286
303
|
}
|
|
304
|
+
|
|
287
305
|
if let showAdBadge = config.showAdBadge {
|
|
288
306
|
vfcConfig.sponsored.isHidden = !showAdBadge
|
|
289
307
|
}
|
|
@@ -377,14 +395,15 @@ extension VideoFeed {
|
|
|
377
395
|
}
|
|
378
396
|
}
|
|
379
397
|
|
|
398
|
+
if let ctaWidth = config.ctaWidth {
|
|
399
|
+
vpcConfig.ctaButton.width = ctaWidth.width()
|
|
400
|
+
}
|
|
401
|
+
|
|
380
402
|
return vpcConfig
|
|
381
403
|
}
|
|
382
404
|
|
|
383
405
|
private func convertToVideoFeedContentConfiguration() -> VideoFeedContentConfiguration {
|
|
384
406
|
var videoConfig = VideoFeedContentConfiguration()
|
|
385
|
-
// default value so that behavior will the same with Android
|
|
386
|
-
videoConfig.itemView.title.isHidden = false
|
|
387
|
-
videoConfig.itemView.titleLayoutConfiguration.titlePosition = .nested
|
|
388
407
|
|
|
389
408
|
let vfcConfig = VideoFeed.convertToVideoFeedItemContentConfiguration(feedViewConfig)
|
|
390
409
|
let vpcConfig = VideoFeed.convertToVideoPlayerContentConfiguration(playerViewConfig)
|
|
@@ -404,8 +423,9 @@ extension VideoFeed {
|
|
|
404
423
|
}
|
|
405
424
|
|
|
406
425
|
// set a value different from default value to compatible with FireworkVideo SDK misalign bug
|
|
407
|
-
videoConfig.itemView.titleLayoutConfiguration.insets
|
|
408
|
-
top: 7, left: 7, bottom: 7, right: 7)
|
|
426
|
+
if videoConfig.itemView.titleLayoutConfiguration.insets == UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8) {
|
|
427
|
+
videoConfig.itemView.titleLayoutConfiguration.insets = UIEdgeInsets(top: 7, left: 7, bottom: 7, right: 7)
|
|
428
|
+
}
|
|
409
429
|
|
|
410
430
|
return videoConfig
|
|
411
431
|
}
|
|
@@ -13,21 +13,20 @@ public class VideoFeedConfiguration: NSObject, Codable {
|
|
|
13
13
|
var cornerRadius: Double?
|
|
14
14
|
var title: VideoFeedTitleConfiguration?
|
|
15
15
|
var titlePosition: VideoFeedTitlePosition?
|
|
16
|
+
var titlePadding: VideoFeedPadding?
|
|
16
17
|
var playIcon: VideoFeedPlayIconConfiguration?
|
|
17
|
-
var showSponsored: Bool?
|
|
18
18
|
var showAdBadge: Bool?
|
|
19
19
|
var aspectRatio: Double?
|
|
20
|
-
var contentPadding:
|
|
20
|
+
var contentPadding: VideoFeedPadding?
|
|
21
21
|
var itemSpacing: Double?
|
|
22
22
|
var enableAutoplay: Bool?
|
|
23
23
|
var gridColumns: Int?
|
|
24
|
-
// legacy property
|
|
25
|
-
var enablePictureInPicture: Bool?
|
|
26
24
|
|
|
27
25
|
class VideoFeedTitleConfiguration: NSObject, Codable {
|
|
28
26
|
public var hidden: Bool?
|
|
29
27
|
public var textColor: String?
|
|
30
28
|
public var fontSize: Double?
|
|
29
|
+
public var numberOfLines: Int?
|
|
31
30
|
public var iOSFontInfo: FontInfo?
|
|
32
31
|
}
|
|
33
32
|
|
|
@@ -36,7 +35,7 @@ public class VideoFeedConfiguration: NSObject, Codable {
|
|
|
36
35
|
public var iconWidth: Double?
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
class
|
|
38
|
+
class VideoFeedPadding: NSObject, Codable {
|
|
40
39
|
public var top: Double?
|
|
41
40
|
public var right: Double?
|
|
42
41
|
public var bottom: Double?
|
|
@@ -13,7 +13,7 @@ import FireworkVideoUI
|
|
|
13
13
|
#endif
|
|
14
14
|
|
|
15
15
|
@objc(VideoFeedManager)
|
|
16
|
-
class VideoFeedManager: RCTViewManager,
|
|
16
|
+
class VideoFeedManager: RCTViewManager, VideoFeedDelegate {
|
|
17
17
|
|
|
18
18
|
override func view() -> UIView! {
|
|
19
19
|
_ = AppLanguageManager.shared
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
9
|
+
import FireworkVideo
|
|
9
10
|
|
|
10
11
|
@objc
|
|
11
12
|
public class VideoPlayerConfiguration: NSObject, Codable {
|
|
@@ -19,6 +20,7 @@ public class VideoPlayerConfiguration: NSObject, Codable {
|
|
|
19
20
|
var ctaDelay: VideoPlayerCTADelay?
|
|
20
21
|
var ctaHighlightDelay: VideoPlayerCTADelay?
|
|
21
22
|
var shareBaseURL: String?
|
|
23
|
+
var ctaWidth: VideoPlayerCTAWidth?
|
|
22
24
|
|
|
23
25
|
public enum VideoPlayerStyle: String, Codable {
|
|
24
26
|
case full, fit
|
|
@@ -43,4 +45,19 @@ public class VideoPlayerConfiguration: NSObject, Codable {
|
|
|
43
45
|
var type: VideoPlayerCTADelayType?
|
|
44
46
|
var value: Double?
|
|
45
47
|
}
|
|
48
|
+
|
|
49
|
+
public enum VideoPlayerCTAWidth: String, Codable {
|
|
50
|
+
case fullWidth, compact, sizeToFit
|
|
51
|
+
|
|
52
|
+
func width() -> VideoPlayerCTAConfiguration.VideoPlayerCTAWidth {
|
|
53
|
+
switch self {
|
|
54
|
+
case .fullWidth:
|
|
55
|
+
return .fullWidth
|
|
56
|
+
case .compact:
|
|
57
|
+
return .compact
|
|
58
|
+
case .sizeToFit:
|
|
59
|
+
return .sizeToFit
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
46
63
|
}
|