react-native-firework-sdk 2.10.1 → 2.11.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 (172) hide show
  1. package/android/gradle.properties +1 -1
  2. package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +20 -1
  3. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +4 -0
  4. package/android/src/main/java/com/fireworksdk/bridge/models/FWCountdownTimerConfigurationModel.kt +8 -0
  5. package/android/src/main/java/com/fireworksdk/bridge/models/FWCountdownTimerConfigurationModelDeserializer.kt +22 -0
  6. package/android/src/main/java/com/fireworksdk/bridge/models/FWCountdownTimerConfigurationModelSerializer.kt +18 -0
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModel.kt +2 -2
  8. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModel.kt +0 -1
  9. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +0 -3
  10. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelSerializer.kt +0 -2
  11. package/android/src/main/java/com/fireworksdk/bridge/models/FWSdkInitResultModel.kt +6 -0
  12. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModel.kt +9 -0
  13. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelDeserializer.kt +45 -0
  14. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelSerializer.kt +34 -0
  15. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -0
  16. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +1 -0
  17. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +3 -1
  18. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +7 -1
  19. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +4 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModel.kt +8 -0
  21. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelDeserializer.kt +23 -0
  22. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelSerializer.kt +18 -0
  23. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWAppearanceMode.kt +18 -0
  24. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +2 -0
  25. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoPlayerLogoOption.kt +19 -0
  26. package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +103 -0
  27. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +12 -0
  28. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +8 -0
  29. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +2 -0
  30. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +22 -9
  31. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +74 -122
  32. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +34 -9
  33. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +13 -0
  34. package/android/src/main/java/com/fireworksdk/bridge/utils/FWFragmentUtil.kt +3 -3
  35. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +5 -2
  36. package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +64 -0
  37. package/ios/Components/CountdownTimerConfiguration.swift +43 -0
  38. package/ios/Components/ReplayBadgeConfiguration.swift +12 -0
  39. package/ios/Components/StoryBlock.swift +37 -0
  40. package/ios/Components/StoryBlockConfiguration.swift +2 -0
  41. package/ios/Components/StoryBlockManager.m +24 -0
  42. package/ios/Components/StoryBlockManager.swift +6 -3
  43. package/ios/Components/VideoFeed.swift +23 -3
  44. package/ios/Components/VideoFeedConfiguration.swift +1 -0
  45. package/ios/Components/VideoFeedManager.m +4 -1
  46. package/ios/Components/VideoFeedManager.swift +6 -3
  47. package/ios/Components/VideoPlayerConfiguration.swift +2 -0
  48. package/ios/FWReactNativeSDK.swift +14 -0
  49. package/ios/FireworkSdk.xcodeproj/project.pbxproj +16 -0
  50. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +17 -15
  51. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +1 -11
  52. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
  53. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +80 -81
  54. package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +9 -5
  55. package/ios/Modules/Shopping/ShoppingModule.swift +10 -74
  56. package/lib/commonjs/FireworkSDK.js +30 -25
  57. package/lib/commonjs/FireworkSDK.js.map +1 -1
  58. package/lib/commonjs/VideoShopping.js +6 -12
  59. package/lib/commonjs/VideoShopping.js.map +1 -1
  60. package/lib/commonjs/components/StoryBlock.js +56 -3
  61. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  62. package/lib/commonjs/components/VideoFeed.js +48 -4
  63. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  64. package/lib/commonjs/index.js +7 -7
  65. package/lib/commonjs/index.js.map +1 -1
  66. package/lib/commonjs/models/CountdownTimerConfiguration.js +2 -0
  67. package/lib/commonjs/models/CountdownTimerConfiguration.js.map +1 -0
  68. package/lib/commonjs/models/FWNativeErrorAction.js +14 -0
  69. package/lib/commonjs/models/FWNativeErrorAction.js.map +1 -0
  70. package/lib/commonjs/models/ReplayBadgeConfiguration.js +2 -0
  71. package/lib/commonjs/models/ReplayBadgeConfiguration.js.map +1 -0
  72. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  73. package/lib/module/FireworkSDK.js +29 -25
  74. package/lib/module/FireworkSDK.js.map +1 -1
  75. package/lib/module/VideoShopping.js +6 -12
  76. package/lib/module/VideoShopping.js.map +1 -1
  77. package/lib/module/components/StoryBlock.js +55 -3
  78. package/lib/module/components/StoryBlock.js.map +1 -1
  79. package/lib/module/components/VideoFeed.js +44 -4
  80. package/lib/module/components/VideoFeed.js.map +1 -1
  81. package/lib/module/index.js +5 -5
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/models/CountdownTimerConfiguration.js +2 -0
  84. package/lib/module/models/CountdownTimerConfiguration.js.map +1 -0
  85. package/lib/module/models/FWNativeErrorAction.js +7 -0
  86. package/lib/module/models/FWNativeErrorAction.js.map +1 -0
  87. package/lib/module/models/ReplayBadgeConfiguration.js +2 -0
  88. package/lib/module/models/ReplayBadgeConfiguration.js.map +1 -0
  89. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  90. package/lib/typescript/VideoShopping.d.ts +2 -2
  91. package/lib/typescript/components/StoryBlock.d.ts +18 -1
  92. package/lib/typescript/components/VideoFeed.d.ts +7 -1
  93. package/lib/typescript/index.d.ts +15 -13
  94. package/lib/typescript/models/CountdownTimerConfiguration.d.ts +12 -0
  95. package/lib/typescript/models/FWEvents.d.ts +26 -3
  96. package/lib/typescript/models/FWNativeErrorAction.d.ts +4 -0
  97. package/lib/typescript/models/FeedItemDetails.d.ts +6 -1
  98. package/lib/typescript/models/ReplayBadgeConfiguration.d.ts +7 -0
  99. package/lib/typescript/models/StoryBlockConfiguration.d.ts +13 -1
  100. package/lib/typescript/models/VideoFeedConfiguration.d.ts +6 -0
  101. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +12 -1
  102. package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -0
  103. package/package.json +1 -5
  104. package/react-native-firework-sdk.podspec +3 -5
  105. package/src/FireworkSDK.ts +27 -24
  106. package/src/VideoShopping.ts +9 -11
  107. package/src/components/StoryBlock.tsx +73 -7
  108. package/src/components/VideoFeed.tsx +61 -12
  109. package/src/index.ts +36 -30
  110. package/src/models/CountdownTimerConfiguration.ts +12 -0
  111. package/src/models/FWEvents.ts +28 -3
  112. package/src/models/FWNativeErrorAction.ts +4 -0
  113. package/src/models/FeedItemDetails.ts +7 -1
  114. package/src/models/ReplayBadgeConfiguration.ts +7 -0
  115. package/src/models/StoryBlockConfiguration.ts +13 -1
  116. package/src/models/VideoFeedConfiguration.ts +6 -0
  117. package/src/models/VideoPlayerConfiguration.ts +12 -1
  118. package/src/modules/FireworkSDKModule.ts +1 -0
  119. package/FireworkVideoUI.xcframework/Info.plist +0 -40
  120. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  121. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -280
  122. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  123. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  124. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +0 -1313
  125. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -42
  126. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  127. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +0 -42
  128. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  129. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  130. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -556
  131. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  132. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  133. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -1313
  134. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -42
  135. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  136. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -42
  137. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -1313
  138. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -42
  139. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  140. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -42
  141. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  142. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +0 -245
  143. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +0 -13
  144. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +0 -18
  145. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +0 -154
  146. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +0 -73
  147. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +0 -25
  148. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +0 -52
  149. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -60
  150. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +0 -98
  151. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +0 -97
  152. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +0 -97
  153. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +0 -71
  154. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +0 -48
  155. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +0 -26
  156. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +0 -43
  157. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +0 -42
  158. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +0 -149
  159. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +0 -35
  160. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +0 -202
  161. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +0 -59
  162. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift +0 -32
  163. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +0 -18
  164. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +0 -46
  165. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +0 -37
  166. package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +0 -766
  167. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +0 -10
  168. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  169. package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +0 -37
  170. package/ios/FireworkVideoUI/Podfile +0 -15
  171. package/ios/FireworkVideoUI/Podfile.lock +0 -16
  172. package/ios/scripts/react_native_firework_sdk_pods.rb +0 -27
