react-native-firework-sdk 2.10.1 → 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.
Files changed (158) hide show
  1. package/android/gradle.properties +1 -1
  2. package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +18 -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/FWSDKInitOptionsModel.kt +0 -1
  5. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +0 -3
  6. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelSerializer.kt +0 -2
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWSdkInitResultModel.kt +6 -0
  8. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModel.kt +9 -0
  9. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelDeserializer.kt +45 -0
  10. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelSerializer.kt +34 -0
  11. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -0
  12. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +1 -0
  13. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +2 -1
  14. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +4 -1
  15. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +2 -0
  16. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModel.kt +8 -0
  17. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelDeserializer.kt +23 -0
  18. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelSerializer.kt +18 -0
  19. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +2 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoPlayerLogoOption.kt +19 -0
  21. package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +103 -0
  22. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +12 -0
  23. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +8 -0
  24. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +2 -0
  25. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +22 -9
  26. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +74 -122
  27. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +34 -9
  28. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +13 -0
  29. package/android/src/main/java/com/fireworksdk/bridge/utils/FWFragmentUtil.kt +3 -3
  30. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +5 -2
  31. package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +64 -0
  32. package/ios/Components/ReplayBadgeConfiguration.swift +12 -0
  33. package/ios/Components/StoryBlock.swift +31 -0
  34. package/ios/Components/StoryBlockConfiguration.swift +1 -0
  35. package/ios/Components/StoryBlockManager.m +24 -0
  36. package/ios/Components/StoryBlockManager.swift +6 -3
  37. package/ios/Components/VideoFeed.swift +18 -3
  38. package/ios/Components/VideoFeedConfiguration.swift +1 -0
  39. package/ios/Components/VideoFeedManager.m +4 -1
  40. package/ios/Components/VideoFeedManager.swift +6 -3
  41. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  42. package/ios/FWReactNativeSDK.swift +14 -0
  43. package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
  44. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +17 -15
  45. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +1 -11
  46. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
  47. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +80 -81
  48. package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +9 -5
  49. package/ios/Modules/Shopping/ShoppingModule.swift +10 -74
  50. package/lib/commonjs/FireworkSDK.js +30 -25
  51. package/lib/commonjs/FireworkSDK.js.map +1 -1
  52. package/lib/commonjs/VideoShopping.js +6 -12
  53. package/lib/commonjs/VideoShopping.js.map +1 -1
  54. package/lib/commonjs/components/StoryBlock.js +54 -3
  55. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  56. package/lib/commonjs/components/VideoFeed.js +46 -4
  57. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  58. package/lib/commonjs/index.js.map +1 -1
  59. package/lib/commonjs/models/FWNativeErrorAction.js +14 -0
  60. package/lib/commonjs/models/FWNativeErrorAction.js.map +1 -0
  61. package/lib/commonjs/models/ReplayBadgeConfiguration.js +2 -0
  62. package/lib/commonjs/models/ReplayBadgeConfiguration.js.map +1 -0
  63. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  64. package/lib/module/FireworkSDK.js +29 -25
  65. package/lib/module/FireworkSDK.js.map +1 -1
  66. package/lib/module/VideoShopping.js +6 -12
  67. package/lib/module/VideoShopping.js.map +1 -1
  68. package/lib/module/components/StoryBlock.js +53 -3
  69. package/lib/module/components/StoryBlock.js.map +1 -1
  70. package/lib/module/components/VideoFeed.js +42 -4
  71. package/lib/module/components/VideoFeed.js.map +1 -1
  72. package/lib/module/index.js.map +1 -1
  73. package/lib/module/models/FWNativeErrorAction.js +7 -0
  74. package/lib/module/models/FWNativeErrorAction.js.map +1 -0
  75. package/lib/module/models/ReplayBadgeConfiguration.js +2 -0
  76. package/lib/module/models/ReplayBadgeConfiguration.js.map +1 -0
  77. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  78. package/lib/typescript/VideoShopping.d.ts +2 -2
  79. package/lib/typescript/components/StoryBlock.d.ts +18 -1
  80. package/lib/typescript/components/VideoFeed.d.ts +7 -1
  81. package/lib/typescript/index.d.ts +2 -2
  82. package/lib/typescript/models/FWEvents.d.ts +26 -3
  83. package/lib/typescript/models/FWNativeErrorAction.d.ts +4 -0
  84. package/lib/typescript/models/FeedItemDetails.d.ts +6 -1
  85. package/lib/typescript/models/ReplayBadgeConfiguration.d.ts +7 -0
  86. package/lib/typescript/models/StoryBlockConfiguration.d.ts +6 -1
  87. package/lib/typescript/models/VideoFeedConfiguration.d.ts +6 -0
  88. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +6 -1
  89. package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -0
  90. package/package.json +1 -5
  91. package/react-native-firework-sdk.podspec +3 -5
  92. package/src/FireworkSDK.ts +27 -24
  93. package/src/VideoShopping.ts +9 -11
  94. package/src/components/StoryBlock.tsx +69 -7
  95. package/src/components/VideoFeed.tsx +57 -12
  96. package/src/index.ts +2 -0
  97. package/src/models/FWEvents.ts +28 -3
  98. package/src/models/FWNativeErrorAction.ts +4 -0
  99. package/src/models/FeedItemDetails.ts +7 -1
  100. package/src/models/ReplayBadgeConfiguration.ts +7 -0
  101. package/src/models/StoryBlockConfiguration.ts +6 -1
  102. package/src/models/VideoFeedConfiguration.ts +6 -0
  103. package/src/models/VideoPlayerConfiguration.ts +6 -1
  104. package/src/modules/FireworkSDKModule.ts +1 -0
  105. package/FireworkVideoUI.xcframework/Info.plist +0 -40
  106. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  107. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -280
  108. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  109. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  110. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +0 -1313
  111. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -42
  112. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  113. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +0 -42
  114. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  115. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  116. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -556
  117. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  118. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  119. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -1313
  120. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -42
  121. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  122. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -42
  123. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -1313
  124. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -42
  125. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  126. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -42
  127. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  128. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +0 -245
  129. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +0 -13
  130. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +0 -18
  131. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +0 -154
  132. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +0 -73
  133. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +0 -25
  134. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +0 -52
  135. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -60
  136. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +0 -98
  137. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +0 -97
  138. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +0 -97
  139. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +0 -71
  140. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +0 -48
  141. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +0 -26
  142. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +0 -43
  143. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +0 -42
  144. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +0 -149
  145. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +0 -35
  146. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +0 -202
  147. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +0 -59
  148. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift +0 -32
  149. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +0 -18
  150. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +0 -46
  151. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +0 -37
  152. package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +0 -766
  153. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +0 -10
  154. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  155. package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +0 -37
  156. package/ios/FireworkVideoUI/Podfile +0 -15
  157. package/ios/FireworkVideoUI/Podfile.lock +0 -16
  158. package/ios/scripts/react_native_firework_sdk_pods.rb +0 -27
