react-native-firework-sdk 1.7.0 → 1.8.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/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +0 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +11 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +3 -3
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +20 -2
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +1 -0
- package/ios/Components/StoryBlock.swift +1 -8
- package/ios/Components/StoryBlockManager.swift +4 -0
- package/ios/Components/VideoFeed.swift +9 -14
- package/ios/Components/VideoFeedConfiguration.swift +2 -0
- package/ios/Components/VideoFeedManager.m +2 -0
- package/ios/Components/VideoFeedManager.swift +4 -0
- package/ios/Components/VideoPlayerConfiguration.swift +1 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +12 -8
- package/ios/Models/Common/FontInfo.swift +57 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +2 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +249 -103
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +0 -2
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +12 -12
- package/ios/Modules/LiveStream/LiveStreamModule.swift +5 -3
- package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +7 -2
- package/ios/Modules/Shopping/ShoppingModule.m +1 -1
- package/ios/Modules/Shopping/ShoppingModule.swift +72 -63
- package/ios/Utils/FWSwizzleLoader.m +0 -1
- package/lib/commonjs/FWNavigator.js +32 -1
- package/lib/commonjs/FWNavigator.js.map +1 -1
- package/lib/commonjs/FireworkSDK.js +9 -12
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +64 -9
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +14 -5
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWEventName.js +1 -0
- package/lib/commonjs/models/FWEventName.js.map +1 -1
- package/lib/commonjs/models/IOSFontInfo.js +2 -0
- package/lib/commonjs/models/IOSFontInfo.js.map +1 -0
- package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -1
- package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
- package/lib/module/FWNavigator.js +31 -1
- package/lib/module/FWNavigator.js.map +1 -1
- package/lib/module/FireworkSDK.js +10 -11
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +63 -9
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/VideoFeed.js +14 -5
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWEventName.js +1 -0
- package/lib/module/models/FWEventName.js.map +1 -1
- package/lib/module/models/IOSFontInfo.js +2 -0
- package/lib/module/models/IOSFontInfo.js.map +1 -0
- package/lib/module/modules/FWNavigatorModule.js.map +1 -1
- package/lib/module/modules/ShoppingModule.js.map +1 -1
- package/lib/typescript/FWNavigator.d.ts +16 -1
- package/lib/typescript/FireworkSDK.d.ts +2 -0
- package/lib/typescript/VideoShopping.d.ts +28 -6
- package/lib/typescript/components/VideoFeed.d.ts +4 -0
- package/lib/typescript/index.d.ts +6 -4
- package/lib/typescript/models/FWEventName.d.ts +2 -1
- package/lib/typescript/models/FWEvents.d.ts +5 -0
- package/lib/typescript/models/IOSFontInfo.d.ts +19 -0
- package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +23 -0
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +19 -1
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +16 -0
- package/lib/typescript/modules/FWNavigatorModule.d.ts +2 -0
- package/lib/typescript/modules/ShoppingModule.d.ts +2 -1
- package/package.json +1 -1
- package/react-native-firework-sdk.podspec +1 -1
- package/src/{FWNavigator.tsx → FWNavigator.ts} +29 -1
- package/src/FireworkSDK.ts +10 -10
- package/src/VideoShopping.ts +83 -11
- package/src/components/VideoFeed.tsx +12 -2
- package/src/{index.tsx → index.ts} +17 -1
- package/src/models/FWEventName.ts +1 -0
- package/src/models/FWEvents.ts +6 -0
- package/src/models/IOSFontInfo.ts +29 -0
- package/src/models/ProductInfoViewConfiguration.ts +25 -0
- package/src/models/VideoFeedConfiguration.ts +20 -1
- package/src/models/VideoPlayerConfiguration.ts +17 -0
- package/src/modules/FWNavigatorModule.ts +2 -0
- package/src/modules/ShoppingModule.ts +2 -4
- package/ios/Utils/FWPiPManager.swift +0 -24
- package/ios/Utils/UIButton+FWSwizzle.swift +0 -33
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
import FireworkVideo
|
|
9
9
|
|
|
10
|
+
private struct PlayerInfo {
|
|
11
|
+
enum PlayerMode: Int {
|
|
12
|
+
case fullscreen, floating
|
|
13
|
+
}
|
|
14
|
+
var playerVC: PlayerViewController
|
|
15
|
+
var mode: PlayerMode
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
@objc(FWNavigatorModule)
|
|
11
19
|
class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
12
20
|
override func supportedEvents() -> [String]! {
|
|
@@ -17,6 +25,10 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
17
25
|
return true
|
|
18
26
|
}
|
|
19
27
|
|
|
28
|
+
override var methodQueue: DispatchQueue {
|
|
29
|
+
return DispatchQueue.main
|
|
30
|
+
}
|
|
31
|
+
|
|
20
32
|
// swiftlint:disable function_body_length
|
|
21
33
|
|
|
22
34
|
@objc(pushNativeContainer:resolver:rejecter:)
|
|
@@ -34,77 +46,170 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
34
46
|
])
|
|
35
47
|
#endif
|
|
36
48
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
49
|
+
guard let props = props as? [String: Any] else {
|
|
50
|
+
resolver(false)
|
|
51
|
+
return
|
|
52
|
+
}
|
|
42
53
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
guard let appComponentName = gAppComponentName, appComponentName.count > 0 else {
|
|
55
|
+
resolver(false)
|
|
56
|
+
return
|
|
57
|
+
}
|
|
47
58
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
guard let presentedVC = RCTPresentedViewController() else {
|
|
60
|
+
resolver(false)
|
|
61
|
+
return
|
|
62
|
+
}
|
|
52
63
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
#if DEBUG
|
|
65
|
+
self.sendEvent(
|
|
66
|
+
withName: FWEventName.logMessage.rawValue,
|
|
67
|
+
body: [
|
|
68
|
+
"message":
|
|
69
|
+
"[iOS] Before creating containerViewController \(formatter.string(from: Date()))"
|
|
70
|
+
])
|
|
71
|
+
#endif
|
|
72
|
+
|
|
73
|
+
let containerViewController = FWNavigatorContainerViewController()
|
|
61
74
|
|
|
62
|
-
|
|
75
|
+
#if DEBUG
|
|
76
|
+
self.sendEvent(
|
|
77
|
+
withName: FWEventName.logMessage.rawValue,
|
|
78
|
+
body: [
|
|
79
|
+
"message":
|
|
80
|
+
"[iOS] After creating containerViewController \(formatter.string(from: Date()))"
|
|
81
|
+
])
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
containerViewController.moduleName = appComponentName
|
|
85
|
+
containerViewController.properties = props
|
|
86
|
+
containerViewController.modalPresentationStyle = .fullScreen
|
|
87
|
+
if presentedVC.modalPresentationStyle == .custom,
|
|
88
|
+
let presentingVC = presentedVC.presentingViewController,
|
|
89
|
+
presentingVC is FireworkVideo.PlayerViewController
|
|
90
|
+
{
|
|
91
|
+
containerViewController.modalPresentationStyle = .overFullScreen
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#if DEBUG
|
|
95
|
+
self.sendEvent(
|
|
96
|
+
withName: FWEventName.logMessage.rawValue,
|
|
97
|
+
body: [
|
|
98
|
+
"message":
|
|
99
|
+
"[iOS] Present containerViewController \(formatter.string(from: Date()))"
|
|
100
|
+
])
|
|
101
|
+
#endif
|
|
63
102
|
|
|
103
|
+
presentedVC.present(containerViewController, animated: true) {
|
|
64
104
|
#if DEBUG
|
|
65
105
|
self.sendEvent(
|
|
66
106
|
withName: FWEventName.logMessage.rawValue,
|
|
67
107
|
body: [
|
|
68
108
|
"message":
|
|
69
|
-
"[iOS]
|
|
109
|
+
"[iOS] Finish presenting containerViewController \(formatter.string(from: Date()))"
|
|
70
110
|
])
|
|
71
111
|
#endif
|
|
72
112
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
113
|
+
resolver(true)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// swiftlint:enable function_body_length
|
|
118
|
+
|
|
119
|
+
@objc(popNativeContainer:rejecter:)
|
|
120
|
+
func popNativeContainer(
|
|
121
|
+
_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock
|
|
122
|
+
) {
|
|
123
|
+
if let navigatorContainerVC = RCTPresentedViewController()
|
|
124
|
+
as? FWNavigatorContainerViewController,
|
|
125
|
+
navigatorContainerVC.presentingViewController != nil {
|
|
126
|
+
navigatorContainerVC.dismiss(animated: true) {
|
|
127
|
+
resolver(true)
|
|
128
|
+
}
|
|
129
|
+
} else if let cartViewController = gCartViewController {
|
|
130
|
+
cartViewController.navigationController?.popViewController(animated: true)
|
|
131
|
+
gCartViewController = nil
|
|
132
|
+
resolver(true)
|
|
133
|
+
} else if let presentedVC = RCTPresentedViewController(),
|
|
134
|
+
FWNavigatorModule.isIOSSDKViewController(presentedVC),
|
|
135
|
+
let presentingVC = presentedVC.presentingViewController,
|
|
136
|
+
presentingVC.presentingViewController == RCTKeyWindow()?.rootViewController,
|
|
137
|
+
FWNavigatorModule.isIOSSDKViewController(presentingVC) {
|
|
138
|
+
presentedVC.dismiss(animated: false) {
|
|
139
|
+
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 0.1) {
|
|
140
|
+
if let closeButton = FWNavigatorModule.getExitButton(view: presentingVC.view) {
|
|
141
|
+
closeButton.sendActions(for: .touchUpInside)
|
|
142
|
+
resolver(true)
|
|
143
|
+
} else {
|
|
144
|
+
presentingVC.dismiss(animated: true) {
|
|
145
|
+
resolver(true)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
81
149
|
}
|
|
150
|
+
} else if let rootVC = RCTKeyWindow()?.rootViewController,
|
|
151
|
+
let presentedVC = rootVC.presentedViewController,
|
|
152
|
+
FWNavigatorModule.isIOSSDKViewController(presentedVC) {
|
|
153
|
+
if let closeButton = FWNavigatorModule.getExitButton(view: presentedVC.view) {
|
|
154
|
+
closeButton.sendActions(for: .touchUpInside)
|
|
155
|
+
resolver(true)
|
|
156
|
+
} else {
|
|
157
|
+
presentedVC.dismiss(animated: true) {
|
|
158
|
+
resolver(true)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
resolver(false)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
82
165
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
166
|
+
@objc(canPopNativeContainer:rejecter:)
|
|
167
|
+
func canPopNativeContainer(
|
|
168
|
+
_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock
|
|
169
|
+
) {
|
|
170
|
+
if let presentedVC = RCTPresentedViewController(),
|
|
171
|
+
presentedVC.presentingViewController != nil {
|
|
172
|
+
resolver(true)
|
|
173
|
+
} else if gCartViewController != nil {
|
|
174
|
+
resolver(true)
|
|
175
|
+
} else {
|
|
176
|
+
resolver(false)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
91
179
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
#endif
|
|
180
|
+
@objc(startFloatingPlayer:rejecter:)
|
|
181
|
+
func startFloatingPlayer(
|
|
182
|
+
_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock
|
|
183
|
+
) {
|
|
184
|
+
guard let playerInfo = FWNavigatorModule.getPlayerInfo() else {
|
|
185
|
+
resolver(false)
|
|
186
|
+
return
|
|
187
|
+
}
|
|
101
188
|
|
|
189
|
+
if playerInfo.mode == .fullscreen {
|
|
190
|
+
do {
|
|
191
|
+
try playerInfo.playerVC.startPictureInPicture()
|
|
102
192
|
resolver(true)
|
|
193
|
+
} catch {
|
|
194
|
+
resolver(false)
|
|
103
195
|
}
|
|
196
|
+
} else {
|
|
197
|
+
// current player is already in floating mode.
|
|
198
|
+
resolver(false)
|
|
104
199
|
}
|
|
105
200
|
}
|
|
106
201
|
|
|
107
|
-
|
|
202
|
+
@objc(stopFloatingPlayer:rejecter:)
|
|
203
|
+
func stopFloatingPlayer(
|
|
204
|
+
_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock
|
|
205
|
+
) {
|
|
206
|
+
let result = FWNavigatorModule.stopFloatingPlayer()
|
|
207
|
+
resolver(result)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
extension FWNavigatorModule {
|
|
212
|
+
private static func getExitButton(view: UIView) -> UIButton? {
|
|
108
213
|
if let button = view as? UIButton, let targetImage = button.image(for: .normal) {
|
|
109
214
|
let iOSSDKBundle = Bundle(for: FireworkVideoSDK.self)
|
|
110
215
|
if targetImage.isEqual(UIImage(named: "closeX", in: iOSSDKBundle, compatibleWith: nil))
|
|
@@ -114,7 +219,7 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
114
219
|
}
|
|
115
220
|
|
|
116
221
|
for subview in view.subviews {
|
|
117
|
-
if let result =
|
|
222
|
+
if let result = getExitButton(view: subview) {
|
|
118
223
|
return result
|
|
119
224
|
}
|
|
120
225
|
}
|
|
@@ -122,67 +227,108 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
122
227
|
return nil
|
|
123
228
|
}
|
|
124
229
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if let navigatorContainerVC = RCTPresentedViewController()
|
|
133
|
-
as? FWNavigatorContainerViewController,
|
|
134
|
-
navigatorContainerVC.presentingViewController != nil {
|
|
135
|
-
navigatorContainerVC.dismiss(animated: true) {
|
|
136
|
-
resolver(true)
|
|
137
|
-
}
|
|
138
|
-
} else if let cartViewController = gCartViewController {
|
|
139
|
-
cartViewController.navigationController?.popViewController(animated: true)
|
|
140
|
-
gCartViewController = nil
|
|
141
|
-
resolver(true)
|
|
142
|
-
} else if let presentedVC = RCTPresentedViewController(),
|
|
143
|
-
let presentingVC = presentedVC.presentingViewController,
|
|
144
|
-
presentingVC.presentingViewController == RCTKeyWindow()?.rootViewController {
|
|
145
|
-
presentedVC.dismiss(animated: false) {
|
|
146
|
-
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 0.1) {
|
|
147
|
-
if let closeButton = self.getCloseButton(view: presentingVC.view) {
|
|
148
|
-
closeButton.sendActions(for: .touchUpInside)
|
|
149
|
-
resolver(true)
|
|
150
|
-
} else {
|
|
151
|
-
presentingVC.dismiss(animated: true) {
|
|
152
|
-
resolver(true)
|
|
153
|
-
}
|
|
154
|
-
}
|
|
230
|
+
private static func getWindowList() -> [UIWindow] {
|
|
231
|
+
var windowList: [UIWindow] = []
|
|
232
|
+
if #available(iOS 13.0, *) {
|
|
233
|
+
for scene in UIApplication.shared.connectedScenes {
|
|
234
|
+
if let currentSene = scene as? UIWindowScene {
|
|
235
|
+
for window in currentSene.windows {
|
|
236
|
+
windowList.append(window)
|
|
155
237
|
}
|
|
156
238
|
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
239
|
+
}
|
|
240
|
+
} else {
|
|
241
|
+
for window in UIApplication.shared.windows {
|
|
242
|
+
windowList.append(window)
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return windowList
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
private static func getFurthestAncestorController(_ controller: UIViewController) -> UIViewController {
|
|
250
|
+
guard let parentVC = controller.parent else {
|
|
251
|
+
return controller
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return getFurthestAncestorController(parentVC)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private static func getPlayerViewController(_ viewController: UIViewController) -> PlayerViewController? {
|
|
258
|
+
if let playerVC = viewController as? PlayerViewController {
|
|
259
|
+
return playerVC
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
for childVC in viewController.children {
|
|
263
|
+
if let playerVC = getPlayerViewController(childVC) {
|
|
264
|
+
return playerVC
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return nil
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
private static func getPlayerInfo() -> PlayerInfo? {
|
|
272
|
+
let windowList: [UIWindow] = getWindowList()
|
|
273
|
+
|
|
274
|
+
if let floatingPlayerWindow = windowList.first(where: { window in
|
|
275
|
+
NSStringFromClass(type(of: window)) == "FireworkVideo.FloatingPlayerController"
|
|
276
|
+
}) {
|
|
277
|
+
if let rootVC = floatingPlayerWindow.rootViewController,
|
|
278
|
+
let playerVC = getPlayerViewController(rootVC) {
|
|
279
|
+
return PlayerInfo(playerVC: playerVC, mode: .floating)
|
|
280
|
+
}
|
|
281
|
+
return nil
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if let keyWindow = windowList.first(where: { window in
|
|
285
|
+
return window.isKeyWindow
|
|
286
|
+
}) {
|
|
287
|
+
if let rootVC = keyWindow.rootViewController,
|
|
288
|
+
let presentedVC = rootVC.presentedViewController {
|
|
289
|
+
let furthestAncestorController = getFurthestAncestorController(presentedVC)
|
|
290
|
+
|
|
291
|
+
if let playerVC = getPlayerViewController(furthestAncestorController) {
|
|
292
|
+
return PlayerInfo(playerVC: playerVC, mode: .fullscreen)
|
|
166
293
|
}
|
|
167
|
-
} else {
|
|
168
|
-
resolver(false)
|
|
169
294
|
}
|
|
295
|
+
|
|
296
|
+
return nil
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return nil
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
private static func isIOSSDKViewController(_ controller: UIViewController?) -> Bool {
|
|
303
|
+
guard let controller = controller else {
|
|
304
|
+
return false
|
|
170
305
|
}
|
|
306
|
+
|
|
307
|
+
let iOSSDKBundle = Bundle(for: FireworkVideoSDK.self)
|
|
308
|
+
if Bundle(for: type(of: controller)) == iOSSDKBundle {
|
|
309
|
+
return true
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return isIOSSDKViewController(controller.parent)
|
|
171
313
|
}
|
|
314
|
+
}
|
|
172
315
|
|
|
173
|
-
|
|
174
|
-
func
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
316
|
+
extension FWNavigatorModule {
|
|
317
|
+
static func stopFloatingPlayer() -> Bool {
|
|
318
|
+
guard let playerInfo = self.getPlayerInfo() else {
|
|
319
|
+
return false
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if playerInfo.mode == .floating {
|
|
323
|
+
do {
|
|
324
|
+
try playerInfo.playerVC.stopPictureInPicture()
|
|
325
|
+
return true
|
|
326
|
+
} catch {
|
|
327
|
+
return false
|
|
185
328
|
}
|
|
329
|
+
} else {
|
|
330
|
+
// current player is in fullscreen player
|
|
331
|
+
return false
|
|
186
332
|
}
|
|
187
333
|
}
|
|
188
334
|
}
|
|
@@ -30,6 +30,10 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
30
30
|
return true
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
override var methodQueue: DispatchQueue {
|
|
34
|
+
return DispatchQueue.main
|
|
35
|
+
}
|
|
36
|
+
|
|
33
37
|
@objc(initializeSDK:)
|
|
34
38
|
func initializeSDK(_ userId: String? = nil) {
|
|
35
39
|
#if DEBUG
|
|
@@ -42,12 +46,10 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
42
46
|
sendEvent(withName: FWEventName.logMessage.rawValue, body: ["message": message])
|
|
43
47
|
#endif
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
FireworkVideoSDK.eventTracking.feedDelegate = self
|
|
50
|
-
}
|
|
49
|
+
FireworkVideoSDK.initializeSDK(delegate: self, userID: userId)
|
|
50
|
+
FireworkVideoSDK.ctaDelegate = self
|
|
51
|
+
FireworkVideoSDK.eventTracking.videoPlaybackDelegate = self
|
|
52
|
+
FireworkVideoSDK.eventTracking.feedDelegate = self
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
@objc(openVideoPlayer:config:)
|
|
@@ -67,14 +69,12 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
67
69
|
feedContentConfig.adBadge = adBadge
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
72
|
+
guard let presentedVC = RCTPresentedViewController() else {
|
|
73
|
+
return
|
|
74
|
+
}
|
|
74
75
|
|
|
75
|
-
|
|
76
|
+
VideoFeedViewController.openVideoPlayer(with: urlString, feedContentConfig, presentedVC) { _ in
|
|
76
77
|
|
|
77
|
-
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -19,11 +19,13 @@ class LiveStreamModule: RCTEventEmitter, FireworkLiveStreamEventDelegate {
|
|
|
19
19
|
return true
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
override var methodQueue: DispatchQueue {
|
|
23
|
+
return DispatchQueue.main
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
@objc
|
|
23
27
|
func initialize() {
|
|
24
|
-
|
|
25
|
-
FireworkVideoSDK.eventTracking.liveStreamEventDelegate = self
|
|
26
|
-
}
|
|
28
|
+
FireworkVideoSDK.eventTracking.liveStreamEventDelegate = self
|
|
27
29
|
}
|
|
28
30
|
func fireworkLiveStreamUserDidJoin(_ liveStream: LiveStreamEventDetails) {
|
|
29
31
|
sendEvent(
|
|
@@ -8,12 +8,17 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
|
|
10
10
|
struct ProductInfoViewConfiguration: Codable {
|
|
11
|
-
var addToCartButton:
|
|
11
|
+
var addToCartButton: AddToCartButtonConfiguration?
|
|
12
|
+
var linkButton: LinkButtonConfiguration?
|
|
12
13
|
|
|
13
|
-
struct
|
|
14
|
+
struct AddToCartButtonConfiguration: Codable {
|
|
14
15
|
var backgroundColor: String?
|
|
15
16
|
var textColor: String?
|
|
16
17
|
var fontSize: Double?
|
|
18
|
+
var iOSFontInfo: FontInfo?
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
struct LinkButtonConfiguration: Codable {
|
|
22
|
+
var isHidden: Bool?
|
|
23
|
+
}
|
|
19
24
|
}
|
|
@@ -13,10 +13,10 @@ _RCT_EXTERN_REMAP_METHOD(init, initialize, NO)
|
|
|
13
13
|
RCT_EXTERN_METHOD(setCartIconVisible:(BOOL)visible)
|
|
14
14
|
RCT_EXTERN_METHOD(setCartItemCount:(int)itemCounts)
|
|
15
15
|
RCT_EXTERN_METHOD(updateVideoProducts:(NSArray *)products cbId:(nonnull NSNumber *)cbId)
|
|
16
|
-
RCT_EXTERN_METHOD(updateProductViewConfig:(NSDictionary *)config cbId:(nonnull NSNumber *)cbId)
|
|
17
16
|
RCT_EXTERN_METHOD(updateAddToCartStatus:(NSString *)res tips:(nullable NSString *)tips cbId:(nonnull NSNumber *)cbId)
|
|
18
17
|
RCT_EXTERN_METHOD(jumpToCartPage:(nonnull NSNumber *)cbId props:(NSDictionary *)props)
|
|
19
18
|
RCT_EXTERN_METHOD(setCustomClickCartIconEnabled:(BOOL)enabled resolver: (RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
19
|
+
RCT_EXTERN_METHOD(setProductInfoViewConfiguration:(NSDictionary *)config)
|
|
20
20
|
RCT_EXTERN_METHOD(clearCallbackId:(nonnull NSNumber *)cbId eventName:(nonnull NSString *)name)
|
|
21
21
|
|
|
22
22
|
@end
|