@@ -0,0 +1,43 @@
1
+ //
2
+ // CountdownTimerConfiguration.swift
3
+ // react-native-firework-sdk
4
+ //
5
+ // Created by linjie jiang on 1/26/24.
6
+ //
7
+
8
+ import Foundation
9
+ import FireworkVideo
10
+
11
+ public struct CountdownTimerConfiguration: Codable, Equatable {
12
+ var isHidden: Bool?
13
+ var appearance: AppearanceMode?
14
+
15
+ enum AppearanceMode: String, Codable {
16
+ /// Light Mode
17
+ case light
18
+ /// Dark Mode
19
+ case dark
20
+
21
+ func fwAppearanceMode() -> FireworkVideo.CountdownTimerConfiguration.AppearanceMode {
22
+ switch self {
23
+ case .dark:
24
+ return .dark
25
+ case .light:
26
+ return .light
27
+ }
28
+ }
29
+ }
30
+
31
+ func fwCountdownTimerConfiguration() -> FireworkVideo.CountdownTimerConfiguration {
32
+ var result = FireworkVideo.CountdownTimerConfiguration()
33
+ if let isHidden = isHidden {
34
+ result.isHidden = isHidden
35
+ }
36
+
37
+ if let appearance = appearance {
38
+ result.appearance = appearance.fwAppearanceMode()
39
+ }
40
+
41
+ return result
42
+ }
43
+ }
@@ -0,0 +1,12 @@
1
+ //
2
+ // ReplayBadgeConfiguration.swift
3
+ // react-native-firework-sdk
4
+ //
5
+ // Created by Haitao Shangguan on 2023/12/25.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ class ReplayBadgeConfiguration: NSObject, Codable {
11
+ public var isHidden: Bool = false
12
+ }
@@ -51,11 +51,14 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate, PictureInPict
51
51
  public weak var delegate: StoryBlockViewDelegate?