@@ -1,15 +1,11 @@
1
1
  package com.fireworksdk.bridge.reactnative.module
2
2
 
3
- import android.annotation.SuppressLint
4
3
  import android.app.Activity
5
4
  import android.app.Application
6
5
  import android.content.Intent
7
- import android.content.pm.PackageManager
8
6
  import android.os.Handler
9
7
  import android.os.Looper
10
8
  import android.os.Process
11
- import android.provider.Settings
12
- import android.util.Base64
13
9
  import androidx.annotation.Keep
14
10
  import com.facebook.react.bridge.*
15
11
  import com.firework.analyticsevents.cta.CtaButtonClickAnalyticsEvent
@@ -17,17 +13,14 @@ import com.firework.analyticsevents.player.PlayerLifecycleAnalyticsEvent
17
13
  import com.firework.analyticsevents.share.ShareButtonAnalyticsEvent
18
14
  import com.firework.bus.FwAnalyticCallable
19
15
  import com.firework.sdk.FireworkSdk
20
- import com.firework.sdk.FireworkSdkConfig
21
16
  import com.fireworksdk.bridge.FWInitializationProvider
22
17
  import com.fireworksdk.bridge.models.*
23
- import com.fireworksdk.bridge.models.enums.FWPlayerLaunchBehavior
24
18
  import com.fireworksdk.bridge.models.enums.FWVideoPlaybackSubEventName
19
+ import com.fireworksdk.bridge.reactnative.FWReactNativeSDK
25
20
  import com.fireworksdk.bridge.reactnative.models.FireworkSDKInterface
26
21
  import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
27
22
  import com.fireworksdk.bridge.utils.*
28
23
  import org.json.JSONObject
29
- import java.nio.charset.StandardCharsets
30
- import java.security.MessageDigest
31
24
  import java.util.*
