react-native-firework-sdk 1.4.3 → 1.5.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/ios/Components/AdConfiguration.swift +20 -0
- package/ios/Components/StoryBlock.swift +7 -6
- package/ios/Components/StoryBlockManager.swift +2 -2
- package/ios/Components/VideoFeed.swift +128 -75
- package/ios/Components/VideoFeedConfiguration.swift +4 -3
- package/ios/Components/VideoFeedManager.m +5 -0
- package/ios/Components/VideoFeedManager.swift +9 -10
- package/ios/Components/VideoPlayerConfiguration.swift +1 -1
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +11 -3
- package/ios/Models/NativeToRN/FireworkEventName.swift +25 -25
- package/ios/Models/NativeToRN/FireworkSDK+Json.swift +39 -21
- package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +42 -16
- package/ios/Models/RNToNative/RCTConvert+Shopping.swift +13 -11
- package/ios/Models/RNToNative/RCTConvert+StoryBlock.swift +8 -6
- package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +41 -22
- package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +4 -3
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +55 -19
- package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +7 -3
- package/ios/Modules/FireworkSDKModule/AdBadgeConfiguration.swift +2 -1
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +15 -9
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +79 -28
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +94 -45
- package/ios/Modules/FireworkSDKModule/TrackPurchaseParameters.swift +16 -0
- package/ios/Modules/LiveStream/LiveStreamModule.swift +32 -10
- package/ios/Modules/Shopping/FWCartViewController.swift +14 -12
- package/ios/Modules/Shopping/Product.swift +3 -3
- package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +2 -2
- package/ios/Modules/Shopping/ShoppingModule.swift +147 -100
- package/ios/Utils/String+Color.swift +13 -5
- package/ios/Utils/UIView+Constraints.swift +34 -21
- package/ios/Utils/UIViewController+AttachChild.swift +13 -11
- package/lib/commonjs/FireworkSDK.js +9 -0
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +41 -3
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/AdConfiguration.js +2 -0
- package/lib/commonjs/models/AdConfiguration.js.map +1 -0
- package/lib/commonjs/models/TrackPurchaseParameters.js +2 -0
- package/lib/commonjs/models/TrackPurchaseParameters.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +9 -0
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/components/VideoFeed.js +42 -5
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/AdConfiguration.js +2 -0
- package/lib/module/models/AdConfiguration.js.map +1 -0
- package/lib/module/models/TrackPurchaseParameters.js +2 -0
- package/lib/module/models/TrackPurchaseParameters.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/typescript/FireworkSDK.d.ts +6 -0
- package/lib/typescript/components/VideoFeed.d.ts +6 -0
- package/lib/typescript/index.d.ts +4 -1
- package/lib/typescript/models/AdConfiguration.d.ts +22 -0
- package/lib/typescript/models/TrackPurchaseParameters.d.ts +26 -0
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +4 -0
- package/lib/typescript/modules/FireworkSDKModule.d.ts +2 -0
- package/package.json +1 -1
- package/react-native-firework-sdk.podspec +1 -1
- package/src/FireworkSDK.ts +9 -0
- package/src/components/VideoFeed.tsx +35 -1
- package/src/index.tsx +6 -0
- package/src/models/AdConfiguration.ts +23 -0
- package/src/models/TrackPurchaseParameters.ts +24 -0
- package/src/models/VideoFeedConfiguration.ts +4 -0
- package/src/modules/FireworkSDKModule.ts +2 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AdConfiguration.swift
|
|
3
|
+
// react-native-firework-sdk
|
|
4
|
+
//
|
|
5
|
+
// Created by linjie jiang on 2022/9/18.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
@objc
|
|
11
|
+
public class AdConfiguration: NSObject, Codable {
|
|
12
|
+
var vastAttributes: [VastAttribute]?
|
|
13
|
+
var requiresAds: Bool?
|
|
14
|
+
var adsFetchTimeout: TimeInterval?
|
|
15
|
+
|
|
16
|
+
class VastAttribute: NSObject, Codable {
|
|
17
|
+
var name: String?
|
|
18
|
+
var value: String?
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// Created by linjie jiang on 2022/8/11.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import UIKit
|
|
9
8
|
import FireworkVideo
|
|
9
|
+
import UIKit
|
|
10
10
|
|
|
11
11
|
@objc
|
|
12
12
|
public enum StoryBlockSourceType: Int {
|
|
@@ -14,7 +14,7 @@ public enum StoryBlockSourceType: Int {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
public protocol StoryBlockViewDelegate: AnyObject {
|
|
17
|
-
func storyBlockDidLoadFeed(_ view: StoryBlock)
|
|
17
|
+
func storyBlockDidLoadFeed(_ view: StoryBlock)
|
|
18
18
|
func storyBlock(_ view: StoryBlock, didFailToLoadFeed error: StoryBlockError)
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -74,14 +74,13 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
|
|
|
74
74
|
parentVC.attachChild(storyBlockVC, to: self)
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
|
|
78
77
|
public override func removeFromSuperview() {
|
|
79
78
|
super.removeFromSuperview()
|
|
80
|
-
|
|
79
|
+
|
|
81
80
|
guard let storyBlockVC = self.storyBlockVC else {
|
|
82
81
|
return
|
|
83
82
|
}
|
|
84
|
-
|
|
83
|
+
|
|
85
84
|
storyBlockVC.pause()
|
|
86
85
|
storyBlockVC.detachFromParent()
|
|
87
86
|
self.storyBlockVC = nil
|
|
@@ -95,7 +94,9 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
|
|
|
95
94
|
delegate.storyBlockDidLoadFeed(self)
|
|
96
95
|
}
|
|
97
96
|
|
|
98
|
-
public func storyBlock(
|
|
97
|
+
public func storyBlock(
|
|
98
|
+
_ viewController: StoryBlockViewController, didFailToLoadFeed error: StoryBlockError
|
|
99
|
+
) {
|
|
99
100
|
guard let delegate = self.delegate else {
|
|
100
101
|
return
|
|
101
102
|
}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// Created by linjie jiang on 2022/8/11.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import FireworkVideo
|
|
9
|
+
import Foundation
|
|
10
10
|
|
|
11
11
|
@objc(StoryBlockManager)
|
|
12
12
|
class StoryBlockManager: RCTViewManager, StoryBlockViewDelegate {
|
|
@@ -20,7 +20,7 @@ class StoryBlockManager: RCTViewManager, StoryBlockViewDelegate {
|
|
|
20
20
|
override class func requiresMainQueueSetup() -> Bool {
|
|
21
21
|
return true
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
func storyBlockDidLoadFeed(_ view: StoryBlock) {
|
|
25
25
|
view.onStoryBlockLoadFinished?(nil)
|
|
26
26
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
2
|
+
// VideoFeed.swift
|
|
3
3
|
// react-native-firework-sdk
|
|
4
4
|
//
|
|
5
5
|
// Created by Jeff Zheng on 2021/12/22.
|
|
6
6
|
//
|
|
7
|
-
// FWVideoFeed wrap the VideoFeedViewController class (which need to embed subview throught 'addChildViewController') which can simply embed host view throught 'addSubview'
|
|
8
7
|
|
|
9
|
-
import UIKit
|
|
10
8
|
import FireworkVideo
|
|
9
|
+
import UIKit
|
|
11
10
|
|
|
12
11
|
@objc
|
|
13
12
|
public enum VideoFeedMode: Int {
|
|
@@ -23,8 +22,9 @@ public protocol VideoFeedViewDelegate: AnyObject {
|
|
|
23
22
|
/// Called once after a video feed has been successfully loaded
|
|
24
23
|
func videoFeedDidLoadFeed(_ view: VideoFeed)
|
|
25
24
|
/// Called if the video feed failed to load
|
|
26
|
-
func videoFeed(
|
|
27
|
-
|
|
25
|
+
func videoFeed(
|
|
26
|
+
_ view: VideoFeed,
|
|
27
|
+
didFailToLoadFeed error: VideoFeedError)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
@objc
|
|
@@ -45,18 +45,19 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
@objc public var playerViewConfig: VideoPlayerConfiguration? {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
didSet {
|
|
49
|
+
guard let feedVC = feedVC else {
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
feedVC.viewConfiguration = convertToVideoFeedContentConfiguration()
|
|
53
|
+
}
|
|
54
54
|
}
|
|
55
|
+
@objc public var adConfiguration: AdConfiguration?
|
|
55
56
|
@objc var onVideoFeedLoadFinished: RCTBubblingEventBlock?
|
|
56
|
-
// @objc var onVideoFeedClick: RCTBubblingEventBlock?
|
|
57
|
-
|
|
57
|
+
// @objc var onVideoFeedClick: RCTBubblingEventBlock?
|
|
58
|
+
|
|
58
59
|
public weak var delegate: VideoFeedViewDelegate?
|
|
59
|
-
|
|
60
|
+
|
|
60
61
|
private var feedVC: VideoFeedViewController?
|
|
61
62
|
private var source: VideoFeedContentSource {
|
|
62
63
|
switch sourceType {
|
|
@@ -80,22 +81,19 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
80
81
|
case .row:
|
|
81
82
|
let layout = VideoFeedHorizontalLayout()
|
|
82
83
|
resultLayout = layout
|
|
83
|
-
break
|
|
84
84
|
case .column:
|
|
85
85
|
let layout = VideoFeedGridLayout()
|
|
86
86
|
layout.numberOfColumns = 1
|
|
87
87
|
resultLayout = layout
|
|
88
|
-
break
|
|
89
88
|
case .grid:
|
|
90
89
|
let layout = VideoFeedGridLayout()
|
|
91
90
|
if let gridColumns = feedViewConfig?.gridColumns,
|
|
92
|
-
|
|
91
|
+
gridColumns > 0 {
|
|
93
92
|
layout.numberOfColumns = gridColumns
|
|
94
93
|
} else {
|
|
95
94
|
layout.numberOfColumns = 2
|
|
96
95
|
}
|
|
97
96
|
resultLayout = layout
|
|
98
|
-
break
|
|
99
97
|
}
|
|
100
98
|
if let config = feedViewConfig {
|
|
101
99
|
if let aspectRatio = config.aspectRatio {
|
|
@@ -127,13 +125,38 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
127
125
|
|
|
128
126
|
return resultLayout ?? VideoFeedHorizontalLayout()
|
|
129
127
|
}
|
|
130
|
-
|
|
128
|
+
|
|
129
|
+
private var fireworkVideoAdConfiguration: FireworkVideo.AdConfiguration? {
|
|
130
|
+
guard let feedAdConfiguration = adConfiguration else {
|
|
131
|
+
return nil
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
var resultAdConfiguration = FireworkVideo.AdConfiguration()
|
|
135
|
+
if let requiresAds = feedAdConfiguration.requiresAds {
|
|
136
|
+
resultAdConfiguration.requiresAds = requiresAds
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if let adsFetchTimeout = feedAdConfiguration.adsFetchTimeout {
|
|
140
|
+
resultAdConfiguration.adsFetchTimeout = adsFetchTimeout
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if let vastAttributes = feedAdConfiguration.vastAttributes {
|
|
144
|
+
resultAdConfiguration.vastAttributes = vastAttributes.map({ attribute in
|
|
145
|
+
return URLQueryItem(name: attribute.name ?? "", value: attribute.value ?? "")
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return resultAdConfiguration
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private var pipController: PictureInPictureController?
|
|
153
|
+
|
|
131
154
|
public override func layoutSubviews() {
|
|
132
155
|
super.layoutSubviews()
|
|
133
|
-
|
|
156
|
+
|
|
134
157
|
embed()
|
|
135
158
|
}
|
|
136
|
-
|
|
159
|
+
|
|
137
160
|
private func embed() {
|
|
138
161
|
guard let parentVC = parentViewController else {
|
|
139
162
|
return
|
|
@@ -141,11 +164,24 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
141
164
|
guard self.feedVC == nil else {
|
|
142
165
|
return
|
|
143
166
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
167
|
+
|
|
168
|
+
var resultFeedVC: VideoFeedViewController?
|
|
169
|
+
if let fireworkVideoAdConfiguration = fireworkVideoAdConfiguration {
|
|
170
|
+
resultFeedVC = VideoFeedViewController(
|
|
171
|
+
layout: videoFeedLayout,
|
|
172
|
+
source: source,
|
|
173
|
+
adConfiguration: fireworkVideoAdConfiguration
|
|
174
|
+
)
|
|
175
|
+
} else {
|
|
176
|
+
resultFeedVC = VideoFeedViewController(
|
|
177
|
+
layout: videoFeedLayout,
|
|
178
|
+
source: source
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
guard let feedVC = resultFeedVC else {
|
|
183
|
+
return
|
|
184
|
+
}
|
|
149
185
|
|
|
150
186
|
var viewConfiguration = convertToVideoFeedContentConfiguration()
|
|
151
187
|
if viewConfiguration.itemView.autoplay.isEnabled {
|
|
@@ -160,24 +196,30 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
160
196
|
} else {
|
|
161
197
|
feedVC.viewConfiguration = viewConfiguration
|
|
162
198
|
}
|
|
199
|
+
|
|
200
|
+
if feedViewConfig?.enablePictureInPicture == true {
|
|
201
|
+
self.pipController = PictureInPictureController(videoFeed: feedVC)
|
|
202
|
+
} else {
|
|
203
|
+
self.pipController = nil
|
|
204
|
+
}
|
|
205
|
+
|
|
163
206
|
feedVC.delegate = self
|
|
164
207
|
self.feedVC = feedVC
|
|
165
|
-
|
|
166
208
|
parentVC.attachChild(feedVC, to: self)
|
|
167
209
|
}
|
|
168
|
-
|
|
210
|
+
|
|
169
211
|
public override func removeFromSuperview() {
|
|
170
212
|
super.removeFromSuperview()
|
|
171
|
-
|
|
213
|
+
self.pipController = nil
|
|
214
|
+
|
|
172
215
|
guard let feedVC = self.feedVC else {
|
|
173
216
|
return
|
|
174
217
|
}
|
|
175
218
|
|
|
176
|
-
|
|
177
219
|
feedVC.detachFromParent()
|
|
178
220
|
self.feedVC = nil
|
|
179
221
|
}
|
|
180
|
-
|
|
222
|
+
|
|
181
223
|
@objc
|
|
182
224
|
public func refresh() {
|
|
183
225
|
guard let feedVC = self.feedVC else {
|
|
@@ -185,16 +227,18 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
185
227
|
}
|
|
186
228
|
feedVC.refresh()
|
|
187
229
|
}
|
|
188
|
-
|
|
189
|
-
//MARK:
|
|
230
|
+
|
|
231
|
+
// MARK: VideoFeedViewControllerDelegate
|
|
190
232
|
public func videoFeedDidLoadFeed(_ viewController: VideoFeedViewController) {
|
|
191
233
|
guard let delegate = self.delegate else {
|
|
192
234
|
return
|
|
193
235
|
}
|
|
194
236
|
delegate.videoFeedDidLoadFeed(self)
|
|
195
237
|
}
|
|
196
|
-
|
|
197
|
-
public func videoFeed(
|
|
238
|
+
|
|
239
|
+
public func videoFeed(
|
|
240
|
+
_ viewController: VideoFeedViewController, didFailToLoadFeed error: VideoFeedError
|
|
241
|
+
) {
|
|
198
242
|
guard let delegate = self.delegate else {
|
|
199
243
|
return
|
|
200
244
|
}
|
|
@@ -203,47 +247,19 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
|
|
|
203
247
|
}
|
|
204
248
|
|
|
205
249
|
extension VideoFeed {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
videoConfig.itemView.titleLayoutConfiguration.titlePosition = .nested
|
|
211
|
-
|
|
212
|
-
let vfcConfig = VideoFeed.convertToVideoFeedItemContentConfiguration(feedViewConfig)
|
|
213
|
-
let vpcConfig = VideoFeed.convertToVideoPlayerContentConfiguration(playerViewConfig)
|
|
214
|
-
if let vfcConfig = vfcConfig {
|
|
215
|
-
videoConfig.itemView = vfcConfig
|
|
216
|
-
}
|
|
217
|
-
if let vpcConfig = vpcConfig {
|
|
218
|
-
videoConfig.playerView = vpcConfig
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if let backgroundColor = feedViewConfig?.backgroundColor {
|
|
222
|
-
videoConfig.backgroundColor = backgroundColor.uicolor()
|
|
223
|
-
}
|
|
224
|
-
if let shareBaseUrl = gShareBaseURL {
|
|
225
|
-
videoConfig.playerView.shareButton.behavior.baseURL = URL(string:shareBaseUrl)
|
|
226
|
-
}
|
|
227
|
-
if let adBadge = FireworkSDKModule.convertToFWAdBadgeConfiguration(gAdBadgeConfiguration) {
|
|
228
|
-
videoConfig.adBadge = adBadge
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
//set a value different from default value to compatible with FireworkVideo SDK misalign bug
|
|
232
|
-
videoConfig.itemView.titleLayoutConfiguration.insets = UIEdgeInsets(top: 7, left: 7, bottom: 7, right: 7)
|
|
233
|
-
|
|
234
|
-
return videoConfig
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
private static func convertToVideoFeedItemContentConfiguration(_ config: VideoFeedConfiguration?) -> VideoFeedItemContentConfiguration? {
|
|
250
|
+
// swiftlint:disable:next cyclomatic_complexity
|
|
251
|
+
private static func convertToVideoFeedItemContentConfiguration(
|
|
252
|
+
_ config: VideoFeedConfiguration?
|
|
253
|
+
) -> VideoFeedItemContentConfiguration? {
|
|
238
254
|
guard let config = config else {
|
|
239
255
|
return nil
|
|
240
256
|
}
|
|
241
|
-
|
|
257
|
+
|
|
242
258
|
var vfcConfig = VideoFeedItemContentConfiguration()
|
|
243
|
-
//set default value so that behavior will the same with Android
|
|
259
|
+
// set default value so that behavior will the same with Android
|
|
244
260
|
vfcConfig.title.isHidden = false
|
|
245
261
|
vfcConfig.titleLayoutConfiguration.titlePosition = .nested
|
|
246
|
-
|
|
262
|
+
|
|
247
263
|
if let cornerRadius = config.cornerRadius {
|
|
248
264
|
vfcConfig.cornerRadius = cornerRadius
|
|
249
265
|
}
|
|
@@ -284,15 +300,18 @@ extension VideoFeed {
|
|
|
284
300
|
if let enableAutoplay = config.enableAutoplay {
|
|
285
301
|
vfcConfig.autoplay.isEnabled = enableAutoplay
|
|
286
302
|
}
|
|
287
|
-
|
|
303
|
+
|
|
288
304
|
return vfcConfig
|
|
289
305
|
}
|
|
290
|
-
|
|
291
|
-
|
|
306
|
+
|
|
307
|
+
// swiftlint:disable:next cyclomatic_complexity
|
|
308
|
+
private static func convertToVideoPlayerContentConfiguration(
|
|
309
|
+
_ config: VideoPlayerConfiguration?
|
|
310
|
+
) -> VideoPlayerContentConfiguration? {
|
|
292
311
|
guard let config = config else {
|
|
293
312
|
return nil
|
|
294
313
|
}
|
|
295
|
-
|
|
314
|
+
|
|
296
315
|
var vpcConfig = VideoPlayerContentConfiguration()
|
|
297
316
|
if let playerStyle = config.playerStyle {
|
|
298
317
|
switch playerStyle {
|
|
@@ -337,11 +356,45 @@ extension VideoFeed {
|
|
|
337
356
|
if let showBranding = config.showBranding {
|
|
338
357
|
vpcConfig.videoDetail.fireworkAttribution.isHidden = !showBranding
|
|
339
358
|
}
|
|
340
|
-
|
|
359
|
+
|
|
341
360
|
return vpcConfig
|
|
342
361
|
}
|
|
362
|
+
|
|
363
|
+
private func convertToVideoFeedContentConfiguration() -> VideoFeedContentConfiguration {
|
|
364
|
+
var videoConfig = VideoFeedContentConfiguration()
|
|
365
|
+
// default value so that behavior will the same with Android
|
|
366
|
+
videoConfig.itemView.title.isHidden = false
|
|
367
|
+
videoConfig.itemView.titleLayoutConfiguration.titlePosition = .nested
|
|
368
|
+
|
|
369
|
+
let vfcConfig = VideoFeed.convertToVideoFeedItemContentConfiguration(feedViewConfig)
|
|
370
|
+
let vpcConfig = VideoFeed.convertToVideoPlayerContentConfiguration(playerViewConfig)
|
|
371
|
+
if let vfcConfig = vfcConfig {
|
|
372
|
+
videoConfig.itemView = vfcConfig
|
|
373
|
+
}
|
|
374
|
+
if let vpcConfig = vpcConfig {
|
|
375
|
+
videoConfig.playerView = vpcConfig
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if let backgroundColor = feedViewConfig?.backgroundColor {
|
|
379
|
+
videoConfig.backgroundColor = backgroundColor.uicolor()
|
|
380
|
+
}
|
|
381
|
+
if let shareBaseUrl = gShareBaseURL {
|
|
382
|
+
videoConfig.playerView.shareButton.behavior.baseURL = URL(string: shareBaseUrl)
|
|
383
|
+
}
|
|
384
|
+
if let adBadge = FireworkSDKModule.convertToFWAdBadgeConfiguration(gAdBadgeConfiguration) {
|
|
385
|
+
videoConfig.adBadge = adBadge
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// set a value different from default value to compatible with FireworkVideo SDK misalign bug
|
|
389
|
+
videoConfig.itemView.titleLayoutConfiguration.insets = UIEdgeInsets(
|
|
390
|
+
top: 7, left: 7, bottom: 7, right: 7)
|
|
391
|
+
|
|
392
|
+
return videoConfig
|
|
393
|
+
}
|
|
343
394
|
}
|
|
344
395
|
|
|
396
|
+
// swiftlint:disable file_length
|
|
397
|
+
|
|
345
398
|
extension VideoPlayerConfiguration.VideoLaunchBehavior {
|
|
346
399
|
func behavior() -> VideoPlayerContentConfiguration.VideoLaunchBehavior {
|
|
347
400
|
switch self {
|
|
@@ -17,11 +17,12 @@ public class VideoFeedConfiguration: NSObject, Codable {
|
|
|
17
17
|
var showSponsored: Bool?
|
|
18
18
|
var showAdBadge: Bool?
|
|
19
19
|
var aspectRatio: Double?
|
|
20
|
-
var contentPadding: VideoFeedContentPadding
|
|
20
|
+
var contentPadding: VideoFeedContentPadding?
|
|
21
21
|
var itemSpacing: Double?
|
|
22
22
|
var enableAutoplay: Bool?
|
|
23
23
|
var gridColumns: Int?
|
|
24
|
-
|
|
24
|
+
var enablePictureInPicture: Bool?
|
|
25
|
+
|
|
25
26
|
class VideoFeedTitleConfiguration: NSObject, Codable {
|
|
26
27
|
public var hidden: Bool?
|
|
27
28
|
public var textColor: String?
|
|
@@ -39,7 +40,7 @@ public class VideoFeedConfiguration: NSObject, Codable {
|
|
|
39
40
|
public var bottom: Double?
|
|
40
41
|
public var left: Double?
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
+
|
|
43
44
|
enum VideoFeedTitlePosition: String, Codable {
|
|
44
45
|
case stacked, nested
|
|
45
46
|
}
|
|
@@ -39,6 +39,11 @@ RCT_CUSTOM_VIEW_PROPERTY(videoPlayerConfiguration, VideoPlayerConfiguration, Vid
|
|
|
39
39
|
view.playerViewConfig = config;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
RCT_CUSTOM_VIEW_PROPERTY(adConfiguration, AdConfiguration, VideoFeed) {
|
|
43
|
+
AdConfiguration *config = [RCTConvert adConfiguration:json];
|
|
44
|
+
view.adConfiguration = config;
|
|
45
|
+
}
|
|
46
|
+
|
|
42
47
|
RCT_EXPORT_VIEW_PROPERTY(onVideoFeedLoadFinished, RCTBubblingEventBlock)
|
|
43
48
|
//RCT_EXPORT_VIEW_PROPERTY(onVideoFeedClick, RCTBubblingEventBlock)
|
|
44
49
|
|
|
@@ -6,12 +6,11 @@
|
|
|
6
6
|
//
|
|
7
7
|
// The FWVideoFeedManager manipulate FWVideoFeed view,need expose to JavaScript in Objective-C
|
|
8
8
|
|
|
9
|
-
import Foundation
|
|
10
9
|
import FireworkVideo
|
|
10
|
+
import Foundation
|
|
11
11
|
|
|
12
12
|
@objc(VideoFeedManager)
|
|
13
13
|
class VideoFeedManager: RCTViewManager, VideoFeedViewDelegate {
|
|
14
|
-
|
|
15
14
|
|
|
16
15
|
override func view() -> UIView! {
|
|
17
16
|
let videFeed = VideoFeed()
|
|
@@ -19,22 +18,22 @@ class VideoFeedManager: RCTViewManager, VideoFeedViewDelegate {
|
|
|
19
18
|
|
|
20
19
|
return videFeed
|
|
21
20
|
}
|
|
22
|
-
|
|
21
|
+
|
|
23
22
|
override class func requiresMainQueueSetup() -> Bool {
|
|
24
23
|
return true
|
|
25
24
|
}
|
|
26
|
-
|
|
25
|
+
|
|
27
26
|
// MARK: - FWVideoFeedViewDelegate
|
|
28
27
|
func videoFeedDidLoadFeed(_ view: VideoFeed) {
|
|
29
28
|
view.onVideoFeedLoadFinished?(nil)
|
|
30
29
|
}
|
|
31
|
-
|
|
30
|
+
|
|
32
31
|
func videoFeed(_ view: VideoFeed, didFailToLoadFeed error: VideoFeedError) {
|
|
33
32
|
view.onVideoFeedLoadFinished?(error.jsObject)
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
// // MARK: - FireworkVideoFeedDelegate
|
|
37
|
-
// func fireworkVideoDidTapVideoThumbnail(_ eventDetails: FeedEventDetails) {
|
|
38
|
-
// view.onVideoFeedClick?(eventDetails.jsObject)
|
|
39
|
-
// }
|
|
34
|
+
|
|
35
|
+
// // MARK: - FireworkVideoFeedDelegate
|
|
36
|
+
// func fireworkVideoDidTapVideoThumbnail(_ eventDetails: FeedEventDetails) {
|
|
37
|
+
// view.onVideoFeedClick?(eventDetails.jsObject)
|
|
38
|
+
// }
|
|
40
39
|
}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
objects = {
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
|
+
89335CA628E29D3A00B84BC7 /* TrackPurchaseParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89335CA528E29D3A00B84BC7 /* TrackPurchaseParameters.swift */; };
|
|
11
|
+
896A8EB928E3DCCA007E51F8 /* AdConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 896A8EB828E3DCCA007E51F8 /* AdConfiguration.swift */; };
|
|
10
12
|
8975235E2817DEEE0070EBB6 /* VideoFeedManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 897523592817DEEE0070EBB6 /* VideoFeedManager.swift */; };
|
|
11
13
|
8975235F2817DEEE0070EBB6 /* VideoFeedConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8975235A2817DEEE0070EBB6 /* VideoFeedConfiguration.swift */; };
|
|
12
14
|
897523602817DEEE0070EBB6 /* VideoFeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8975235B2817DEEE0070EBB6 /* VideoFeed.swift */; };
|
|
@@ -59,6 +61,8 @@
|
|
|
59
61
|
/* Begin PBXFileReference section */
|
|
60
62
|
134814201AA4EA6300B7C361 /* libFireworkSdk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFireworkSdk.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
61
63
|
1F6F718A2771B48100224AF3 /* FireworkSdk-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "FireworkSdk-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
64
|
+
89335CA528E29D3A00B84BC7 /* TrackPurchaseParameters.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrackPurchaseParameters.swift; sourceTree = "<group>"; };
|
|
65
|
+
896A8EB828E3DCCA007E51F8 /* AdConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdConfiguration.swift; sourceTree = "<group>"; };
|
|
62
66
|
897523592817DEEE0070EBB6 /* VideoFeedManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoFeedManager.swift; sourceTree = "<group>"; };
|
|
63
67
|
8975235A2817DEEE0070EBB6 /* VideoFeedConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoFeedConfiguration.swift; sourceTree = "<group>"; };
|
|
64
68
|
8975235B2817DEEE0070EBB6 /* VideoFeed.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoFeed.swift; sourceTree = "<group>"; };
|
|
@@ -133,14 +137,15 @@
|
|
|
133
137
|
897523582817DEEE0070EBB6 /* Components */ = {
|
|
134
138
|
isa = PBXGroup;
|
|
135
139
|
children = (
|
|
140
|
+
896A8EB828E3DCCA007E51F8 /* AdConfiguration.swift */,
|
|
136
141
|
89DF27DA28A53A77003F3CCB /* StoryBlock.swift */,
|
|
137
142
|
89DF27DC28A53A77003F3CCB /* StoryBlockManager.m */,
|
|
138
143
|
89DF27DB28A53A77003F3CCB /* StoryBlockManager.swift */,
|
|
139
|
-
897523592817DEEE0070EBB6 /* VideoFeedManager.swift */,
|
|
140
|
-
8975235A2817DEEE0070EBB6 /* VideoFeedConfiguration.swift */,
|
|
141
144
|
8975235B2817DEEE0070EBB6 /* VideoFeed.swift */,
|
|
142
|
-
|
|
145
|
+
8975235A2817DEEE0070EBB6 /* VideoFeedConfiguration.swift */,
|
|
143
146
|
8975235D2817DEEE0070EBB6 /* VideoFeedManager.m */,
|
|
147
|
+
897523592817DEEE0070EBB6 /* VideoFeedManager.swift */,
|
|
148
|
+
8975235C2817DEEE0070EBB6 /* VideoPlayerConfiguration.swift */,
|
|
144
149
|
);
|
|
145
150
|
path = Components;
|
|
146
151
|
sourceTree = "<group>";
|
|
@@ -224,6 +229,7 @@
|
|
|
224
229
|
8975237D2817DEF80070EBB6 /* FireworkSDKModule */ = {
|
|
225
230
|
isa = PBXGroup;
|
|
226
231
|
children = (
|
|
232
|
+
89335CA528E29D3A00B84BC7 /* TrackPurchaseParameters.swift */,
|
|
227
233
|
8975237F2817DEF80070EBB6 /* FireworkSDKModule+EventTracking.swift */,
|
|
228
234
|
897523802817DEF80070EBB6 /* FireworkSDKModule.swift */,
|
|
229
235
|
897523812817DEF80070EBB6 /* AdBadgeConfiguration.swift */,
|
|
@@ -303,6 +309,7 @@
|
|
|
303
309
|
8977F48528C99340008CC888 /* UINavigationController+FWSwizzle.m in Sources */,
|
|
304
310
|
8975239B2817DEF80070EBB6 /* FireworkSDKModule.swift in Sources */,
|
|
305
311
|
897523952817DEF80070EBB6 /* ShoppingModule.m in Sources */,
|
|
312
|
+
89335CA628E29D3A00B84BC7 /* TrackPurchaseParameters.swift in Sources */,
|
|
306
313
|
897523A02817DEF80070EBB6 /* LiveStreamModule.m in Sources */,
|
|
307
314
|
8975238E2817DEF80070EBB6 /* FireworkSDK+Json.swift in Sources */,
|
|
308
315
|
89DF27E128A53A89003F3CCB /* RCTConvert+StoryBlock.swift in Sources */,
|
|
@@ -317,6 +324,7 @@
|
|
|
317
324
|
897523902817DEF80070EBB6 /* FWNavigatorProtocol.swift in Sources */,
|
|
318
325
|
897523882817DEF80070EBB6 /* UIView+Constraints.swift in Sources */,
|
|
319
326
|
897523982817DEF80070EBB6 /* ShoppingModule.swift in Sources */,
|
|
327
|
+
896A8EB928E3DCCA007E51F8 /* AdConfiguration.swift in Sources */,
|
|
320
328
|
8975239C2817DEF80070EBB6 /* AdBadgeConfiguration.swift in Sources */,
|
|
321
329
|
897523942817DEF80070EBB6 /* FWCartViewController.swift in Sources */,
|
|
322
330
|
8975239A2817DEF80070EBB6 /* FireworkSDKModule+EventTracking.swift in Sources */,
|
|
@@ -9,34 +9,34 @@ import Foundation
|
|
|
9
9
|
|
|
10
10
|
/// Video event
|
|
11
11
|
enum FWEventName: String, CaseIterable {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
case sdkInit = "fw:sdk-init"
|
|
13
|
+
case customCTAClick = "fw:custom-cta-click"
|
|
14
|
+
case videoPlayback = "fw:video-playback"
|
|
15
|
+
case videoFeedClick = "fw:video-feed-click"
|
|
16
|
+
case shareBaseURLUpdated = "fw:share-base-url-updated" // emitted in JS side
|
|
17
|
+
case adBadgeConfigurationUpdated = "fw:ad-badge-configuration-updated" // emitted in JS side
|
|
18
|
+
case logMessage = "fw:log-message"
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
enum VideoPlaybackSubEventName: String {
|
|
22
|
-
case
|
|
23
|
-
case
|
|
24
|
-
case
|
|
25
|
-
case
|
|
26
|
-
case
|
|
27
|
-
case
|
|
28
|
-
case
|
|
29
|
-
case
|
|
30
|
-
case
|
|
22
|
+
case impression = "fw:video:impression"
|
|
23
|
+
case start = "fw:video:start"
|
|
24
|
+
case firstQuartile = "fw:video:first-quartile"
|
|
25
|
+
case midpoint = "fw:video:midpoint"
|
|
26
|
+
case thirdQuartile = "fw:video:third-quartile"
|
|
27
|
+
case complete = "fw:video:complete"
|
|
28
|
+
case adEnd = "fw:video:ad-end"
|
|
29
|
+
case clickCTA = "fw:video:click-cta"
|
|
30
|
+
case clickShare = "fw:video:click-share"
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/// Shopping event
|
|
34
34
|
enum ShoppingEventName: String, CaseIterable {
|
|
35
|
-
case
|
|
36
|
-
case
|
|
37
|
-
case
|
|
38
|
-
case
|
|
39
|
-
case
|
|
35
|
+
case updateProductDetails = "fw:shopping:update-product-details"
|
|
36
|
+
case willDisplayProduct = "fw:shopping:will-display-product"
|
|
37
|
+
case addToCart = "fw:shopping:add-to-cart"
|
|
38
|
+
case clickCartIcon = "fw:shopping:click-cart-icon"
|
|
39
|
+
case logMessage = "fw:log-message"
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/// Live stream event
|
|
@@ -46,11 +46,11 @@ enum LiveStreamEventName: String, CaseIterable {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
enum LiveStreamSubEventName: String {
|
|
49
|
-
case
|
|
50
|
-
case
|
|
51
|
-
case
|
|
49
|
+
case userDidjoin = "fw:livestream:user-join"
|
|
50
|
+
case userDidLeave = "fw:livestream:user-leave"
|
|
51
|
+
case userSendLike = "fw:livestream:user-send-like"
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
enum LiveStreamChatSubEventName: String {
|
|
55
|
-
case
|
|
55
|
+
case userSendChat = "fw:livestream:user-send-chat"
|
|
56
56
|
}
|