react-native-firework-sdk 1.4.3 → 1.5.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.
Files changed (69) hide show
  1. package/android/build.gradle +1 -1
  2. package/ios/Components/AdConfiguration.swift +20 -0
  3. package/ios/Components/StoryBlock.swift +7 -6
  4. package/ios/Components/StoryBlockManager.swift +2 -2
  5. package/ios/Components/VideoFeed.swift +128 -75
  6. package/ios/Components/VideoFeedConfiguration.swift +4 -3
  7. package/ios/Components/VideoFeedManager.m +5 -0
  8. package/ios/Components/VideoFeedManager.swift +9 -10
  9. package/ios/Components/VideoPlayerConfiguration.swift +1 -1
  10. package/ios/FireworkSdk.xcodeproj/project.pbxproj +11 -3
  11. package/ios/Models/NativeToRN/FireworkEventName.swift +25 -25
  12. package/ios/Models/NativeToRN/FireworkSDK+Json.swift +39 -21
  13. package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +42 -16
  14. package/ios/Models/RNToNative/RCTConvert+Shopping.swift +13 -11
  15. package/ios/Models/RNToNative/RCTConvert+StoryBlock.swift +8 -6
  16. package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +41 -22
  17. package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +4 -3
  18. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +55 -19
  19. package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +7 -3
  20. package/ios/Modules/FireworkSDKModule/AdBadgeConfiguration.swift +2 -1
  21. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +15 -9
  22. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +79 -28
  23. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
  24. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +94 -45
  25. package/ios/Modules/FireworkSDKModule/TrackPurchaseParameters.swift +16 -0
  26. package/ios/Modules/LiveStream/LiveStreamModule.swift +32 -10
  27. package/ios/Modules/Shopping/FWCartViewController.swift +14 -12
  28. package/ios/Modules/Shopping/Product.swift +3 -3
  29. package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +2 -2
  30. package/ios/Modules/Shopping/ShoppingModule.swift +147 -100
  31. package/ios/Utils/String+Color.swift +13 -5
  32. package/ios/Utils/UIView+Constraints.swift +34 -21
  33. package/ios/Utils/UIViewController+AttachChild.swift +13 -11
  34. package/lib/commonjs/FireworkSDK.js +9 -0
  35. package/lib/commonjs/FireworkSDK.js.map +1 -1
  36. package/lib/commonjs/components/VideoFeed.js +41 -3
  37. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  38. package/lib/commonjs/index.js.map +1 -1
  39. package/lib/commonjs/models/AdConfiguration.js +2 -0
  40. package/lib/commonjs/models/AdConfiguration.js.map +1 -0
  41. package/lib/commonjs/models/TrackPurchaseParameters.js +2 -0
  42. package/lib/commonjs/models/TrackPurchaseParameters.js.map +1 -0
  43. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  44. package/lib/module/FireworkSDK.js +9 -0
  45. package/lib/module/FireworkSDK.js.map +1 -1
  46. package/lib/module/components/VideoFeed.js +42 -5
  47. package/lib/module/components/VideoFeed.js.map +1 -1
  48. package/lib/module/index.js.map +1 -1
  49. package/lib/module/models/AdConfiguration.js +2 -0
  50. package/lib/module/models/AdConfiguration.js.map +1 -0
  51. package/lib/module/models/TrackPurchaseParameters.js +2 -0
  52. package/lib/module/models/TrackPurchaseParameters.js.map +1 -0
  53. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  54. package/lib/typescript/FireworkSDK.d.ts +6 -0
  55. package/lib/typescript/components/VideoFeed.d.ts +6 -0
  56. package/lib/typescript/index.d.ts +4 -1
  57. package/lib/typescript/models/AdConfiguration.d.ts +22 -0
  58. package/lib/typescript/models/TrackPurchaseParameters.d.ts +26 -0
  59. package/lib/typescript/models/VideoFeedConfiguration.d.ts +4 -0
  60. package/lib/typescript/modules/FireworkSDKModule.d.ts +2 -0
  61. package/package.json +1 -1
  62. package/react-native-firework-sdk.podspec +1 -1
  63. package/src/FireworkSDK.ts +9 -0
  64. package/src/components/VideoFeed.tsx +35 -1
  65. package/src/index.tsx +6 -0
  66. package/src/models/AdConfiguration.ts +23 -0
  67. package/src/models/TrackPurchaseParameters.ts +24 -0
  68. package/src/models/VideoFeedConfiguration.ts +4 -0
  69. package/src/modules/FireworkSDKModule.ts +2 -0
@@ -167,7 +167,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
167
167
 
168
168
  dependencies {
169
169
 
170
- def firework_sdk_version = 'v5.14.3'
170
+ def firework_sdk_version = 'v5.14.7'
171
171
  implementation "com.github.loopsocial:firework_sdk:$firework_sdk_version"
172
172
 
173
173
  // noinspection GradleDynamicVersion
@@ -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(_ viewController: StoryBlockViewController, didFailToLoadFeed error: StoryBlockError) {
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
- // FWVideoFeed.swift
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(_ view: VideoFeed,
27
- didFailToLoadFeed error: VideoFeedError)
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
- didSet {
49
- guard let feedVC = feedVC else {
50
- return
51
- }
52
- feedVC.viewConfiguration = convertToVideoFeedContentConfiguration()
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
- gridColumns > 0 {
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
- let feedVC = VideoFeedViewController(
146
- layout: videoFeedLayout,
147
- source: source
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: - VideoFeedViewControllerDelegate
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(_ viewController: VideoFeedViewController, didFailToLoadFeed error: VideoFeedError) {
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
- private func convertToVideoFeedContentConfiguration() -> VideoFeedContentConfiguration {
207
- var videoConfig = VideoFeedContentConfiguration()
208
- //set default value so that behavior will the same with Android
209
- videoConfig.itemView.title.isHidden = false
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
- private static func convertToVideoPlayerContentConfiguration(_ config: VideoPlayerConfiguration?) -> VideoPlayerContentConfiguration? {
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
  }
@@ -31,7 +31,7 @@ public class VideoPlayerConfiguration: NSObject, Codable {
31
31
  var textColor: String?
32
32
  var fontSize: Double?
33
33
  }
34
-
34
+
35
35
  public enum VideoLaunchBehavior: String, Codable {
36
36
  case `default`, muteOnFirstLaunch
37
37
  }
@@ -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
- 8975235C2817DEEE0070EBB6 /* VideoPlayerConfiguration.swift */,
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
- 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"
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 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"
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 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"
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 UserDidjoin = "fw:livestream:user-join"
50
- case UserDidLeave = "fw:livestream:user-leave"
51
- case UserSendLike = "fw:livestream:user-send-like"
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 UserSendChat = "fw:livestream:user-send-chat"
55
+ case userSendChat = "fw:livestream:user-send-chat"
56
56
  }