52
52
 
53
53
  @objc var onStoryBlockLoadFinished: RCTBubblingEventBlock?
54
+ @objc var onStoryBlockEmpty: RCTBubblingEventBlock?
54
55
 
55
56
  @objc var onStoryBlockDidStartPictureInPicture: RCTBubblingEventBlock?
56
57
 
57
58
  @objc var onStoryBlockDidStopPictureInPicture: RCTBubblingEventBlock?
58
59
 
60
+ @objc var onStoryBlockGetFeedId: RCTBubblingEventBlock?
61
+
59
62
  private var storyBlockVC: StoryBlockViewController?
60
63
 
61
64
  private var source: StoryBlockContentSource {
@@ -113,6 +116,8 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate, PictureInPict
113
116
  return
114
117
  }
115
118
 
119
+ onStoryBlockGetFeedId?(["feedId": storyBlockVC.feedID])
120
+
116
121
  self.storyBlockVC = storyBlockVC
117
122
  updateStoryBlockVCConfiguration()
118
123
 
@@ -152,6 +157,24 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate, PictureInPict
152
157
  storyBlockVC.pause()
153
158
  }
154
159
 
160
+ @objc
161
+ public func onViewportEntered() {
162
+ guard let storyBlockVC = self.storyBlockVC else {
163
+ return
164
+ }
165
+ storyBlockVC.beginAppearanceTransition(true, animated: false)
166
+ storyBlockVC.endAppearanceTransition()
167
+ }
168
+
169
+ @objc
170
+ public func onViewportLeft() {
171
+ guard let storyBlockVC = self.storyBlockVC else {
172
+ return
173
+ }
174
+ storyBlockVC.beginAppearanceTransition(false, animated: false)
175
+ storyBlockVC.endAppearanceTransition()
176
+ }
177
+
155
178
  public func storyBlockDidLoadFeed(_ viewController: StoryBlockViewController) {
156
179
  guard let delegate = self.delegate else {
157
180
  return
@@ -323,6 +346,20 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate, PictureInPict
323
346
  }
324
347
  }
325
348
 
349
+ if let replayBadgeConfiguration = config.replayBadgeConfiguration {
350
+ resultConfig.replayBadge.isHidden = replayBadgeConfiguration.isHidden
351
+ resultConfig.fullScreenPlayerView.replayBadge.isHidden = replayBadgeConfiguration.isHidden
352
+ } else {
353
+ resultConfig.replayBadge.isHidden = false
354
+ resultConfig.fullScreenPlayerView.replayBadge.isHidden = false
355
+ }
356
+
357
+ if let countdownTimerConfiguration = config.countdownTimerConfiguration {
358
+ resultConfig.countdownTimerConfiguration = countdownTimerConfiguration.fwCountdownTimerConfiguration()
359
+ // swiftlint:disable:next line_length
360
+ resultConfig.fullScreenPlayerView.countdownTimerConfiguration = countdownTimerConfiguration.fwCountdownTimerConfiguration()
361
+ }
362
+
326
363
  storyBlockVC.viewConfiguration = resultConfig
