react-native-firework-sdk 1.8.0 → 1.9.0
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 -2
- package/ios/Components/StoryBlockManager.m +32 -0
- package/ios/Components/VideoFeed.swift +10 -29
- package/ios/Components/VideoFeedManager.m +11 -6
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +378 -204
- package/ios/Models/NativeToRN/FireworkEventName.swift +3 -1
- package/ios/Models/RNToNative/RCTConvert+Shopping.swift +21 -0
- package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +27 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +23 -5
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +31 -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 +24 -0
- package/ios/Support/MultiHostStreaming/src/MultiHostStreamingSDK.swift +17 -0
- package/ios/Utils/AppLanguage/Bundle+FWSwizzle.swift +58 -0
- package/ios/Utils/AppLanguage/FWAppLanguageManager.swift +139 -0
- package/ios/Utils/AppLanguage/FWLanguageUtil.swift +43 -0
- package/ios/Utils/AppLanguage/NumberFormatter+FWSwizzle.swift +25 -0
- package/ios/Utils/AppLanguage/UIImageView+FWSwizzle.swift +91 -0
- package/ios/Utils/AppLanguage/UILabel+FWSwizzle.swift +98 -0
- package/ios/Utils/AppLanguage/UITextField+FWSwizzle.swift +97 -0
- package/ios/Utils/AppLanguage/UITextView+FWSwizzle.swift +97 -0
- package/ios/Utils/AppLanguage/UIView+FWSwizzle.swift +38 -0
- package/ios/Utils/AppLanguage/UIViewController+FWSwizzle.swift +32 -0
- package/ios/Utils/AppLanguage/UIWindow+FWSwizzle.swift +26 -0
- package/ios/Utils/AppLanguage/URLSession+FWSwizzle.swift +69 -0
- package/ios/Utils/{DispatchQueue+FWOnce.swift → Extensions/DispatchQueue+FWOnce.swift} +3 -3
- package/ios/Utils/{UINavigationController+FWSwizzle.swift → Extensions/Swizzle/UINavigationController+FWSwizzle.swift} +6 -8
- package/ios/Utils/Extensions/UIView+FWUIHierarchy.swift +47 -0
- package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.h +25 -0
- package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.m +75 -0
- package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.h +21 -0
- package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.m +124 -0
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.h +11 -0
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.m +86 -0
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.h +16 -0
- package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.m +55 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.h +18 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.m +39 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.h +54 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.m +141 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.h +16 -0
- package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.m +20 -0
- package/ios/Utils/FWRTL/Classes/Utils/FWRTLDefinitions.h +52 -0
- package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.h +19 -0
- package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.m +49 -0
- package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.h +21 -0
- package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.m +38 -0
- package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.h +18 -0
- package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.m +43 -0
- package/ios/Utils/FWSwizzleLoader.m +6 -1
- package/ios/Utils/FWSwizzleLoader.swift +13 -0
- package/ios/Utils/FWSwizzleUtil.swift +17 -9
- package/ios/react_native_firework_sdk.h +1 -0
- package/ios/scripts/react_native_firework_sdk_pods.rb +31 -0
- package/lib/commonjs/FWNavigator.js +2 -2
- package/lib/commonjs/FWNavigator.js.map +1 -1
- package/lib/commonjs/FireworkSDK.js +31 -6
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +71 -22
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +156 -106
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +37 -11
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js +6 -0
- 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/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 +31 -6
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +70 -23
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/StoryBlock.js +146 -103
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +41 -10
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js +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/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/typescript/FWNavigator.d.ts +6 -3
- package/lib/typescript/FireworkSDK.d.ts +20 -7
- package/lib/typescript/LiveStream.d.ts +2 -2
- package/lib/typescript/VideoShopping.d.ts +32 -11
- package/lib/typescript/components/StoryBlock.d.ts +21 -11
- package/lib/typescript/components/VideoFeed.d.ts +21 -5
- package/lib/typescript/index.d.ts +7 -4
- package/lib/typescript/models/AdBadgeConfiguration.d.ts +1 -1
- 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/IOSFontInfo.d.ts +2 -2
- package/lib/typescript/models/NewNativeContainerProps.d.ts +1 -1
- 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 +4 -3
- package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +7 -5
- package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -2
- package/lib/typescript/modules/ShoppingModule.d.ts +2 -0
- package/package.json +10 -6
- package/react-native-firework-sdk.podspec +26 -24
- package/src/FWNavigator.ts +6 -3
- package/src/FireworkSDK.ts +27 -8
- package/src/VideoShopping.ts +110 -41
- package/src/components/StoryBlock.tsx +158 -84
- package/src/components/VideoFeed.tsx +38 -9
- package/src/index.ts +21 -0
- 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/VideoFeedConfiguration.ts +3 -2
- package/src/models/VideoPlayerConfiguration.ts +3 -1
- package/src/modules/FireworkSDKModule.ts +1 -2
- package/src/modules/ShoppingModule.ts +6 -1
- package/ios/Utils/UIView+ParentViewController.swift +0 -21
- /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/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
|
}
|
|
@@ -25,6 +25,7 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
|
|
|
25
25
|
@objc public var playlist: String = ""
|
|
26
26
|
@objc public var dynamicContentParameters: [String: [String]] = [:]
|
|
27
27
|
@objc public var enablePictureInPicture: Bool = false
|
|
28
|
+
@objc public var adConfiguration: AdConfiguration?
|
|
28
29
|
|
|
29
30
|
public weak var delegate: StoryBlockViewDelegate?
|
|
30
31
|
|
|
@@ -61,18 +62,32 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
private func embed() {
|
|
64
|
-
guard let parentVC =
|
|
65
|
+
guard let parentVC = fwParentViewController else {
|
|
65
66
|
return
|
|
66
67
|
}
|
|
67
68
|
guard self.storyBlockVC == nil else {
|
|
68
69
|
return
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
var resultStoryBlockVC: StoryBlockViewController?
|
|
73
|
+
if let fireworkVideoAdConfiguration = RCTConvert.getFireworkVideoAdConfiguration(adConfiguration) {
|
|
74
|
+
resultStoryBlockVC = StoryBlockViewController(source: source, adConfiguration: fireworkVideoAdConfiguration)
|
|
75
|
+
} else {
|
|
76
|
+
resultStoryBlockVC = StoryBlockViewController(source: source)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
guard let storyBlockVC = resultStoryBlockVC else {
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
72
83
|
if self.enablePictureInPicture {
|
|
73
84
|
storyBlockVC.isPictureInPictureEnabled = true
|
|
74
85
|
}
|
|
75
86
|
|
|
87
|
+
if FWAppLanguageManager.shared.shouldHorizontalFlip {
|
|
88
|
+
storyBlockVC.view.fwrtl_viewType = FWRTLViewTypeFlip
|
|
89
|
+
}
|
|
90
|
+
|
|
76
91
|
storyBlockVC.delegate = self
|
|
77
92
|
self.storyBlockVC = storyBlockVC
|
|
78
93
|
parentVC.attachChild(storyBlockVC, to: self)
|
|
@@ -89,6 +104,22 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
|
|
|
89
104
|
self.storyBlockVC = nil
|
|
90
105
|
}
|
|
91
106
|
|
|
107
|
+
@objc
|
|
108
|
+
public func play() {
|
|
109
|
+
guard let storyBlockVC = self.storyBlockVC else {
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
storyBlockVC.play()
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@objc
|
|
116
|
+
public func pause() {
|
|
117
|
+
guard let storyBlockVC = self.storyBlockVC else {
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
storyBlockVC.pause()
|
|
121
|
+
}
|
|
122
|
+
|
|
92
123
|
public func storyBlockDidLoadFeed(_ viewController: StoryBlockViewController) {
|
|
93
124
|
guard let delegate = self.delegate else {
|
|
94
125
|
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
|
|
|
@@ -23,8 +29,34 @@ RCT_EXPORT_VIEW_PROPERTY(playlist, NSString)
|
|
|
23
29
|
RCT_EXPORT_VIEW_PROPERTY(dynamicContentParameters, NSDictionary)
|
|
24
30
|
RCT_EXPORT_VIEW_PROPERTY(enablePictureInPicture, BOOL)
|
|
25
31
|
|
|
32
|
+
RCT_CUSTOM_VIEW_PROPERTY(adConfiguration, AdConfiguration, StoryBlock) {
|
|
33
|
+
AdConfiguration *config = [RCTConvert adConfiguration:json];
|
|
34
|
+
view.adConfiguration = config;
|
|
35
|
+
}
|
|
26
36
|
|
|
27
37
|
RCT_EXPORT_VIEW_PROPERTY(onStoryBlockLoadFinished, RCTBubblingEventBlock)
|
|
28
38
|
|
|
39
|
+
RCT_EXPORT_METHOD(play:(nonnull NSNumber *)reactTag) {
|
|
40
|
+
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
41
|
+
StoryBlock *view = (StoryBlock *)(viewRegistry[reactTag]);
|
|
42
|
+
if (!view || ![view isKindOfClass:[StoryBlock class]]) {
|
|
43
|
+
RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
[view play];
|
|
47
|
+
}];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
RCT_EXPORT_METHOD(pause:(nonnull NSNumber *)reactTag) {
|
|
51
|
+
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
52
|
+
StoryBlock *view = (StoryBlock *)(viewRegistry[reactTag]);
|
|
53
|
+
if (!view || ![view isKindOfClass:[StoryBlock class]]) {
|
|
54
|
+
RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
[view pause];
|
|
58
|
+
}];
|
|
59
|
+
}
|
|
60
|
+
|
|
29
61
|
@end
|
|
30
62
|
|
|
@@ -128,42 +128,23 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
128
128
|
return resultLayout ?? VideoFeedHorizontalLayout()
|
|
129
129
|
}
|
|
130
130
|
|
|
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
131
|
public override func layoutSubviews() {
|
|
155
132
|
super.layoutSubviews()
|
|
156
133
|
|
|
157
134
|
embed()
|
|
158
135
|
}
|
|
159
136
|
|
|
137
|
+
// swiftlint:disable:next function_body_length
|
|
160
138
|
private func embed() {
|
|
161
|
-
guard let parentVC =
|
|
139
|
+
guard let parentVC = fwParentViewController else {
|
|
140
|
+
return
|
|
141
|
+
}
|
|
142
|
+
guard self.feedVC == nil else {
|
|
162
143
|
return
|
|
163
144
|
}
|
|
164
145
|
|
|
165
146
|
var resultFeedVC: VideoFeedViewController?
|
|
166
|
-
if let fireworkVideoAdConfiguration =
|
|
147
|
+
if let fireworkVideoAdConfiguration = RCTConvert.getFireworkVideoAdConfiguration(adConfiguration) {
|
|
167
148
|
resultFeedVC = VideoFeedViewController(
|
|
168
149
|
layout: videoFeedLayout,
|
|
169
150
|
source: source,
|
|
@@ -202,12 +183,14 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
202
183
|
feedVC.viewConfiguration = viewConfiguration
|
|
203
184
|
}
|
|
204
185
|
|
|
205
|
-
// swiftlint:disable:next notification_center_detachment
|
|
206
|
-
NotificationCenter.default.removeObserver(self)
|
|
207
186
|
if self.enablePictureInPicture || feedViewConfig?.enablePictureInPicture == true {
|
|
208
187
|
feedVC.isPictureInPictureEnabled = true
|
|
209
188
|
}
|
|
210
189
|
|
|
190
|
+
if FWAppLanguageManager.shared.shouldHorizontalFlip {
|
|
191
|
+
feedVC.view.fwrtl_viewType = FWRTLViewTypeFlip
|
|
192
|
+
}
|
|
193
|
+
|
|
211
194
|
feedVC.delegate = self
|
|
212
195
|
self.feedVC = feedVC
|
|
213
196
|
parentVC.attachChild(feedVC, to: self)
|
|
@@ -215,8 +198,6 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
215
198
|
|
|
216
199
|
public override func removeFromSuperview() {
|
|
217
200
|
super.removeFromSuperview()
|
|
218
|
-
// swiftlint:disable:next notification_center_detachment
|
|
219
|
-
NotificationCenter.default.removeObserver(self)
|
|
220
201
|
|
|
221
202
|
guard let feedVC = self.feedVC else {
|
|
222
203
|
return
|
|
@@ -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
|
|
|
@@ -51,12 +56,12 @@ RCT_EXPORT_VIEW_PROPERTY(onVideoFeedLoadFinished, RCTBubblingEventBlock)
|
|
|
51
56
|
|
|
52
57
|
RCT_EXPORT_METHOD(refresh:(nonnull NSNumber *)reactTag) {
|
|
53
58
|
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
VideoFeed *view = (VideoFeed *)(viewRegistry[reactTag]);
|
|
60
|
+
if (!view || ![view isKindOfClass:[VideoFeed class]]) {
|
|
61
|
+
RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
[view refresh];
|
|
60
65
|
}];
|
|
61
66
|
}
|
|
62
67
|
|