react-native-firework-sdk 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +18 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +4 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModel.kt +0 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +0 -3
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelSerializer.kt +0 -2
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSdkInitResultModel.kt +6 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModel.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelDeserializer.kt +45 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelSerializer.kt +34 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +4 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModel.kt +8 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelDeserializer.kt +23 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelSerializer.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoPlayerLogoOption.kt +19 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +103 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +12 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +8 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +22 -9
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +78 -122
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +34 -9
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +13 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWFragmentUtil.kt +3 -3
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +5 -2
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +64 -0
- package/ios/Components/ReplayBadgeConfiguration.swift +12 -0
- package/ios/Components/StoryBlock.swift +31 -0
- package/ios/Components/StoryBlockConfiguration.swift +1 -0
- package/ios/Components/StoryBlockManager.m +24 -0
- package/ios/Components/StoryBlockManager.swift +6 -3
- package/ios/Components/VideoFeed.swift +18 -3
- package/ios/Components/VideoFeedConfiguration.swift +1 -0
- package/ios/Components/VideoFeedManager.m +4 -1
- package/ios/Components/VideoFeedManager.swift +6 -3
- package/ios/Components/VideoPlayerConfiguration.swift +1 -0
- package/ios/FWReactNativeSDK.swift +14 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +17 -15
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +1 -11
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +80 -81
- package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +9 -5
- package/ios/Modules/Shopping/ShoppingModule.swift +10 -74
- package/lib/commonjs/FireworkSDK.js +30 -25
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +6 -12
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +54 -3
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +46 -4
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWNativeErrorAction.js +14 -0
- package/lib/commonjs/models/FWNativeErrorAction.js.map +1 -0
- package/lib/commonjs/models/ReplayBadgeConfiguration.js +2 -0
- package/lib/commonjs/models/ReplayBadgeConfiguration.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +29 -25
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +6 -12
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/StoryBlock.js +53 -3
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +42 -4
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWNativeErrorAction.js +7 -0
- package/lib/module/models/FWNativeErrorAction.js.map +1 -0
- package/lib/module/models/ReplayBadgeConfiguration.js +2 -0
- package/lib/module/models/ReplayBadgeConfiguration.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/typescript/VideoShopping.d.ts +2 -2
- package/lib/typescript/components/StoryBlock.d.ts +18 -1
- package/lib/typescript/components/VideoFeed.d.ts +7 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/models/FWEvents.d.ts +26 -3
- package/lib/typescript/models/FWNativeErrorAction.d.ts +4 -0
- package/lib/typescript/models/FeedItemDetails.d.ts +6 -1
- package/lib/typescript/models/ReplayBadgeConfiguration.d.ts +7 -0
- package/lib/typescript/models/StoryBlockConfiguration.d.ts +6 -1
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +6 -0
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +6 -1
- package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -0
- package/package.json +1 -5
- package/react-native-firework-sdk.podspec +3 -5
- package/src/FireworkSDK.ts +27 -24
- package/src/VideoShopping.ts +9 -11
- package/src/components/StoryBlock.tsx +69 -7
- package/src/components/VideoFeed.tsx +57 -12
- package/src/index.ts +2 -0
- package/src/models/FWEvents.ts +28 -3
- package/src/models/FWNativeErrorAction.ts +4 -0
- package/src/models/FeedItemDetails.ts +7 -1
- package/src/models/ReplayBadgeConfiguration.ts +7 -0
- package/src/models/StoryBlockConfiguration.ts +6 -1
- package/src/models/VideoFeedConfiguration.ts +6 -0
- package/src/models/VideoPlayerConfiguration.ts +6 -1
- package/src/modules/FireworkSDKModule.ts +1 -0
- package/FireworkVideoUI.xcframework/Info.plist +0 -40
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -280
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -556
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +0 -245
- package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +0 -13
- package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +0 -18
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +0 -154
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +0 -73
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +0 -25
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +0 -52
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -60
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +0 -98
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +0 -97
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +0 -97
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +0 -71
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +0 -48
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +0 -26
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +0 -43
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +0 -42
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +0 -149
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +0 -35
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +0 -202
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +0 -59
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift +0 -32
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +0 -18
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +0 -46
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +0 -37
- package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +0 -766
- package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +0 -10
- package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +0 -37
- package/ios/FireworkVideoUI/Podfile +0 -15
- package/ios/FireworkVideoUI/Podfile.lock +0 -16
- package/ios/scripts/react_native_firework_sdk_pods.rb +0 -27
|
@@ -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,14 @@ 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
|
+
|
|
326
357
|
storyBlockVC.viewConfiguration = resultConfig
|
|
327
358
|
}
|
|
328
359
|
|
|
@@ -24,4 +24,5 @@ public class StoryBlockConfiguration: NSObject, Codable {
|
|
|
24
24
|
var buttonConfiguration: VideoPlayerButtonConfiguration?
|
|
25
25
|
var showVideoDetailTitle: Bool?
|
|
26
26
|
var videoPlayerLogoConfiguration: VideoPlayerLogoConfiguration?
|
|
27
|
+
var replayBadgeConfiguration: ReplayBadgeConfiguration?
|
|
27
28
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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,12 @@ 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
|
+
}
|
|
514
523
|
return vpcConfig
|
|
515
524
|
}
|
|
516
525
|
|
|
@@ -534,6 +543,12 @@ extension VideoFeed {
|
|
|
534
543
|
videoConfig.adBadge = adBadge
|
|
535
544
|
}
|
|
536
545
|
|
|
546
|
+
if let replayBadge = feedViewConfig?.replayBadge {
|
|
547
|
+
videoConfig.replayBadge.isHidden = replayBadge.isHidden
|
|
548
|
+
} else {
|
|
549
|
+
videoConfig.replayBadge.isHidden = false
|
|
550
|
+
}
|
|
551
|
+
|
|
537
552
|
return videoConfig
|
|
538
553
|
}
|
|
539
554
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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,5 @@ public class VideoPlayerConfiguration: NSObject, Codable {
|
|
|
73
73
|
var buttonConfiguration: VideoPlayerButtonConfiguration?
|
|
74
74
|
var showVideoDetailTitle: Bool?
|
|
75
75
|
var videoPlayerLogoConfiguration: VideoPlayerLogoConfiguration?
|
|
76
|
+
var replayBadgeConfiguration: ReplayBadgeConfiguration?
|
|
76
77
|
}
|
|
@@ -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,7 @@
|
|
|
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 */; };
|
|
13
14
|
897523872817DEF80070EBB6 /* (null) in Sources */ = {isa = PBXBuildFile; };
|
|
14
15
|
897523882817DEF80070EBB6 /* (null) in Sources */ = {isa = PBXBuildFile; };
|
|
15
16
|
897523892817DEF80070EBB6 /* (null) in Sources */ = {isa = PBXBuildFile; };
|
|
@@ -96,6 +97,7 @@
|
|
|
96
97
|
891F4AF52A67E12800A9E8DA /* FWRNContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FWRNContainerViewController.swift; sourceTree = "<group>"; };
|
|
97
98
|
891F4AF72A68DEDF00A9E8DA /* PushRNContainerParams.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushRNContainerParams.swift; sourceTree = "<group>"; };
|
|
98
99
|
891F4AF92A68DF2B00A9E8DA /* RCTConvert+FWNavigatorModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RCTConvert+FWNavigatorModule.swift"; sourceTree = "<group>"; };
|
|
100
|
+
8930E1E12B5BED6100EB3512 /* FWReactNativeSDK.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FWReactNativeSDK.swift; sourceTree = "<group>"; };
|
|
99
101
|
894FADB229BAD571000FB51A /* libFireworkSdk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFireworkSdk.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
100
102
|
897523632817DEF80070EBB6 /* react_native_firework_sdk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = react_native_firework_sdk.h; sourceTree = "<group>"; };
|
|
101
103
|
898873132A0A8E7E0089CD1C /* UIViewController+AttachChild.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+AttachChild.swift"; sourceTree = "<group>"; };
|
|
@@ -157,6 +159,7 @@
|
|
|
157
159
|
898873102A0A8E7E0089CD1C /* Utils */,
|
|
158
160
|
1F6F718A2771B48100224AF3 /* FireworkSdk-Bridging-Header.h */,
|
|
159
161
|
897523632817DEF80070EBB6 /* react_native_firework_sdk.h */,
|
|
162
|
+
8930E1E12B5BED6100EB3512 /* FWReactNativeSDK.swift */,
|
|
160
163
|
894FADB229BAD571000FB51A /* libFireworkSdk.a */,
|
|
161
164
|
);
|
|
162
165
|
sourceTree = "<group>";
|
|
@@ -358,6 +361,7 @@
|
|
|
358
361
|
897523952817DEF80070EBB6 /* (null) in Sources */,
|
|
359
362
|
898873532A0A8E7E0089CD1C /* Product.swift in Sources */,
|
|
360
363
|
8988736C2A0A8E7E0089CD1C /* VideoPlayerConfiguration.swift in Sources */,
|
|
364
|
+
8930E1E22B5BED6100EB3512 /* FWReactNativeSDK.swift in Sources */,
|
|
361
365
|
8988734D2A0A8E7E0089CD1C /* FWNavigatorModule.swift in Sources */,
|
|
362
366
|
898873692A0A8E7E0089CD1C /* StoryBlockManager.m in Sources */,
|
|
363
367
|
897523A02817DEF80070EBB6 /* (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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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)
|
|
@@ -7,16 +7,18 @@
|
|
|
7
7
|
// The FireworkSDKModule Wrap native FireworkVideoSDK class,then expose to JavaScript in Objective-C
|
|
8
8
|
|
|
9
9
|
import FireworkVideo
|
|
10
|
-
#if canImport(FireworkVideoUI)
|
|
11
10
|
import FireworkVideoUI
|
|
12
|
-
#endif
|
|
13
11
|
|
|
14
12
|
var gShareBaseURL: String?
|
|
15
13
|
var gAdBadgeConfiguration: AdBadgeConfiguration?
|
|
16
|
-
var gVideoLaunchBehavior:
|
|
14
|
+
var gVideoLaunchBehavior: FWRVideoLaunchBehavior?
|
|
17
15
|
|
|
18
16
|
@objc(FireworkSDKModule)
|
|
19
17
|
class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
18
|
+
static var shared: FireworkSDKModule?
|
|
19
|
+
static var cachedSDKInitOptions: SDKInitOptions?
|
|
20
|
+
static var hasCachedSDKInitOptions: Bool = false
|
|
21
|
+
|
|
20
22
|
// var shareBaseURL: String?
|
|
21
23
|
var customCTAClickEnabled: Bool = false
|
|
22
24
|
|
|
@@ -26,8 +28,17 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
26
28
|
// player view controller
|
|
27
29
|
var playerMap: NSMapTable<NSString, UIViewController> = NSMapTable.strongToWeakObjects()
|
|
28
30
|
|
|
31
|
+
private var hasCalledSDKInitFromNative: Bool = false
|
|
32
|
+
private var argumentsForInitEvent: [String: Any]?
|
|
33
|
+
private var hasListeners = false
|
|
34
|
+
|
|
29
35
|
override init() {
|
|
30
36
|
super.init()
|
|
37
|
+
Self.shared = self
|
|
38
|
+
if Self.hasCachedSDKInitOptions {
|
|
39
|
+
self.initializeSDK(Self.cachedSDKInitOptions, true)
|
|
40
|
+
}
|
|
41
|
+
|
|
31
42
|
_ = AppLanguageManager.shared
|
|
32
43
|
NotificationCenter.default.addObserver(
|
|
33
44
|
self, selector: #selector(Self.onAppLanguageChanged),
|
|
@@ -46,46 +57,62 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
46
57
|
return DispatchQueue.main
|
|
47
58
|
}
|
|
48
59
|
|
|
60
|
+
static func initializeSDK(_ options: SDKInitOptions?) {
|
|
61
|
+
if let shared = shared {
|
|
62
|
+
shared.initializeSDK(options, true)
|
|
63
|
+
} else {
|
|
64
|
+
hasCachedSDKInitOptions = true
|
|
65
|
+
cachedSDKInitOptions = options
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
49
69
|
@objc(initializeSDK:resolver:rejecter:)
|
|
50
70
|
func initializeSDK(
|
|
51
71
|
_ options: NSDictionary? = nil,
|
|
52
72
|
resolver: RCTPromiseResolveBlock,
|
|
53
73
|
rejecter: RCTPromiseRejectBlock
|
|
54
74
|
) {
|
|
55
|
-
#if DEBUG
|
|
56
|
-
let formatter = DateFormatter()
|
|
57
|
-
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
58
|
-
let iOSSDKBundle = Bundle(for: FireworkVideoSDK.self)
|
|
59
|
-
|
|
60
|
-
let messageForLocalizations = """
|
|
61
|
-
[iOS] localizations information \(formatter.string(from: Date()))
|
|
62
|
-
AppleLanguages: \((UserDefaults.standard.object(forKey: "AppleLanguages") as? [String]) ?? [])
|
|
63
|
-
Bundle.main.localizations \(Bundle.main.localizations)
|
|
64
|
-
Bundle.main.preferredLocalizations \(Bundle.main.preferredLocalizations)
|
|
65
|
-
iOSSDKBundle.localizations \(iOSSDKBundle.localizations)
|
|
66
|
-
iOSSDKBundle.preferredLocalizations \(iOSSDKBundle.preferredLocalizations)
|
|
67
|
-
"""
|
|
68
|
-
print("[react-native-firework-sdk] [swift] \(messageForLocalizations)")
|
|
69
|
-
sendEvent(withName: FWEventName.logMessage.rawValue, body: ["message": messageForLocalizations])
|
|
70
|
-
|
|
71
|
-
let message = "[iOS] Call initializeSDK \(formatter.string(from: Date()))"
|
|
72
|
-
print("[react-native-firework-sdk] [swift] \(message)")
|
|
73
|
-
|
|
74
|
-
sendEvent(withName: FWEventName.logMessage.rawValue, body: ["message": message])
|
|
75
|
-
#endif
|
|
76
75
|
var sdkInitOptions: SDKInitOptions?
|
|
77
76
|
if let options = options as? [String: Any] {
|
|
78
77
|
sdkInitOptions = RCTConvert.sdkInitOptions(options)
|
|
79
78
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
FireworkVideoSDK.initializeSDK(delegate: self, userID: sdkInitOptions?.userId)
|
|
83
|
-
FireworkVideoSDK.ctaDelegate = self
|
|
84
|
-
FireworkVideoSDK.eventTracking.videoPlaybackDelegate = self
|
|
85
|
-
FireworkVideoSDK.eventTracking.feedDelegate = self
|
|
79
|
+
initializeSDK(sdkInitOptions, false)
|
|
86
80
|
resolver([:])
|
|
87
81
|
}
|
|
88
82
|
|
|
83
|
+
@objc(markInitCalled:rejecter:)
|
|
84
|
+
func markInitCalled(
|
|
85
|
+
_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock
|
|
86
|
+
) {
|
|
87
|
+
if hasCalledSDKInitFromNative,
|
|
88
|
+
let argumentsForInitEvent = argumentsForInitEvent {
|
|
89
|
+
// The sdk init event was received before.
|
|
90
|
+
sendEvent(withName: FWEventName.sdkInit.rawValue, body: argumentsForInitEvent)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
resolver(hasCalledSDKInitFromNative)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
func initializeSDK(_ options: SDKInitOptions?, _ fromNative: Bool) {
|
|
97
|
+
if hasCalledSDKInitFromNative && !fromNative {
|
|
98
|
+
if let argumentsForInitEvent = argumentsForInitEvent {
|
|
99
|
+
// The sdk init event was received before.
|
|
100
|
+
sendEvent(withName: FWEventName.sdkInit.rawValue, body: argumentsForInitEvent)
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
gVideoLaunchBehavior = options?.videoLaunchBehavior
|
|
104
|
+
|
|
105
|
+
FireworkVideoSDK.initializeSDK(delegate: self, userID: options?.userId)
|
|
106
|
+
FireworkVideoSDK.ctaDelegate = self
|
|
107
|
+
FireworkVideoSDK.eventTracking.videoPlaybackDelegate = self
|
|
108
|
+
FireworkVideoSDK.eventTracking.feedDelegate = self
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if fromNative {
|
|
112
|
+
hasCalledSDKInitFromNative = true
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
89
116
|
@objc(openVideoPlayer:config:)
|
|
90
117
|
func openVideoPlayer(_ url: String, config: NSDictionary?) {
|
|
91
118
|
guard let urlString = URL.init(string: url) else {
|
|
@@ -166,18 +193,6 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
166
193
|
}
|
|
167
194
|
|
|
168
195
|
guard let trackPurchaseParameters = RCTConvert.trackPurchaseParameters(parameters) else {
|
|
169
|
-
#if DEBUG
|
|
170
|
-
let formatter = DateFormatter()
|
|
171
|
-
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
172
|
-
|
|
173
|
-
let message = """
|
|
174
|
-
"[iOS] Fail to parse parameters of trackPurchase \
|
|
175
|
-
method: \(String(describing: parameters)) \(formatter.string(from: Date()))
|
|
176
|
-
"""
|
|
177
|
-
print("[react-native-firework-sdk] [swift] \(message)")
|
|
178
|
-
|
|
179
|
-
sendEvent(withName: FWEventName.logMessage.rawValue, body: ["message": message])
|
|
180
|
-
#endif
|
|
181
196
|
return
|
|
182
197
|
}
|
|
183
198
|
FireworkVideoSDK.trackPurchase(
|
|
@@ -195,58 +210,42 @@ class FireworkSDKModule: RCTEventEmitter, FireworkVideoSDKDelegate {
|
|
|
195
210
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
196
211
|
rejecter: @escaping RCTPromiseRejectBlock
|
|
197
212
|
) {
|
|
198
|
-
#if DEBUG
|
|
199
|
-
let formatter = DateFormatter()
|
|
200
|
-
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
201
|
-
let message = "[iOS] Call changeAppLanguage: \(language ?? "") \(formatter.string(from: Date()))"
|
|
202
|
-
sendEvent(withName: FWEventName.logMessage.rawValue, body: ["message": message])
|
|
203
|
-
#endif
|
|
204
|
-
|
|
205
213
|
let result = AppLanguageManager.shared.changeAppLanguage(language)
|
|
206
214
|
|
|
207
215
|
resolver(result)
|
|
208
216
|
}
|
|
209
217
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
218
|
+
override func startObserving() {
|
|
219
|
+
super.startObserving()
|
|
220
|
+
hasListeners = true
|
|
221
|
+
}
|
|
215
222
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
223
|
+
override func stopObserving() {
|
|
224
|
+
super.stopObserving()
|
|
225
|
+
hasListeners = false
|
|
226
|
+
}
|
|
219
227
|
|
|
220
|
-
|
|
221
|
-
|
|
228
|
+
// MARK: - FireworkVideoSDKDelegate
|
|
229
|
+
func fireworkVideoDidLoadSuccessfully() {
|
|
230
|
+
argumentsForInitEvent = [:]
|
|
222
231
|
|
|
223
|
-
|
|
232
|
+
if hasListeners {
|
|
233
|
+
sendEvent(withName: FWEventName.sdkInit.rawValue, body: argumentsForInitEvent)
|
|
234
|
+
}
|
|
224
235
|
}
|
|
225
236
|
|
|
226
237
|
func fireworkVideoDidLoadWith(error: FireworkVideoSDKError) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
"[iOS] Send SDK initialization failure event \(formatter.string(from: Date()))"
|
|
233
|
-
print("[react-native-firework-sdk] [swift] \(message)")
|
|
238
|
+
argumentsForInitEvent = [
|
|
239
|
+
"error": [
|
|
240
|
+
"name": error.jsErrorName, "reason": error.recoverySuggestion ?? "default"
|
|
241
|
+
]
|
|
242
|
+
]
|
|
234
243
|
|
|
244
|
+
if hasListeners {
|
|
235
245
|
sendEvent(
|
|
236
|
-
withName: FWEventName.
|
|
237
|
-
body:
|
|
238
|
-
|
|
239
|
-
"[iOS] Send SDK initialization failure event \(formatter.string(from: Date()))"
|
|
240
|
-
])
|
|
241
|
-
#endif
|
|
242
|
-
|
|
243
|
-
sendEvent(
|
|
244
|
-
withName: FWEventName.sdkInit.rawValue,
|
|
245
|
-
body: [
|
|
246
|
-
"error": [
|
|
247
|
-
"name": error.jsErrorName, "reason": error.recoverySuggestion ?? "default"
|
|
248
|
-
]
|
|
249
|
-
])
|
|
246
|
+
withName: FWEventName.sdkInit.rawValue,
|
|
247
|
+
body: argumentsForInitEvent)
|
|
248
|
+
}
|
|
250
249
|
}
|
|
251
250
|
|
|
252
251
|
@objc func onAppLanguageChanged() {
|
|
@@ -7,16 +7,20 @@
|
|
|
7
7
|
import Foundation
|
|
8
8
|
import FireworkVideo
|
|
9
9
|
|
|
10
|
-
struct SDKInitOptions: Codable {
|
|
11
|
-
var userId: String?
|
|
12
|
-
var videoLaunchBehavior:
|
|
10
|
+
public struct SDKInitOptions: Codable {
|
|
11
|
+
public var userId: String?
|
|
12
|
+
public var videoLaunchBehavior: FWRVideoLaunchBehavior?
|
|
13
|
+
public init(userId: String? = nil, videoLaunchBehavior: FWRVideoLaunchBehavior? = nil) {
|
|
14
|
+
self.userId = userId
|
|
15
|
+
self.videoLaunchBehavior = videoLaunchBehavior
|
|
16
|
+
}
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
public enum
|
|
19
|
+
public enum FWRVideoLaunchBehavior: String, Codable {
|
|
16
20
|
case `default`, muteOnFirstLaunch
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
extension
|
|
23
|
+
extension FWRVideoLaunchBehavior {
|
|
20
24
|
func behavior() -> VideoPlayerContentConfiguration.VideoLaunchBehavior {
|
|
21
25
|
switch self {
|
|
22
26
|
case .muteOnFirstLaunch:
|