32
25
  import kotlin.system.exitProcess
33
26
 
@@ -53,16 +46,39 @@ class FireworkSDKModule(
53
46
  @ReactMethod
54
47
  override fun init(config: ReadableMap?, promise: Promise) {
55
48
  FWColorUtil.useRgba = true
49
+ FWGlobalDataUtil.pauseWhenNotVisible = true
56
50
 
57
51
  val configMap = config?.toHashMap() ?: hashMapOf()
58
52
  val jsonObject = JSONObject(configMap)
59
53
  val sdkInitOptionsModel = FWSDKInitOptionsModelDeserializer.deserialize(jsonObject)
60
54
 
61
55
  UiThreadUtil.runOnUiThread {
62
- initSdk(sdkInitOptionsModel)
56
+ initCalled(sdkInitOptionsModel)
57
+ FireworkSdk.analytics.register(this)
63
58
  promise.resolve(Arguments.createMap())
59
+ }
60
+ }
61
+
62
+ @ReactMethod
63
+ override fun markInitCalled(promise: Promise) {
64
+ FWColorUtil.useRgba = true
65
+ FWGlobalDataUtil.pauseWhenNotVisible = true
66
+
67
+ val sdkInitResultModel = FWGlobalDataUtil.sdkInitResultModel
68
+ if (sdkInitResultModel != null) { // init in application
69
+ if (sdkInitResultModel.success == true) {
70
+ FWEventUtils.sendInitSuccessEvent(reactApplicationContext)
71
+ } else if (sdkInitResultModel.success == false) {
72
+ FWEventUtils.sendInitFailedEvent(reactApplicationContext, sdkInitResultModel.reason)
73
+ }
74
+
64
75
  FireworkSdk.analytics.register(this)
76
+ promise.resolve(true)
77
+
78
+ return
65
79
  }
80
+
81
+ promise.resolve(false)
66
82
  }
67
83
 
68
84
  /**
@@ -129,87 +145,6 @@ class FireworkSDKModule(
129
145
  FWGlobalDataUtil.videoPlaybackEventEnabled = value?:false
130
146
  }
131
147
 
132
- private fun initSdk(sdkInitOptions: FWSDKInitOptionsModel?) {
133
- val clientId = getAppid()
134
- if (clientId.isNullOrBlank()) {
135
- val errorMsg = "The appid is invalid"
136
- FWLogUtils.d { errorMsg }
137
- FWEventUtils.sendInitFailedEvent(reactApplicationContext, errorMsg)
138
- return
139
- }
140
- val userId = sdkInitOptions?.userId
141
-
142
- val uid = if (userId.isNullOrBlank()) { getHashedAndroidId() } else userId
143
- val shareBaseURL = sdkInitOptions?.shareBaseURL
144
- val videoLaunchBehavior = sdkInitOptions?.videoLaunchBehavior
145
-
146
- val configBuilder = FireworkSdkConfig.Builder(reactApplicationContext)
147
- .checksumRequired(false)
148
- .clientId(clientId)
149
- .userId(uid)
150
- .enableCache(true)
151
- shareBaseURL?.let {
152
- FWGlobalDataUtil.shareBaseUrl = it
153
- }
154
-
155
- val livestreamPlayerInitializerList = FWLiveStreamUtil.livestreamPlayerInitializers()
156
- for (livestreamPlayerInitializer in livestreamPlayerInitializerList) {
157
- configBuilder.addLivestreamPlayerInitializer(livestreamPlayerInitializer)
158
- }
159
- when (videoLaunchBehavior) {
160
- FWPlayerLaunchBehavior.Default -> {}
161
- FWPlayerLaunchBehavior.MuteOnFirstLaunch -> {
162
- configBuilder.muteOnLaunch(true)
163
- }
164
- else -> {}
165
- }
166
-
167
- val imageLoader = FWImageLoaderUtil.getImageLoader()
168
- if (imageLoader != null) {
169
- configBuilder.imageLoader(imageLoader)
170
- }
171
-
172
- val config = configBuilder.build()
173
-
174
- FireworkSdk.init(
175
- config,
176
- onSuccess = {
177
- FWEventUtils.sendInitSuccessEvent(reactApplicationContext)
178
- },
179
- onError = { error ->
180
- FWEventUtils.sendInitFailedEvent(reactApplicationContext, "$error")
181
- },
182
- )
183
- }
184
-
185
- private fun getAppid(): String? {
186
- val ai = reactApplicationContext.packageManager.getApplicationInfo(
187
- reactApplicationContext.packageName,
188
- PackageManager.GET_META_DATA
189
- )
190
- val value = ai.metaData.get("Firework:Appid")
191
- return value?.let {
192
- it as String
193
- } ?: run {
194
- null
195
- }
196
- }
197
-
198
- @SuppressLint("HardwareIds")
199
- private fun getHashedAndroidId(): String {
200
- val androidId = Settings.Secure.getString(
201
- reactApplicationContext.contentResolver,
202
- Settings.Secure.ANDROID_ID
203
- )
204
- return getHash(androidId)
205
- }
206
-
207
- private fun getHash(text: String): String {
208
- val digest: MessageDigest = MessageDigest.getInstance("SHA-256")
209
- val hash: ByteArray = digest.digest(text.toByteArray(StandardCharsets.UTF_8))
210
- return Base64.encodeToString(hash, Base64.DEFAULT)
211
- }
212
-
213
148
  @Keep
214
149
  @FwAnalyticCallable
215
150
  fun onCtaButtonClicked(event: CtaButtonClickAnalyticsEvent) {
@@ -217,24 +152,17 @@ class FireworkSDKModule(
217
152
  Date()
218
153
  )}")
219
154
 
155
+ val videoPlaybackDetails = FWModelUtils.convertCtaEvent2PlaybackDetails(event)
156
+
220
157
  if (FWGlobalDataUtil.videoPlaybackEventEnabled) {
221
158
  FWEventUtils.sendVideoPlaybackEvent(
222
159
  reactApplicationContext,
223
160
  FWVideoPlaybackSubEventName.ClickCTA.rawValue,
224
- FWVideoPlaybackDetails(
225
- badge = event.videoInfo.badge,
226
- caption = event.videoInfo.caption,
227
- duration = event.videoInfo.duration,
228
- hasCta = true,
229
- playerHeight = event.videoInfo.playerHeight,
230
- playerWidth = event.videoInfo.playerWidth,
231
- id = event.videoInfo.id,
232
- actionUrl = event.actionUrl,
233
- )
161
+ videoPlaybackDetails
234
162
  )
235
163
  }
236
164
 
237
- FWEventUtils.sendCustomCTAClickEvent(reactApplicationContext, event.actionUrl)
165
+ FWEventUtils.sendCustomCTAClickEvent(reactApplicationContext, event.actionUrl, videoPlaybackDetails)
238
166
  }
239
167
 
240
168
  @Keep
@@ -244,15 +172,7 @@ class FireworkSDKModule(
244
172
  FWEventUtils.sendVideoPlaybackEvent(
245
173
  reactApplicationContext,
246
174
  FWVideoPlaybackSubEventName.ClickShare.rawValue,
247
- FWVideoPlaybackDetails(
248
- badge = event.videoInfo.badge,
249
- caption = event.videoInfo.caption,
250
- duration = event.videoInfo.duration,
251
- hasCta = event.videoInfo.hasCta,
252
- playerHeight = event.videoInfo.playerHeight,
253
- playerWidth = event.videoInfo.playerWidth,
254
- id = event.videoInfo.id,
255
- )
175
+ FWModelUtils.convertShareButtonEvent2PlaybackDetails(event)
256
176
  )
257
177
  }
258
178
  }
@@ -263,18 +183,7 @@ class FireworkSDKModule(
263
183
  if (!FWGlobalDataUtil.videoPlaybackEventEnabled) {
264
184
  return
265
185
  }
266
- val progress = event.progress
267
-
268
- val videoPlaybackDetails = FWVideoPlaybackDetails(
269
- badge = event.videoInfo.badge,
270
- caption = event.videoInfo.caption,
271
- duration = event.videoInfo.duration,
272
- hasCta = event.videoInfo.hasCta,
273
- playerHeight = event.videoInfo.playerHeight,
274
- playerWidth = event.videoInfo.playerWidth,
275
- id = event.videoInfo.id,
276
- progress = progress
277
- )
186
+ val videoPlaybackDetails = FWModelUtils.convertPlayerEvent2PlaybackDetails(event)
278
187
  when (event) {
279
188
  is PlayerLifecycleAnalyticsEvent.OnStarted -> {
280
189
  if (event.videoInfo.isAd) {
@@ -367,6 +276,29 @@ class FireworkSDKModule(
367
276
  }, 300)
368
277
  }
369
278
 
279
+ @ReactMethod
280
+ override fun trackPurchase(config: ReadableMap?, promise: Promise) {
281
+ val configMap = config?.toHashMap() ?: hashMapOf()
282
+ val jsonObject = JSONObject(configMap)
283
+ val trackPurchaseModel = FWTrackPurchaseModelDeserializer.deserialize(jsonObject)
284
+
285
+ if (trackPurchaseModel?.orderId == null) {
286
+ promise.resolve(false)
287
+ return
288
+ }
289
+
290
+ UiThreadUtil.runOnUiThread {
291
+ FireworkSdk.shopping.trackPurchase(
292
+ trackPurchaseModel.orderId,
293
+ trackPurchaseModel.value,
294
+ trackPurchaseModel.currencyCode,
295
+ trackPurchaseModel.countryCode,
296
+ trackPurchaseModel.additionalInfo ?: mutableMapOf()
297
+ )
298
+ promise.resolve(true)
299
+ }
300
+ }
301
+
370
302
  @ReactMethod
371
303
  fun addListener(eventName: String?, promise: Promise) {
372
304
  // Set up any upstream listeners or background tasks as necessary
@@ -385,4 +317,24 @@ class FireworkSDKModule(
385
317
  return "FireworkSDK"
386
318
  }
387
319
 
320
+ private fun initCalled(sdkInitOptionsModel: FWSDKInitOptionsModel? = null) {
321
+ val context = reactApplicationContext
322
+ val sdkInitResultModel = FWGlobalDataUtil.sdkInitResultModel
323
+ if (sdkInitResultModel == null) {
324
+ // not init in application
325
+ FWReactNativeSDK.initSdkInternal(context, sdkInitOptionsModel, onSuccess = {
326
+ FWEventUtils.sendInitSuccessEvent(context)
327
+ }, onError = {
328
+ FWEventUtils.sendInitFailedEvent(context, it)
329
+ })
330
+ } else {
331
+ // init in application
332
+ if (sdkInitResultModel.success == true) {
333
+ FWEventUtils.sendInitSuccessEvent(context)
334
+ } else if (sdkInitResultModel.success == false) {
335
+ FWEventUtils.sendInitFailedEvent(context, sdkInitResultModel.reason)
336
+ }
337
+ }
338
+ }
339
+
388
340
  }
@@ -64,16 +64,22 @@ object FWEventUtils {
64
64
  sendEvent(reactContext, FWEventName.VideoFeedClick.rawValue, eventMap)
65
65
  }
66
66
 
67
- fun sendCustomCTAClickEvent(reactContext: ReactContext, url: String?) {
67
+ fun sendCustomCTAClickEvent(reactContext: ReactContext, url: String?, info: FWVideoPlaybackDetails?) {
68
68
  val eventMap = Arguments.createMap()
69
69
  eventMap.putString("url", url)
70
+ eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
70
71
  sendEvent(reactContext, FWEventName.CustomCTAClick.rawValue, eventMap)
71
72
  }
72
73
 
73
74
  fun sendVideoPlaybackEvent(reactContext: ReactContext, eventName: String, info: FWVideoPlaybackDetails?) {
74
75
  val eventMap = Arguments.createMap()
75
76
  eventMap.putString("eventName", eventName)
77
+ eventMap.putMap("info", convertVideoPlaybackDetails2Map(info))
76
78
 
79
+ sendEvent(reactContext, FWEventName.VideoPlayback.rawValue, eventMap)
80
+ }
81
+
82
+ private fun convertVideoPlaybackDetails2Map(info: FWVideoPlaybackDetails?): WritableMap {
77
83
  val contentMap = Arguments.createMap()
78
84
  if (!info?.id.isNullOrBlank()) {
79
85
  contentMap.putString("videoId", info?.id)
@@ -106,27 +112,30 @@ object FWEventUtils {
106
112
  if (!info?.actionUrl.isNullOrBlank()) {
107
113
  contentMap.putString("ctaActionURL", info?.actionUrl)
108
114
  }
109
- eventMap.putMap("info", contentMap)
110
-
111
- sendEvent(reactContext, FWEventName.VideoPlayback.rawValue, eventMap)
115
+ if (!info?.feedId.isNullOrBlank()) {
116
+ contentMap.putString("feedId", info?.feedId)
117
+ }
118
+ return contentMap;
112
119
  }
113
120
 
114
- fun sendShoppingCtaButtonClickEvent(reactContext: ReactContext, productId: String?, unitId: String?, url: String?, callbackId: Int?) {
121
+ fun sendShoppingCtaButtonClickEvent(reactContext: ReactContext, productId: String?, unitId: String?, url: String?, info: FWVideoPlaybackDetails?, callbackId: Int?) {
115
122
  val eventMap = Arguments.createMap()
116
123
  eventMap.putString("productId", productId)
117
124
  eventMap.putString("unitId", unitId)
118
125
  eventMap.putString("url", url)
119
126
  eventMap.putInt("callbackId", callbackId?:0)
127
+ eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
120
128
  sendEvent(reactContext, FWVideoShoppingEventName.CtaButtonClick.rawValue, eventMap)
121
129
  }
122
130
 
123
- fun sendCartIconClickEvent(reactContext: ReactContext, callbackId: Int?) {
131
+ fun sendCartIconClickEvent(reactContext: ReactContext, info: FWVideoPlaybackDetails?, callbackId: Int?) {
124
132
  val eventMap = Arguments.createMap()
125
133
  eventMap.putInt("callbackId", callbackId?:0)
134
+ eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
126
135
  sendEvent(reactContext, FWVideoShoppingEventName.ClickCartIcon.rawValue, eventMap)
127
136
  }
128
137
 
129
- fun sendUpdateProductsDetailsEvent(reactContext: ReactContext, products: List<Product>?, callbackId: String?) {
138
+ fun sendUpdateProductsDetailsEvent(reactContext: ReactContext, products: List<Product>?, info: FWVideoPlaybackDetails?, callbackId: String?) {
130
139
  val eventMap = Arguments.createMap()
131
140
 
132
141
  val productArray = Arguments.createArray()
@@ -137,6 +146,7 @@ object FWEventUtils {
137
146
  }
138
147
 
139
148
  eventMap.putArray("productIds", productArray)
149
+ eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
140
150
  eventMap.putString("callbackId", callbackId)
141
151
 
142
152
  sendLogMessageEvent(reactContext, "[Android] Send UpdateProductDetails event callbackId $callbackId ${FWDateUtils.getDateString(Date())}")
@@ -176,6 +186,12 @@ object FWEventUtils {
176
186
  receiveEvent(reactContext, targetTag, FWFeedViewEventName.VideoFeedLoadFinished.rawValue, eventMap)
177
187
  }
178
188
 
189
+ fun receiveVideoFeedGetFeedIdEvent(reactContext: ReactContext, targetTag: Int, feedId: String?) {
190
+ val eventMap = Arguments.createMap()
191
+ eventMap.putString("feedId", feedId)
192
+ receiveEvent(reactContext, targetTag, FWFeedViewEventName.VideoFeedGetFeedId.rawValue, eventMap)
193
+ }
194
+
179
195
  fun receiveStoryBlockLoadFinishedSuccessEvent(reactContext: ReactContext, targetTag: Int) {
180
196
  receiveEvent(reactContext, targetTag, FWStoryBlockEventName.StoryBlockLoadFinished.rawValue, null)
181
197
  }
@@ -197,6 +213,13 @@ object FWEventUtils {
197
213
  receiveEvent(reactContext, targetTag, FWStoryBlockEventName.StoryBlockFullScreenStateChanged.rawValue, eventMap)
198
214
  }
199
215
 
216
+ fun receiveStoryBlockGetFeedIdEvent(reactContext: ReactContext, targetTag: Int, feedId: String?) {
217
+ val eventMap = Arguments.createMap()
218
+ eventMap.putString("feedId", feedId)
219
+
220
+ receiveEvent(reactContext, targetTag, FWStoryBlockEventName.StoryBlockGetFeedId.rawValue, eventMap)
221
+ }
222
+
200
223
  private fun receiveEvent(reactContext: ReactContext, targetTag: Int, eventName: String, event: WritableMap?) {
201
224
  reactContext.getJSModule(RCTEventEmitter::class.java).receiveEvent(
202
225
  targetTag,
@@ -256,21 +279,23 @@ object FWEventUtils {
256
279
  sendEvent(reactContext, FWEventName.LiveStreamChat.rawValue, eventMap)
257
280
  }
258
281
 
259
- fun sendProductCardClickEvent(reactContext: ReactContext, url: String?, productId: String?, unitId: String?, callbackId: Int?) {
282
+ fun sendProductCardClickEvent(reactContext: ReactContext, url: String?, productId: String?, unitId: String?, info: FWVideoPlaybackDetails?, callbackId: Int?) {
260
283
  val eventMap = Arguments.createMap()
261
284
  eventMap.putString("url", url ?: "")
262
285
  eventMap.putString("productId", productId)
263
286
  eventMap.putString("unitId", unitId)
264
287
  eventMap.putInt("callbackId", callbackId?:0)
288
+ eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
265
289
  sendEvent(reactContext, FWVideoShoppingEventName.CustomProductCardTap.rawValue, eventMap)
266
290
  }
267
291
 
268
- fun sendCustomLinkButtonClickEvent(reactContext: ReactContext, url: String?, productId: String?, unitId: String?, callbackId: Int?) {
292
+ fun sendCustomLinkButtonClickEvent(reactContext: ReactContext, url: String?, productId: String?, unitId: String?, info: FWVideoPlaybackDetails?, callbackId: Int?) {
269
293
  val eventMap = Arguments.createMap()
270
294
  eventMap.putString("url", url ?: "")
271
295
  eventMap.putString("productId", productId)
272
296
  eventMap.putString("unitId", unitId)
273
297
  eventMap.putInt("callbackId", callbackId?:0)
298
+ eventMap.putMap("video", convertVideoPlaybackDetails2Map(info))
274
299
  sendEvent(reactContext, FWVideoShoppingEventName.CustomLinkButtonClick.rawValue, eventMap)
275
300
  }
276
301
  }
@@ -32,6 +32,7 @@ import com.fireworksdk.bridge.models.enums.FWVideoFeedMode
32
32
  import com.fireworksdk.bridge.models.enums.FWVideoFeedSource
33
33
  import com.fireworksdk.bridge.models.enums.FWVideoFeedTitlePosition
34
34
  import com.fireworksdk.bridge.models.enums.FWVideoPlayerCTAWidth
35
+ import com.fireworksdk.bridge.models.enums.FWVideoPlayerLogoOption
35
36
 
36
37
  object FWConfigUtil {
37
38
 
@@ -394,6 +395,18 @@ object FWConfigUtil {
394
395
  }
395
396
  }
396
397
 
398
+ val logoConfigOption = videoFeedPropsModel.videoPlayerConfiguration?.videoPlayerLogoConfiguration?.option
399
+ val logoConfigChannelId = videoFeedPropsModel.videoPlayerConfiguration?.videoPlayerLogoConfiguration?.encodedId
400
+ when {
401
+ logoConfigOption == FWVideoPlayerLogoOption.Creator && !logoConfigChannelId.isNullOrBlank() -> {
402
+ playerOptionBuilder.logoConfig(LogoConfig.Logo.CreatorLogo(logoConfigChannelId))
403
+ }
404
+ logoConfigOption == FWVideoPlayerLogoOption.ChannelAggregator && !logoConfigChannelId.isNullOrBlank() -> {
405
+ playerOptionBuilder.logoConfig(LogoConfig.Logo.AggregatorLogo(logoConfigChannelId))
406
+ }
407
+ else -> {}
408
+ }
409
+
397
410
  return ViewOptions.Builder()
398
411
  .layoutOption(layoutOptionBuilder.build())
399
412
  .titleOption(titleOptionBuilder.build())
@@ -17,7 +17,7 @@ object FWFragmentUtil {
17
17
  fragmentActivity ?: return
18
18
 
19
19
  fragment ?: return
20
- if (!fragment.isAdded || fragment.isDetached || fragment.isRemoving) {
20
+ if (!fragment.isAdded || fragment.isDetached || fragment.isRemoving || fragmentActivity.isFinishing) {
21
21
  return
22
22
  }
23
23
 
@@ -25,7 +25,7 @@ object FWFragmentUtil {
25
25
  removeChildFragment(fragment)
26
26
  }
27
27
 
28
- fragmentActivity.supportFragmentManager.beginTransaction().remove(fragment).commit()
28
+ fragmentActivity.supportFragmentManager.beginTransaction().remove(fragment).commitAllowingStateLoss()
29
29
  }
30
30
 
31
31
  private fun removeChildFragment(fragment: Fragment?) {
@@ -45,7 +45,7 @@ object FWFragmentUtil {
45
45
  if (!fragment.isAdded || fragment.isDetached || fragment.isRemoving) {
46
46
  continue
47
47
  }
48
- cfm.beginTransaction().remove(f).commit()
48
+ cfm.beginTransaction().remove(f).commitAllowingStateLoss()
49
49
  }
50
50
  }
51
51
  }
@@ -1,11 +1,12 @@
1
1
  package com.fireworksdk.bridge.utils
2
2
 
3
- import com.fireworksdk.bridge.components.storyblock.StoryBlockFragment
4
3
  import com.fireworksdk.bridge.models.FWAdBadgeConfigModel
5
- import com.fireworksdk.bridge.models.weakProperty
4
+ import com.fireworksdk.bridge.models.FWSdkInitResultModel
6
5
 
7
6
  object FWGlobalDataUtil {
8
7
 
8
+ var sdkInitResultModel: FWSdkInitResultModel? = null
9
+
9
10
  var adBadgeConfigModel: FWAdBadgeConfigModel = FWAdBadgeConfigModel()
10
11
 
11
12
  var customCTAClickEnabled: Boolean = false
@@ -15,4 +16,6 @@ object FWGlobalDataUtil {
15
16
  var customClickLinkButtonEnabled: Boolean = false
16
17
 
17
18
  var shareBaseUrl: String? = null
19
+
20
+ var pauseWhenNotVisible: Boolean = false
18
21
  }
@@ -0,0 +1,64 @@
1
+ package com.fireworksdk.bridge.utils
2
+
3
+ import com.firework.analyticsevents.VideoInfo
4
+ import com.firework.analyticsevents.cta.CtaButtonClickAnalyticsEvent
5
+ import com.firework.analyticsevents.player.PlayerLifecycleAnalyticsEvent
6
+ import com.firework.analyticsevents.share.ShareButtonAnalyticsEvent
7
+ import com.fireworksdk.bridge.models.FWVideoPlaybackDetails
8
+
9
+ object FWModelUtils {
10
+ fun convertVideoInfo2PlaybackDetails(videoInfo: VideoInfo): FWVideoPlaybackDetails {
11
+ return FWVideoPlaybackDetails(
12
+ badge = videoInfo.badge,
13
+ caption = videoInfo.caption,
14
+ duration = videoInfo.duration,
15
+ hasCta = videoInfo.hasCta,
16
+ playerHeight = videoInfo.playerHeight,
17
+ playerWidth = videoInfo.playerWidth,
18
+ id = videoInfo.id,
19
+ feedId = videoInfo.feedId,
20
+ )
21
+ }
22
+
23
+ fun convertCtaEvent2PlaybackDetails(event: CtaButtonClickAnalyticsEvent): FWVideoPlaybackDetails {
24
+ return FWVideoPlaybackDetails(
25
+ badge = event.videoInfo.badge,
26
+ caption = event.videoInfo.caption,
27
+ duration = event.videoInfo.duration,
28
+ hasCta = true,
29
+ playerHeight = event.videoInfo.playerHeight,
30
+ playerWidth = event.videoInfo.playerWidth,
31
+ id = event.videoInfo.id,
32
+ actionUrl = event.actionUrl,
33
+ feedId = event.videoInfo.feedId,
34
+ )
35
+ }
36
+
37
+ fun convertPlayerEvent2PlaybackDetails(event: PlayerLifecycleAnalyticsEvent): FWVideoPlaybackDetails {
38
+ return FWVideoPlaybackDetails(
39
+ badge = event.videoInfo.badge,
40
+ caption = event.videoInfo.caption,
41
+ duration = event.videoInfo.duration,
42
+ hasCta = event.videoInfo.hasCta,
43
+ playerHeight = event.videoInfo.playerHeight,
44
+ playerWidth = event.videoInfo.playerWidth,
45
+ id = event.videoInfo.id,
46
+ progress = event.progress,
47
+ feedId = event.videoInfo.feedId,
48
+ )
49
+ }
50
+
51
+ fun convertShareButtonEvent2PlaybackDetails(event: ShareButtonAnalyticsEvent): FWVideoPlaybackDetails {
52
+ return FWVideoPlaybackDetails(
53
+ badge = event.videoInfo.badge,
54
+ caption = event.videoInfo.caption,
55
+ duration = event.videoInfo.duration,
56
+ hasCta = event.videoInfo.hasCta,
57
+ playerHeight = event.videoInfo.playerHeight,
58
+ playerWidth = event.videoInfo.playerWidth,
59
+ id = event.videoInfo.id,
60
+ feedId = event.videoInfo.feedId,
61
+ )
62
+ }
63
+
64
+ }
@@ -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,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