327
364
  }
328
365
 
@@ -24,4 +24,6 @@ public class StoryBlockConfiguration: NSObject, Codable {
24
24
  var buttonConfiguration: VideoPlayerButtonConfiguration?
25
25
  var showVideoDetailTitle: Bool?
26
26
  var videoPlayerLogoConfiguration: VideoPlayerLogoConfiguration?
27
+ var replayBadgeConfiguration: ReplayBadgeConfiguration?
28
+ var countdownTimerConfiguration: CountdownTimerConfiguration?
27
29
  }
@@ -42,10 +42,12 @@ RCT_CUSTOM_VIEW_PROPERTY(storyBlockConfiguration, StoryBlockConfiguration, Story
42
42
  }
43
43
 
44
44
  RCT_EXPORT_VIEW_PROPERTY(onStoryBlockLoadFinished, RCTBubblingEventBlock)
45
+ RCT_EXPORT_VIEW_PROPERTY(onStoryBlockEmpty, RCTBubblingEventBlock)
45
46
 
46
47
  RCT_EXPORT_VIEW_PROPERTY(onStoryBlockDidStartPictureInPicture, RCTBubblingEventBlock)
47
48
 
48
49
  RCT_EXPORT_VIEW_PROPERTY(onStoryBlockDidStopPictureInPicture, RCTBubblingEventBlock)
50
+ RCT_EXPORT_VIEW_PROPERTY(onStoryBlockGetFeedId, RCTBubblingEventBlock)
49
51
 
50
52
  RCT_EXPORT_METHOD(play:(nonnull NSNumber *)reactTag) {
51
53
  [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
@@ -69,5 +71,27 @@ RCT_EXPORT_METHOD(pause:(nonnull NSNumber *)reactTag) {
69
71
  }];
70
72
  }
71
73
 
74
+ RCT_EXPORT_METHOD(onViewportEntered:(nonnull NSNumber *)reactTag) {
75
+ [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
76
+ StoryBlock *view = (StoryBlock *)(viewRegistry[reactTag]);
77
+ if (!view || ![view isKindOfClass:[StoryBlock class]]) {
78
+ RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
79
+ return;
80
+ }
81
+ [view onViewportEntered];
82
+ }];
83
+ }
84
+
85
+ RCT_EXPORT_METHOD(onViewportLeft:(nonnull NSNumber *)reactTag) {
86
+ [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
87
+ StoryBlock *view = (StoryBlock *)(viewRegistry[reactTag]);
88
+ if (!view || ![view isKindOfClass:[StoryBlock class]]) {
89
+ RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
90
+ return;
91
+ }
92
+ [view onViewportLeft];
93
+ }];
94
+ }
95
+
72
96
  @end
73
97
 
@@ -7,9 +7,7 @@
7
7
 
8
8
  import FireworkVideo
9
9
  import Foundation
10
- #if canImport(FireworkVideoUI)
11
10
  import FireworkVideoUI
12
- #endif
13
11
 
14
12
  @objc(StoryBlockManager)
15
13
  class StoryBlockManager: RCTViewManager, StoryBlockViewDelegate {
@@ -34,6 +32,11 @@ class StoryBlockManager: RCTViewManager, StoryBlockViewDelegate {
34
32
  }
35
33
 
36
34
  func storyBlock(_ view: StoryBlock, didFailToLoadFeed error: StoryBlockError) {
37
- view.onStoryBlockLoadFinished?(error.jsObject)
35
+ if case let .contentSourceError(feedContentSourceError) = error,
36
+ case .emptyFeed = feedContentSourceError {
37
+ view.onStoryBlockEmpty?(nil)
38
+ } else {
39
+ view.onStoryBlockLoadFinished?(error.jsObject)
40
+ }
38
41
  }
39
42
  }
@@ -9,9 +9,7 @@
9
9
 
10
10
  import FireworkVideo
11
11
  import UIKit
12
- #if canImport(FireworkVideoUI)
13
12
  import FireworkVideoUI
14
- #endif
15
13
 
16
14
  @objc
