react-native-firework-sdk 1.9.0-beta.3 → 1.10.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/android/build.gradle +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +47 -14
- package/ios/Components/StoryBlock.swift +33 -7
- package/ios/Components/StoryBlockManager.m +33 -0
- package/ios/Components/StoryBlockManager.swift +4 -0
- package/ios/Components/VideoFeed.swift +9 -31
- package/ios/Components/VideoFeedManager.m +12 -6
- package/ios/Components/VideoFeedManager.swift +4 -0
- package/ios/FireworkSdk-Bridging-Header.h +0 -6
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +5 -171
- 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/{Utils/AppLanguage/Bundle+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift} +7 -7
- package/ios/{Utils/AppLanguage/NumberFormatter+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift} +5 -5
- package/ios/{Utils/AppLanguage/URLSession+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift} +7 -7
- package/ios/{Utils/AppLanguage/UIImageView+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift} +11 -11
- package/ios/{Utils/AppLanguage/UILabel+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift} +17 -17
- package/ios/{Utils/AppLanguage/UITextField+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift} +16 -16
- package/ios/{Utils/AppLanguage/UITextView+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift} +16 -16
- package/ios/{Utils/AppLanguage/UIView+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift} +7 -7
- package/ios/{Utils/AppLanguage/UIViewController+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift} +19 -5
- package/ios/{Utils/AppLanguage/UIWindow+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift} +5 -5
- package/ios/{Utils/AppLanguage/FWLanguageUtil.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift} +8 -4
- 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/Extensions/DispatchQueue+FWOnce.swift → FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift} +4 -4
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +18 -0
- package/ios/{Utils/Extensions/UIView+FWUIHierarchy.swift → FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift} +4 -5
- package/ios/{Utils/FWSwizzleUtil.swift → FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift} +2 -2
- package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +764 -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 +6 -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 +12 -102
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +34 -16
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +25 -8
- package/ios/Modules/LiveStream/LiveStreamModule.swift +1 -0
- package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +13 -0
- package/ios/Modules/Shopping/ShoppingCTAResult.swift +16 -0
- package/ios/Modules/Shopping/ShoppingModule.m +2 -1
- package/ios/Modules/Shopping/ShoppingModule.swift +103 -30
- package/ios/Support/MultiHostStreaming/FWMultiHostStreaming.podspec +22 -0
- package/ios/Support/MultiHostStreaming/Sources/MultiHostStreamingSDK.swift +17 -0
- package/ios/Utils/Extensions/Swizzle/UINavigationController+FWSwizzle.swift +4 -1
- package/ios/Utils/FWSwizzleLoader.m +5 -0
- package/ios/scripts/react_native_firework_sdk_pods.rb +27 -0
- package/lib/commonjs/FWNavigator.js +2 -2
- package/lib/commonjs/FWNavigator.js.map +1 -1
- package/lib/commonjs/FireworkSDK.js +33 -7
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +72 -23
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +158 -106
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +32 -16
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +2 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/models/ShoppingCTAResult.js +2 -0
- package/lib/commonjs/models/ShoppingCTAResult.js.map +1 -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/FWNavigator.js +5 -2
- package/lib/module/FWNavigator.js.map +1 -1
- package/lib/module/FireworkSDK.js +32 -7
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +71 -24
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/StoryBlock.js +148 -103
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +39 -13
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +2 -0
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/models/ShoppingCTAResult.js +2 -0
- package/lib/module/models/ShoppingCTAResult.js.map +1 -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/FWNavigator.d.ts +5 -2
- package/lib/typescript/FireworkSDK.d.ts +15 -3
- package/lib/typescript/VideoShopping.d.ts +27 -6
- package/lib/typescript/components/StoryBlock.d.ts +29 -11
- package/lib/typescript/components/VideoFeed.d.ts +28 -4
- package/lib/typescript/index.d.ts +6 -5
- package/lib/typescript/models/AddToCartResult.d.ts +4 -0
- package/lib/typescript/models/FWEventName.d.ts +2 -0
- package/lib/typescript/models/FWEvents.d.ts +27 -0
- package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +35 -0
- package/lib/typescript/models/ShoppingCTAResult.d.ts +11 -0
- package/lib/typescript/models/StoryBlockSource.d.ts +1 -1
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +2 -1
- package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
- package/lib/typescript/models/VideoPlaybackEventName.d.ts +13 -1
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +2 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -2
- package/lib/typescript/modules/ShoppingModule.d.ts +2 -0
- package/package.json +9 -4
- package/react-native-firework-sdk.podspec +18 -8
- package/src/FWNavigator.ts +5 -2
- package/src/FireworkSDK.ts +37 -9
- package/src/VideoShopping.ts +108 -33
- package/src/components/StoryBlock.tsx +168 -84
- package/src/components/VideoFeed.tsx +38 -11
- package/src/index.ts +15 -1
- package/src/models/AddToCartResult.ts +4 -0
- package/src/models/FWEventName.ts +2 -0
- package/src/models/FWEvents.ts +28 -0
- package/src/models/ProductInfoViewConfiguration.ts +37 -0
- package/src/models/ShoppingCTAResult.ts +11 -0
- package/src/models/StoryBlockSource.ts +2 -1
- package/src/models/VideoFeedConfiguration.ts +2 -1
- package/src/models/VideoFeedSource.ts +2 -1
- package/src/models/VideoPlaybackEventName.ts +13 -1
- package/src/models/VideoPlayerConfiguration.ts +2 -0
- package/src/modules/FireworkSDKModule.ts +1 -2
- package/src/modules/ShoppingModule.ts +6 -1
- package/ios/Utils/AppLanguage/FWAppLanguageManager.swift +0 -118
- package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.h +0 -25
- package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.m +0 -75
- package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.h +0 -21
- package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.m +0 -124
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.h +0 -11
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.m +0 -86
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.h +0 -16
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.m +0 -55
- package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.h +0 -18
- package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.m +0 -39
- package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.h +0 -54
- package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.m +0 -141
- package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.h +0 -16
- package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.m +0 -20
- package/ios/Utils/FWRTL/Classes/Utils/FWRTLDefinitions.h +0 -52
- package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.h +0 -19
- package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.m +0 -49
- package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.h +0 -21
- package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.m +0 -38
- package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.h +0 -18
- package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.m +0 -43
- package/ios/scripts/firework_sdk_pods.rb +0 -3
package/android/build.gradle
CHANGED
|
@@ -167,7 +167,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
167
167
|
|
|
168
168
|
dependencies {
|
|
169
169
|
|
|
170
|
-
def firework_sdk_version = 'v5.14.
|
|
170
|
+
def firework_sdk_version = 'v5.14.15'
|
|
171
171
|
implementation "com.github.loopsocial:firework_sdk:$firework_sdk_version"
|
|
172
172
|
|
|
173
173
|
// noinspection GradleDynamicVersion
|
|
@@ -11,17 +11,44 @@ object FWLanguageUtil {
|
|
|
11
11
|
private const val LOCALE_SP = "fw_locale_sp"
|
|
12
12
|
private const val LOCALE_KEY = "fw_locale_key"
|
|
13
13
|
|
|
14
|
-
private
|
|
14
|
+
private var systemLocale: Locale? = null
|
|
15
|
+
|
|
16
|
+
private fun readLocaleFromSp(context: Context) {
|
|
15
17
|
locale = context.getSharedPreferences(LOCALE_SP, Context.MODE_PRIVATE)
|
|
16
18
|
.getString(LOCALE_KEY, null)
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
fun changeLanguage(context: Context, l: String?): Boolean {
|
|
20
|
-
|
|
22
|
+
readLocaleFromSp(context)
|
|
23
|
+
val sharedPreferences =
|
|
24
|
+
context.getSharedPreferences(LOCALE_SP, Context.MODE_PRIVATE)
|
|
25
|
+
if (l.isNullOrBlank()) {
|
|
26
|
+
if (locale.isNullOrBlank()) {
|
|
27
|
+
return true
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
locale = null
|
|
31
|
+
sharedPreferences.edit().apply {
|
|
32
|
+
remove(LOCALE_KEY)
|
|
33
|
+
}.commit()
|
|
34
|
+
|
|
35
|
+
// change sdk locale to system locale
|
|
36
|
+
val sysLocale = getSystemLocale()
|
|
37
|
+
if (sysLocale.country.isNullOrBlank()) {
|
|
38
|
+
FwSDK.changeAppLocale(context, sysLocale.language)
|
|
39
|
+
} else {
|
|
40
|
+
FwSDK.changeAppLocale(context, "${sysLocale.language}-${sysLocale.country}")
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
restartActivity(context)
|
|
44
|
+
return true
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!isValidLocale(l)) {
|
|
21
48
|
return false
|
|
22
49
|
}
|
|
23
50
|
|
|
24
|
-
if (
|
|
51
|
+
if (locale == l) {
|
|
25
52
|
return true
|
|
26
53
|
}
|
|
27
54
|
|
|
@@ -29,22 +56,22 @@ object FWLanguageUtil {
|
|
|
29
56
|
FwSDK.changeAppLocale(context, l)
|
|
30
57
|
|
|
31
58
|
// save to sp
|
|
32
|
-
val sharedPreferences =
|
|
33
|
-
context.getSharedPreferences(LOCALE_SP, Context.MODE_PRIVATE)
|
|
34
59
|
sharedPreferences.edit().apply {
|
|
35
60
|
putString(LOCALE_KEY, l)
|
|
36
61
|
}.apply()
|
|
37
62
|
|
|
38
|
-
|
|
39
|
-
context.recreate()
|
|
40
|
-
}
|
|
63
|
+
restartActivity(context)
|
|
41
64
|
|
|
42
65
|
return true
|
|
43
66
|
}
|
|
44
67
|
|
|
45
68
|
fun updateBaseContextLocale(context: Context): Context {
|
|
69
|
+
if (systemLocale == null) {
|
|
70
|
+
systemLocale = Locale.getDefault()
|
|
71
|
+
}
|
|
72
|
+
|
|
46
73
|
if (locale.isNullOrBlank()) {
|
|
47
|
-
|
|
74
|
+
readLocaleFromSp(context)
|
|
48
75
|
}
|
|
49
76
|
locale?.let {
|
|
50
77
|
val localeStrings = it.split("-")
|
|
@@ -57,7 +84,10 @@ object FWLanguageUtil {
|
|
|
57
84
|
|
|
58
85
|
return updateResourcesLocale(context, locale)
|
|
59
86
|
}
|
|
60
|
-
|
|
87
|
+
|
|
88
|
+
val l = getSystemLocale()
|
|
89
|
+
Locale.setDefault(l)
|
|
90
|
+
return updateResourcesLocale(context, l)
|
|
61
91
|
}
|
|
62
92
|
|
|
63
93
|
private fun updateResourcesLocale(context: Context, locale: Locale): Context {
|
|
@@ -80,11 +110,14 @@ object FWLanguageUtil {
|
|
|
80
110
|
return list.contains(Locale(locale))
|
|
81
111
|
}
|
|
82
112
|
|
|
83
|
-
private fun
|
|
84
|
-
if (
|
|
85
|
-
|
|
113
|
+
private fun restartActivity(context: Context) {
|
|
114
|
+
if (context is Activity) {
|
|
115
|
+
context.recreate()
|
|
86
116
|
}
|
|
87
|
-
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private fun getSystemLocale(): Locale {
|
|
120
|
+
return systemLocale ?: Locale.getDefault()
|
|
88
121
|
}
|
|
89
122
|
|
|
90
123
|
}
|
|
@@ -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
|
|
|
@@ -61,20 +65,26 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
|
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
private func embed() {
|
|
64
|
-
guard let parentVC =
|
|
68
|
+
guard let parentVC = parentViewController else {
|
|
65
69
|
return
|
|
66
70
|
}
|
|
67
71
|
guard self.storyBlockVC == nil else {
|
|
68
72
|
return
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
|
|
72
|
-
if
|
|
73
|
-
|
|
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)
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
guard let storyBlockVC = resultStoryBlockVC else {
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if self.enablePictureInPicture {
|
|
87
|
+
storyBlockVC.isPictureInPictureEnabled = true
|
|
78
88
|
}
|
|
79
89
|
|
|
80
90
|
storyBlockVC.delegate = self
|
|
@@ -93,6 +103,22 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
|
|
|
93
103
|
self.storyBlockVC = nil
|
|
94
104
|
}
|
|
95
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
|
+
|
|
96
122
|
public func storyBlockDidLoadFeed(_ viewController: StoryBlockViewController) {
|
|
97
123
|
guard let delegate = self.delegate else {
|
|
98
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
|
|
|
@@ -7,10 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
import FireworkVideo
|
|
9
9
|
import Foundation
|
|
10
|
+
#if canImport(FireworkVideoUI)
|
|
11
|
+
import FireworkVideoUI
|
|
12
|
+
#endif
|
|
10
13
|
|
|
11
14
|
@objc(StoryBlockManager)
|
|
12
15
|
class StoryBlockManager: RCTViewManager, StoryBlockViewDelegate {
|
|
13
16
|
override func view() -> UIView! {
|
|
17
|
+
_ = AppLanguageManager.shared
|
|
14
18
|
let storyBlock = StoryBlock()
|
|
15
19
|
storyBlock.delegate = self
|
|
16
20
|
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
import FireworkVideo
|
|
9
9
|
import UIKit
|
|
10
|
+
#if canImport(FireworkVideoUI)
|
|
11
|
+
import FireworkVideoUI
|
|
12
|
+
#endif
|
|
10
13
|
|
|
11
14
|
@objc
|
|
12
15
|
public enum VideoFeedMode: Int {
|
|
@@ -15,7 +18,7 @@ public enum VideoFeedMode: Int {
|
|
|
15
18
|
|
|
16
19
|
@objc
|
|
17
20
|
public enum VideFeedSourceType: Int {
|
|
18
|
-
case discover, channel, playlist, playlistGroup, dynamicContent
|
|
21
|
+
case discover, channel, playlist, playlistGroup, dynamicContent, hashtagPlaylist
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
public protocol VideoFeedViewDelegate: AnyObject {
|
|
@@ -34,6 +37,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
34
37
|
@objc public var playlist: String = ""
|
|
35
38
|
@objc public var playlistGroup: String = ""
|
|
36
39
|
@objc public var dynamicContentParameters: NSDictionary = NSDictionary()
|
|
40
|
+
@objc public var hashtagFilterExpression: String = ""
|
|
37
41
|
@objc public var mode: VideoFeedMode = .row
|
|
38
42
|
@objc public var feedViewConfig: VideoFeedConfiguration? {
|
|
39
43
|
didSet {
|
|
@@ -74,6 +78,8 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
74
78
|
case .dynamicContent:
|
|
75
79
|
let parameters = dynamicContentParameters as? [String: [String]]
|
|
76
80
|
return .dynamicContent(channelID: channel, parameters: parameters ?? [:])
|
|
81
|
+
case .hashtagPlaylist:
|
|
82
|
+
return .hashtagPlaylist(channelID: channel, filterExpression: hashtagFilterExpression)
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
85
|
|
|
@@ -128,38 +134,14 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
128
134
|
return resultLayout ?? VideoFeedHorizontalLayout()
|
|
129
135
|
}
|
|
130
136
|
|
|
131
|
-
private var fireworkVideoAdConfiguration: FireworkVideo.AdConfiguration? {
|
|
132
|
-
guard let feedAdConfiguration = adConfiguration else {
|
|
133
|
-
return nil
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
var resultAdConfiguration = FireworkVideo.AdConfiguration()
|
|
137
|
-
if let requiresAds = feedAdConfiguration.requiresAds {
|
|
138
|
-
resultAdConfiguration.requiresAds = requiresAds
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if let adsFetchTimeout = feedAdConfiguration.adsFetchTimeout {
|
|
142
|
-
resultAdConfiguration.adsFetchTimeout = adsFetchTimeout
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if let vastAttributes = feedAdConfiguration.vastAttributes {
|
|
146
|
-
resultAdConfiguration.vastAttributes = vastAttributes.map({ attribute in
|
|
147
|
-
return URLQueryItem(name: attribute.name ?? "", value: attribute.value ?? "")
|
|
148
|
-
})
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return resultAdConfiguration
|
|
152
|
-
}
|
|
153
|
-
|
|
154
137
|
public override func layoutSubviews() {
|
|
155
138
|
super.layoutSubviews()
|
|
156
139
|
|
|
157
140
|
embed()
|
|
158
141
|
}
|
|
159
142
|
|
|
160
|
-
// swiftlint:disable:next function_body_length
|
|
161
143
|
private func embed() {
|
|
162
|
-
guard let parentVC =
|
|
144
|
+
guard let parentVC = parentViewController else {
|
|
163
145
|
return
|
|
164
146
|
}
|
|
165
147
|
guard self.feedVC == nil else {
|
|
@@ -167,7 +149,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
167
149
|
}
|
|
168
150
|
|
|
169
151
|
var resultFeedVC: VideoFeedViewController?
|
|
170
|
-
if let fireworkVideoAdConfiguration =
|
|
152
|
+
if let fireworkVideoAdConfiguration = RCTConvert.getFireworkVideoAdConfiguration(adConfiguration) {
|
|
171
153
|
resultFeedVC = VideoFeedViewController(
|
|
172
154
|
layout: videoFeedLayout,
|
|
173
155
|
source: source,
|
|
@@ -210,10 +192,6 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
210
192
|
feedVC.isPictureInPictureEnabled = true
|
|
211
193
|
}
|
|
212
194
|
|
|
213
|
-
if FWAppLanguageManager.shared.shouldHorizontalFlip {
|
|
214
|
-
feedVC.view.fwrtl_viewType = FWRTLViewTypeFlip
|
|
215
|
-
}
|
|
216
|
-
|
|
217
195
|
feedVC.delegate = self
|
|
218
196
|
self.feedVC = feedVC
|
|
219
197
|
parentVC.attachChild(feedVC, to: self)
|
|
@@ -9,7 +9,12 @@
|
|
|
9
9
|
#import <React/RCTBridgeModule.h>
|
|
10
10
|
#import <React/RCTViewManager.h>
|
|
11
11
|
#import <React/RCTUIManager.h>
|
|
12
|
+
|
|
13
|
+
#if __has_include(<react_native_firework_sdk/react_native_firework_sdk-Swift.h>)
|
|
14
|
+
#import <react_native_firework_sdk/react_native_firework_sdk-Swift.h>
|
|
15
|
+
#else
|
|
12
16
|
#import "react_native_firework_sdk-Swift.h"
|
|
17
|
+
#endif
|
|
13
18
|
|
|
14
19
|
@interface RCT_EXTERN_REMAP_MODULE(FWVideoFeed, VideoFeedManager, NSObject)
|
|
15
20
|
|
|
@@ -23,6 +28,7 @@ RCT_EXPORT_VIEW_PROPERTY(channel, NSString)
|
|
|
23
28
|
RCT_EXPORT_VIEW_PROPERTY(playlist, NSString)
|
|
24
29
|
RCT_EXPORT_VIEW_PROPERTY(playlistGroup, NSString)
|
|
25
30
|
RCT_EXPORT_VIEW_PROPERTY(dynamicContentParameters, NSDictionary)
|
|
31
|
+
RCT_EXPORT_VIEW_PROPERTY(hashtagFilterExpression, NSString)
|
|
26
32
|
|
|
27
33
|
RCT_CUSTOM_VIEW_PROPERTY(mode, VideoFeedMode, VideoFeed) {
|
|
28
34
|
if (json) {
|
|
@@ -51,12 +57,12 @@ RCT_EXPORT_VIEW_PROPERTY(onVideoFeedLoadFinished, RCTBubblingEventBlock)
|
|
|
51
57
|
|
|
52
58
|
RCT_EXPORT_METHOD(refresh:(nonnull NSNumber *)reactTag) {
|
|
53
59
|
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
VideoFeed *view = (VideoFeed *)(viewRegistry[reactTag]);
|
|
61
|
+
if (!view || ![view isKindOfClass:[VideoFeed class]]) {
|
|
62
|
+
RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
[view refresh];
|
|
60
66
|
}];
|
|
61
67
|
}
|
|
62
68
|
|
|
@@ -8,11 +8,15 @@
|
|
|
8
8
|
|
|
9
9
|
import FireworkVideo
|
|
10
10
|
import Foundation
|
|
11
|
+
#if canImport(FireworkVideoUI)
|
|
12
|
+
import FireworkVideoUI
|
|
13
|
+
#endif
|
|
11
14
|
|
|
12
15
|
@objc(VideoFeedManager)
|
|
13
16
|
class VideoFeedManager: RCTViewManager, VideoFeedViewDelegate {
|
|
14
17
|
|
|
15
18
|
override func view() -> UIView! {
|
|
19
|
+
_ = AppLanguageManager.shared
|
|
16
20
|
let videFeed = VideoFeed()
|
|
17
21
|
videFeed.delegate = self
|
|
18
22
|
|
|
@@ -6,9 +6,3 @@
|
|
|
6
6
|
#import <React/RCTLog.h>
|
|
7
7
|
#import <React/RCTRootView.h>
|
|
8
8
|
#import <React/RCTBridge+Private.h>
|
|
9
|
-
#import "FWSwizzleLoader.h"
|
|
10
|
-
#import "FWRTLManager.h"
|
|
11
|
-
#import "UIView+FWRTL.h"
|
|
12
|
-
#import "UIWindow+FWRTL.h"
|
|
13
|
-
#import "UIView+FWRTL.h"
|
|
14
|
-
#import "UIImage+FWRTL.h"
|