17
15
  public enum VideoFeedMode: Int {
@@ -77,12 +75,15 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate, PictureInPictur
77
75
  @objc public var adConfiguration: AdConfiguration?
78
76
 
79
77
  @objc var onVideoFeedLoadFinished: RCTBubblingEventBlock?
80
- // @objc var onVideoFeedClick: RCTBubblingEventBlock?
78
+
79
+ @objc var onVideoFeedEmpty: RCTBubblingEventBlock?
81
80
 
82
81
  @objc var onVideoFeedDidStartPictureInPicture: RCTBubblingEventBlock?
83
82
 
84
83
  @objc var onVideoFeedDidStopPictureInPicture: RCTBubblingEventBlock?
85
84
 
85
+ @objc var onVideoFeedGetFeedId: RCTBubblingEventBlock?
86
+
86
87
  public weak var delegate: VideoFeedDelegate?
87
88
 
88
89
  private var feedVC: VideoFeedViewController?
@@ -193,6 +194,8 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate, PictureInPictur
193
194
  return
194
195
  }
195
196
 
197
+ onVideoFeedGetFeedId?(["feedId": feedVC.feedID])
198
+
196
199
  var viewConfiguration = convertToVideoFeedContentConfiguration()
197
200
  if viewConfiguration.itemView.autoplay.isEnabled {
198
201
  viewConfiguration.itemView.autoplay.isEnabled = false
@@ -511,6 +514,17 @@ extension VideoFeed {
511
514
  }
512
515
  }
513
516
  }
517
+
518
+ if let replayBadgeConfiguration = config.replayBadgeConfiguration {
519
+ vpcConfig.replayBadge.isHidden = replayBadgeConfiguration.isHidden
520
+ } else {
521
+ vpcConfig.replayBadge.isHidden = false
522
+ }
523
+
524
+ if let countdownTimerConfiguration = config.countdownTimerConfiguration {
525
+ vpcConfig.countdownTimerConfiguration = countdownTimerConfiguration.fwCountdownTimerConfiguration()
526
+ }
527
+
514
528
  return vpcConfig
515
529
  }
516
530
 
@@ -534,6 +548,12 @@ extension VideoFeed {
534
548
  videoConfig.adBadge = adBadge
535
549
  }
536
550
 
551
+ if let replayBadge = feedViewConfig?.replayBadge {
552
+ videoConfig.replayBadge.isHidden = replayBadge.isHidden
553
+ } else {
554
+ videoConfig.replayBadge.isHidden = false
555
+ }
556
+
537
557
  return videoConfig
538
558
  }
539
559
  }
@@ -21,6 +21,7 @@ public class VideoFeedConfiguration: NSObject, Codable {
21
21
  var itemSpacing: Double?
22
22
  var enableAutoplay: Bool?
23
23
  var gridColumns: Int?
24
+ var replayBadge: ReplayBadgeConfiguration?
24
25
 
25
26
  class VideoFeedTitleConfiguration: NSObject, Codable {
26
27
  public var hidden: Bool?
@@ -53,12 +53,15 @@ RCT_CUSTOM_VIEW_PROPERTY(adConfiguration, AdConfiguration, VideoFeed) {
53
53
  }
54
54
 
55
55
  RCT_EXPORT_VIEW_PROPERTY(onVideoFeedLoadFinished, RCTBubblingEventBlock)
56
- //RCT_EXPORT_VIEW_PROPERTY(onVideoFeedClick, RCTBubblingEventBlock)
56
+
57
+ RCT_EXPORT_VIEW_PROPERTY(onVideoFeedEmpty, RCTBubblingEventBlock)
57
58
 
58
59
  RCT_EXPORT_VIEW_PROPERTY(onVideoFeedDidStartPictureInPicture, RCTBubblingEventBlock)
59
60
 
60
61
  RCT_EXPORT_VIEW_PROPERTY(onVideoFeedDidStopPictureInPicture, RCTBubblingEventBlock)
61
62
 
63
+ RCT_EXPORT_VIEW_PROPERTY(onVideoFeedGetFeedId, RCTBubblingEventBlock)
64
+
62
65
  RCT_EXPORT_METHOD(refresh:(nonnull NSNumber *)reactTag) {
63
66
  [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
64
67
  VideoFeed *view = (VideoFeed *)(viewRegistry[reactTag]);
@@ -8,9 +8,7 @@
8
8
 
9
9
  import FireworkVideo
10
10
  import Foundation
11
- #if canImport(FireworkVideoUI)
12
11
  import FireworkVideoUI
13
- #endif
14
12
 
15
13
  @objc(VideoFeedManager)
16
14
  class VideoFeedManager: RCTViewManager, VideoFeedDelegate {
@@ -37,7 +35,12 @@ class VideoFeedManager: RCTViewManager, VideoFeedDelegate {
37
35
  }
38
36
 
39
37
  func videoFeed(_ view: VideoFeed, didFailToLoadFeed error: VideoFeedError) {
40
- view.onVideoFeedLoadFinished?(error.jsObject)
38
+ if case .contentSourceError(let feedContentSourceError) = error,
39
+ case .emptyFeed = feedContentSourceError {
40
+ view.onVideoFeedEmpty?(nil)
41
+ } else {
42
+ view.onVideoFeedLoadFinished?(error.jsObject)
43
+ }
41
44
  }
42
45
 
43
46
  // // MARK: - FireworkVideoFeedDelegate
@@ -73,4 +73,6 @@ public class VideoPlayerConfiguration: NSObject, Codable {
73
73
  var buttonConfiguration: VideoPlayerButtonConfiguration?
74
74
  var showVideoDetailTitle: Bool?
75
75
  var videoPlayerLogoConfiguration: VideoPlayerLogoConfiguration?
76
+ var replayBadgeConfiguration: ReplayBadgeConfiguration?
77
+ var countdownTimerConfiguration: CountdownTimerConfiguration?
76
78
  }
@@ -0,0 +1,14 @@
1
+ //
2
+ // FWReactNativeSDK.swift
3
+ // FireworkSdk
4
+ //
5
+ // Created by linjie jiang on 1/20/24.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ public class FWReactNativeSDK {
11
+ public static func initializeSDK(_ options: SDKInitOptions?) {
12
+ FireworkSDKModule.initializeSDK(options)
13
+ }
14
+ }
@@ -10,6 +10,10 @@
10
10
  891F4AF62A67E12800A9E8DA /* FWRNContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891F4AF52A67E12800A9E8DA /* FWRNContainerViewController.swift */; };
11
11
  891F4AF82A68DEDF00A9E8DA /* PushRNContainerParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891F4AF72A68DEDF00A9E8DA /* PushRNContainerParams.swift */; };
12
12
  891F4AFA2A68DF2B00A9E8DA /* RCTConvert+FWNavigatorModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891F4AF92A68DF2B00A9E8DA /* RCTConvert+FWNavigatorModule.swift */; };
13
+ 8930E1E22B5BED6100EB3512 /* FWReactNativeSDK.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8930E1E12B5BED6100EB3512 /* FWReactNativeSDK.swift */; };
14
+ 8971610D2B637C6F006C3F7B /* ReplayBadgeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8971610B2B637C6F006C3F7B /* ReplayBadgeConfiguration.swift */; };
15
+ 8971610E2B637C6F006C3F7B /* VideoPlayerLogoConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8971610C2B637C6F006C3F7B /* VideoPlayerLogoConfiguration.swift */; };
16
+ 897161102B637CA9006C3F7B /* CountdownTimerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8971610F2B637CA9006C3F7B /* CountdownTimerConfiguration.swift */; };
13
17
  897523872817DEF80070EBB6 /* (null) in Sources */ = {isa = PBXBuildFile; };
14
18
  897523882817DEF80070EBB6 /* (null) in Sources */ = {isa = PBXBuildFile; };
15
19
  897523892817DEF80070EBB6 /* (null) in Sources */ = {isa = PBXBuildFile; };
@@ -96,7 +100,11 @@
96
100
  891F4AF52A67E12800A9E8DA /* FWRNContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FWRNContainerViewController.swift; sourceTree = "<group>"; };
97
101
  891F4AF72A68DEDF00A9E8DA /* PushRNContainerParams.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushRNContainerParams.swift; sourceTree = "<group>"; };
98
102
  891F4AF92A68DF2B00A9E8DA /* RCTConvert+FWNavigatorModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RCTConvert+FWNavigatorModule.swift"; sourceTree = "<group>"; };
103
+ 8930E1E12B5BED6100EB3512 /* FWReactNativeSDK.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FWReactNativeSDK.swift; sourceTree = "<group>"; };
99
104
  894FADB229BAD571000FB51A /* libFireworkSdk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFireworkSdk.a; sourceTree = BUILT_PRODUCTS_DIR; };
105
+ 8971610B2B637C6F006C3F7B /* ReplayBadgeConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReplayBadgeConfiguration.swift; sourceTree = "<group>"; };
106
+ 8971610C2B637C6F006C3F7B /* VideoPlayerLogoConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayerLogoConfiguration.swift; sourceTree = "<group>"; };
107
+ 8971610F2B637CA9006C3F7B /* CountdownTimerConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CountdownTimerConfiguration.swift; sourceTree = "<group>"; };
100
108
  897523632817DEF80070EBB6 /* react_native_firework_sdk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = react_native_firework_sdk.h; sourceTree = "<group>"; };
101
109
  898873132A0A8E7E0089CD1C /* UIViewController+AttachChild.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+AttachChild.swift"; sourceTree = "<group>"; };
102
110
  898873142A0A8E7E0089CD1C /* UIView+Constraints.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Constraints.swift"; sourceTree = "<group>"; };
@@ -157,6 +165,7 @@
157
165
  898873102A0A8E7E0089CD1C /* Utils */,
158
166
  1F6F718A2771B48100224AF3 /* FireworkSdk-Bridging-Header.h */,
159
167
  897523632817DEF80070EBB6 /* react_native_firework_sdk.h */,
168
+ 8930E1E12B5BED6100EB3512 /* FWReactNativeSDK.swift */,
160
169
  894FADB229BAD571000FB51A /* libFireworkSdk.a */,
161
170
  );
162
171
  sourceTree = "<group>";
@@ -279,6 +288,9 @@
279
288
  8988733C2A0A8E7E0089CD1C /* Components */ = {
280
289
  isa = PBXGroup;
281
290
  children = (
291
+ 8971610F2B637CA9006C3F7B /* CountdownTimerConfiguration.swift */,
292
+ 8971610B2B637C6F006C3F7B /* ReplayBadgeConfiguration.swift */,
293
+ 8971610C2B637C6F006C3F7B /* VideoPlayerLogoConfiguration.swift */,
282
294
  8988733D2A0A8E7E0089CD1C /* StoryBlock.swift */,
283
295
  8988733E2A0A8E7E0089CD1C /* VideoFeedManager.swift */,
284
296
  8988733F2A0A8E7E0089CD1C /* AdConfiguration.swift */,
@@ -358,6 +370,7 @@
358
370
  897523952817DEF80070EBB6 /* (null) in Sources */,
359
371
  898873532A0A8E7E0089CD1C /* Product.swift in Sources */,
360
372
  8988736C2A0A8E7E0089CD1C /* VideoPlayerConfiguration.swift in Sources */,
373
+ 8930E1E22B5BED6100EB3512 /* FWReactNativeSDK.swift in Sources */,
361
374
  8988734D2A0A8E7E0089CD1C /* FWNavigatorModule.swift in Sources */,
362
375
  898873692A0A8E7E0089CD1C /* StoryBlockManager.m in Sources */,
363
376
  897523A02817DEF80070EBB6 /* (null) in Sources */,
@@ -367,6 +380,7 @@
367
380
  89DF27E128A53A89003F3CCB /* (null) in Sources */,
368
381
  898873582A0A8E7E0089CD1C /* FireworkSDKModule.swift in Sources */,
369
382
  898873462A0A8E7E0089CD1C /* UIViewController+AttachChild.swift in Sources */,
383
+ 897161102B637CA9006C3F7B /* CountdownTimerConfiguration.swift in Sources */,
370
384
  898873552A0A8E7E0089CD1C /* TrackPurchaseParameters.swift in Sources */,
371
385
  8988735C2A0A8E7E0089CD1C /* LiveStreamModule.swift in Sources */,
372
386
  898873642A0A8E7E0089CD1C /* FireworkEventName.swift in Sources */,
@@ -374,6 +388,7 @@
374
388
  8988734E2A0A8E7E0089CD1C /* FWNavigatorModule.m in Sources */,
375
389
  898873492A0A8E7E0089CD1C /* String+Color.swift in Sources */,
376
390
  898873662A0A8E7E0089CD1C /* VideoFeedManager.swift in Sources */,
391
+ 8971610D2B637C6F006C3F7B /* ReplayBadgeConfiguration.swift in Sources */,
377
392
  89D6BBF929ACE2DC00C8AA2A /* (null) in Sources */,
378
393
  898873592A0A8E7E0089CD1C /* AdBadgeConfiguration.swift in Sources */,
379
394
  897523972817DEF80070EBB6 /* (null) in Sources */,
@@ -394,6 +409,7 @@
394
409
  897523882817DEF80070EBB6 /* (null) in Sources */,
395
410
  897523982817DEF80070EBB6 /* (null) in Sources */,
396
411
  898873652A0A8E7E0089CD1C /* StoryBlock.swift in Sources */,
412
+ 8971610E2B637C6F006C3F7B /* VideoPlayerLogoConfiguration.swift in Sources */,
397
413
  8975239C2817DEF80070EBB6 /* (null) in Sources */,
398
414
  898873602A0A8E7E0089CD1C /* RCTConvert+FireworkSDKModule.swift in Sources */,
399
415
  897523942817DEF80070EBB6 /* (null) in Sources */,
@@ -8,25 +8,27 @@
8
8
  import FireworkVideo
9
9
  import Foundation
10
10
 
11
+ var gVideoDetailsForTappingCTAButton: VideoDetails?
12
+
11
13
  extension FireworkSDKModule: FireworkVideoCTADelegate {
12
14
  func handleCustomCTAClick(_ viewController: PlayerViewController, url: URL) -> Bool {
13
- #if DEBUG
14
- let formatter = DateFormatter()
15
- formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
16
- sendEvent(
17
- withName: FWEventName.logMessage.rawValue,
18
- body: [
19
- "message":
20
- "[iOS] Receive CustomCTAClick event \(formatter.string(from: Date()))"
21
- ])
22
- #endif
23
15
  let callbackId = UUID().uuidString
24
16
  playerMap.setObject(viewController, forKey: callbackId as NSString)
25
- sendEvent(withName: FWEventName.customCTAClick.rawValue,
26
- body: [
27
- "url": url.absoluteString,
28
- "callbackId": callbackId
29
- ])
17
+
18
+ DispatchQueue.main.async { [weak self] in
19
+ var body: [String: Any?] = [
20
+ "url": url.absoluteString,
21
+ "callbackId": callbackId
22
+ ]
23
+
24
+ if let video = gVideoDetailsForTappingCTAButton {
25
+ body["video"] = video.jsObject
26
+ gVideoDetailsForTappingCTAButton = nil
27
+ }
28
+
29
+ self?.sendEvent(withName: FWEventName.customCTAClick.rawValue,
30
+ body: body)
31
+ }
30
32
 
31
33
  return customCTAClickEnabled
32
34
  }
@@ -110,6 +110,7 @@ extension FireworkSDKModule: FireworkVideoPlaybackDelegate {
110
110
  }
111
111
 
112
112
  func fireworkVideoDidTapCTAButton(_ videoPlayback: VideoPlaybackDetails) {
113
+ gVideoDetailsForTappingCTAButton = videoPlayback
113
114
  guard enableVideoPlayBackEvent else { return }
114
115
  sendEvent(
115
116
  withName: FWEventName.videoPlayback.rawValue,
@@ -132,17 +133,6 @@ extension FireworkSDKModule: FireworkVideoPlaybackDelegate {
132
133
 
133
134
  extension FireworkSDKModule: FireworkVideoFeedDelegate {
134
135
  func fireworkVideoDidTapThumbnail(_ eventDetails: FeedEventDetails) {
135
- #if DEBUG
136
- let formatter = DateFormatter()
137
- formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
138
- sendEvent(
139
- withName: FWEventName.logMessage.rawValue,
140
- body: [
141
- "message":
142
- "[iOS] Send VideoFeedClick event id: \(eventDetails.id) \(formatter.string(from: Date()))"
143
- ])
144
- #endif
145
-
146
136
  sendEvent(
147
137
  withName: FWEventName.videoFeedClick.rawValue, body: ["info": eventDetails.jsObject])
148
138
  }
@@ -11,6 +11,7 @@
11
11
  @interface RCT_EXTERN_REMAP_MODULE(FireworkSDK, FireworkSDKModule, NSObject)
12
12
 
13
13
  _RCT_EXTERN_REMAP_METHOD(init, initializeSDK:(NSDictionary * __nullable)options resolver:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter, NO)
14
+ RCT_EXTERN_METHOD(markInitCalled:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
14
15
  RCT_EXTERN_METHOD(openVideoPlayer:(NSString *)url config:(NSDictionary *)config)
15
16
  RCT_EXTERN_METHOD(setVideoFeedClickCallbackEnabled:(BOOL)enabled)
16
17
  RCT_EXTERN_METHOD(setCustomCTAClickEnabled:(BOOL)enabled)