@wscsports/blaze-rtn-sdk 1.5.4 → 1.18.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 (168) hide show
  1. package/README.md +4 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/blaze/rtnblazesdk/BlazeSdkModule.kt +321 -6
  4. package/android/src/main/java/com/blaze/rtnblazesdk/base/BaseWidgetView.kt +19 -0
  5. package/android/src/main/java/com/blaze/rtnblazesdk/base/BlazeWidgetViewManager.kt +8 -0
  6. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactMomentPlayerStyleMerger.kt +96 -0
  7. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactMomentsPlayerStyle.kt +58 -4
  8. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactStoriesPlayerStyleMerger.kt +70 -0
  9. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactStoryPlayerStyle.kt +26 -2
  10. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactVideosPlayerStyle.kt +10 -4
  11. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactVideosPlayerStyleMerger.kt +14 -18
  12. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactVisibilityConditionParser.kt +124 -0
  13. package/android/src/main/java/com/blaze/rtnblazesdk/customization/BlazeReactWidgetCommon.kt +14 -0
  14. package/android/src/main/java/com/blaze/rtnblazesdk/events/SdkModuleJsEvent.kt +74 -1
  15. package/android/src/main/java/com/blaze/rtnblazesdk/events/WidgetCustomActionButtonEvent.kt +31 -0
  16. package/android/src/main/java/com/blaze/rtnblazesdk/moments/BlazeMomentsGridView.kt +3 -0
  17. package/android/src/main/java/com/blaze/rtnblazesdk/moments/BlazeMomentsRowView.kt +3 -0
  18. package/android/src/main/java/com/blaze/rtnblazesdk/utils/DataSourceTypeExtractUtils.kt +16 -1
  19. package/android/src/main/java/com/blaze/rtnblazesdk/utils/EventParamsBuilder.kt +64 -0
  20. package/android/src/main/java/com/blaze/rtnblazesdk/utils/MapExtensions.kt +24 -0
  21. package/android/src/main/java/com/blaze/rtnblazesdk/utils/PlaybackConfigurationExtractUtils.kt +54 -0
  22. package/android/src/main/java/com/blaze/rtnblazesdk/videos/BlazeVideosGridView.kt +3 -0
  23. package/android/src/main/java/com/blaze/rtnblazesdk/videos/BlazeVideosRowView.kt +3 -0
  24. package/blaze-rtn-sdk.podspec +2 -2
  25. package/ios/Sources/BlazeNativeSDKModule/BlazeNativeSDKModule.m +67 -0
  26. package/ios/Sources/BlazeNativeSDKModule/BlazeNativeSDKModule.swift +301 -8
  27. package/ios/Sources/BlazeNativeSDKModule/RTNBlazeSdkModule+AppEvents.swift +35 -1
  28. package/ios/Sources/LayoutCustomization/MomentsPlayer/BlazeReactMomentsPlayerStyle.swift +46 -0
  29. package/ios/Sources/LayoutCustomization/MomentsPlayer/BlazeReactMomentsPlayerStyleMerger.swift +109 -0
  30. package/ios/Sources/LayoutCustomization/Shared/BlazeReactVisibilityConditionParser.swift +84 -0
  31. package/ios/Sources/LayoutCustomization/Shared/SharedStyleModels.swift +14 -0
  32. package/ios/Sources/LayoutCustomization/Shared/SharedStyleModelsMerger.swift +48 -0
  33. package/ios/Sources/LayoutCustomization/StoriesPlayer/BlazeReactStoriesPlayerStyle.swift +21 -0
  34. package/ios/Sources/LayoutCustomization/StoriesPlayer/BlazeReactStoriesPlayerStyleMerger.swift +52 -2
  35. package/ios/Sources/LayoutCustomization/VideoPlayer/BlazeReactVideosPlayerStyle.swift +7 -1
  36. package/ios/Sources/LayoutCustomization/VideoPlayer/BlazeReactVideosPlayerStyleMerger.swift +7 -23
  37. package/ios/Sources/Utils/BlazeReactParamsParser.swift +14 -10
  38. package/ios/Sources/Utils/EventParamsBuilder.swift +64 -0
  39. package/ios/Sources/Utils/PlaybackConfigurationExtractUtils.swift +46 -0
  40. package/ios/Sources/Widgets/Base/BlazeWidgetBase.swift +14 -0
  41. package/ios/Sources/Widgets/Base/BlazeWidgetViewManagerBase.h +2 -0
  42. package/ios/Sources/Widgets/BlazeMomentsGridWidget.swift +5 -0
  43. package/ios/Sources/Widgets/BlazeMomentsRowWidget.swift +5 -0
  44. package/ios/Sources/Widgets/BlazeVideosGridWidget.swift +11 -5
  45. package/ios/Sources/Widgets/BlazeVideosRowWidget.swift +10 -6
  46. package/lib/commonjs/NativeBlazeSdk.js +57 -0
  47. package/lib/commonjs/NativeBlazeSdk.js.map +1 -1
  48. package/lib/commonjs/classes/base-player-delegate.js +19 -0
  49. package/lib/commonjs/classes/base-player-delegate.js.map +1 -1
  50. package/lib/commonjs/classes/blaze-widget-overrides-styles.js.map +1 -1
  51. package/lib/commonjs/classes/casting-delegate.js +34 -0
  52. package/lib/commonjs/classes/casting-delegate.js.map +1 -0
  53. package/lib/commonjs/classes/entry-point-delegate.js +37 -2
  54. package/lib/commonjs/classes/entry-point-delegate.js.map +1 -1
  55. package/lib/commonjs/classes/follow-entities-delegate.js +39 -0
  56. package/lib/commonjs/classes/follow-entities-delegate.js.map +1 -0
  57. package/lib/commonjs/classes/global-delegate.js +20 -0
  58. package/lib/commonjs/classes/global-delegate.js.map +1 -1
  59. package/lib/commonjs/classes/pip-delegate.js +34 -0
  60. package/lib/commonjs/classes/pip-delegate.js.map +1 -0
  61. package/lib/commonjs/index.js.map +1 -1
  62. package/lib/commonjs/interfaces/index.js +11 -0
  63. package/lib/commonjs/interfaces/index.js.map +1 -1
  64. package/lib/commonjs/interfaces/moments-playback-configuration.js +2 -0
  65. package/lib/commonjs/interfaces/moments-playback-configuration.js.map +1 -0
  66. package/lib/commonjs/interfaces/search-screen-options.js +6 -0
  67. package/lib/commonjs/interfaces/search-screen-options.js.map +1 -0
  68. package/lib/commonjs/interfaces/videos-playback-configuration.js +2 -0
  69. package/lib/commonjs/interfaces/videos-playback-configuration.js.map +1 -0
  70. package/lib/commonjs/widgets/BlazeBaseWidgetComponent.js +4 -0
  71. package/lib/commonjs/widgets/BlazeBaseWidgetComponent.js.map +1 -1
  72. package/lib/module/NativeBlazeSdk.js +57 -0
  73. package/lib/module/NativeBlazeSdk.js.map +1 -1
  74. package/lib/module/classes/base-player-delegate.js +19 -0
  75. package/lib/module/classes/base-player-delegate.js.map +1 -1
  76. package/lib/module/classes/blaze-widget-overrides-styles.js.map +1 -1
  77. package/lib/module/classes/casting-delegate.js +27 -0
  78. package/lib/module/classes/casting-delegate.js.map +1 -0
  79. package/lib/module/classes/entry-point-delegate.js +37 -3
  80. package/lib/module/classes/entry-point-delegate.js.map +1 -1
  81. package/lib/module/classes/follow-entities-delegate.js +32 -0
  82. package/lib/module/classes/follow-entities-delegate.js.map +1 -0
  83. package/lib/module/classes/global-delegate.js +20 -0
  84. package/lib/module/classes/global-delegate.js.map +1 -1
  85. package/lib/module/classes/pip-delegate.js +27 -0
  86. package/lib/module/classes/pip-delegate.js.map +1 -0
  87. package/lib/module/index.js +0 -1
  88. package/lib/module/index.js.map +1 -1
  89. package/lib/module/interfaces/index.js +1 -0
  90. package/lib/module/interfaces/index.js.map +1 -1
  91. package/lib/module/interfaces/moments-playback-configuration.js +2 -0
  92. package/lib/module/interfaces/moments-playback-configuration.js.map +1 -0
  93. package/lib/module/interfaces/search-screen-options.js +2 -0
  94. package/lib/module/interfaces/search-screen-options.js.map +1 -0
  95. package/lib/module/interfaces/videos-playback-configuration.js +2 -0
  96. package/lib/module/interfaces/videos-playback-configuration.js.map +1 -0
  97. package/lib/module/widgets/BlazeBaseWidgetComponent.js +4 -0
  98. package/lib/module/widgets/BlazeBaseWidgetComponent.js.map +1 -1
  99. package/lib/typescript/NativeBlazeSdk.d.ts +25 -1
  100. package/lib/typescript/NativeBlazeSdk.d.ts.map +1 -1
  101. package/lib/typescript/classes/base-player-delegate.d.ts +17 -8
  102. package/lib/typescript/classes/base-player-delegate.d.ts.map +1 -1
  103. package/lib/typescript/classes/blaze-recommendations-type.d.ts +5 -0
  104. package/lib/typescript/classes/blaze-recommendations-type.d.ts.map +1 -1
  105. package/lib/typescript/classes/blaze-widget-overrides-styles.d.ts +2 -2
  106. package/lib/typescript/classes/blaze-widget-overrides-styles.d.ts.map +1 -1
  107. package/lib/typescript/classes/casting-delegate.d.ts +14 -0
  108. package/lib/typescript/classes/casting-delegate.d.ts.map +1 -0
  109. package/lib/typescript/classes/entry-point-delegate.d.ts +11 -0
  110. package/lib/typescript/classes/entry-point-delegate.d.ts.map +1 -1
  111. package/lib/typescript/classes/follow-entities-delegate.d.ts +18 -0
  112. package/lib/typescript/classes/follow-entities-delegate.d.ts.map +1 -0
  113. package/lib/typescript/classes/global-delegate.d.ts +27 -0
  114. package/lib/typescript/classes/global-delegate.d.ts.map +1 -1
  115. package/lib/typescript/classes/pip-delegate.d.ts +14 -0
  116. package/lib/typescript/classes/pip-delegate.d.ts.map +1 -0
  117. package/lib/typescript/index.d.ts +9 -2
  118. package/lib/typescript/index.d.ts.map +1 -1
  119. package/lib/typescript/interfaces/actions-options.interface.d.ts +14 -0
  120. package/lib/typescript/interfaces/actions-options.interface.d.ts.map +1 -1
  121. package/lib/typescript/interfaces/common.interface.d.ts +64 -0
  122. package/lib/typescript/interfaces/common.interface.d.ts.map +1 -1
  123. package/lib/typescript/interfaces/index.d.ts +1 -0
  124. package/lib/typescript/interfaces/index.d.ts.map +1 -1
  125. package/lib/typescript/interfaces/moments-playback-configuration.d.ts +10 -0
  126. package/lib/typescript/interfaces/moments-playback-configuration.d.ts.map +1 -0
  127. package/lib/typescript/interfaces/moments-player-style.d.ts +32 -1
  128. package/lib/typescript/interfaces/moments-player-style.d.ts.map +1 -1
  129. package/lib/typescript/interfaces/search-screen-options.d.ts +5 -0
  130. package/lib/typescript/interfaces/search-screen-options.d.ts.map +1 -0
  131. package/lib/typescript/interfaces/stories-player-style.d.ts +25 -1
  132. package/lib/typescript/interfaces/stories-player-style.d.ts.map +1 -1
  133. package/lib/typescript/interfaces/videos-playback-configuration.d.ts +20 -0
  134. package/lib/typescript/interfaces/videos-playback-configuration.d.ts.map +1 -0
  135. package/lib/typescript/interfaces/videos-player-style.d.ts +7 -7
  136. package/lib/typescript/interfaces/videos-player-style.d.ts.map +1 -1
  137. package/lib/typescript/interfaces/widgets-props.interface.d.ts +7 -1
  138. package/lib/typescript/interfaces/widgets-props.interface.d.ts.map +1 -1
  139. package/lib/typescript/shared/ads/ads-shared.d.ts +2 -2
  140. package/lib/typescript/shared/ads/ads-shared.d.ts.map +1 -1
  141. package/lib/typescript/widgets/BlazeBaseWidgetComponent.d.ts +1 -0
  142. package/lib/typescript/widgets/BlazeBaseWidgetComponent.d.ts.map +1 -1
  143. package/lib/typescript/widgets/BlazeBaseWidgetViewProps.d.ts +6 -1
  144. package/lib/typescript/widgets/BlazeBaseWidgetViewProps.d.ts.map +1 -1
  145. package/package.json +1 -1
  146. package/src/NativeBlazeSdk.tsx +112 -0
  147. package/src/classes/base-player-delegate.tsx +41 -8
  148. package/src/classes/blaze-recommendations-type.tsx +7 -0
  149. package/src/classes/blaze-widget-overrides-styles.tsx +3 -2
  150. package/src/classes/casting-delegate.tsx +46 -0
  151. package/src/classes/entry-point-delegate.tsx +61 -3
  152. package/src/classes/follow-entities-delegate.tsx +55 -0
  153. package/src/classes/global-delegate.tsx +54 -0
  154. package/src/classes/pip-delegate.tsx +46 -0
  155. package/src/index.tsx +14 -2
  156. package/src/interfaces/actions-options.interface.tsx +15 -0
  157. package/src/interfaces/common.interface.tsx +32 -1
  158. package/src/interfaces/index.tsx +1 -0
  159. package/src/interfaces/moments-playback-configuration.tsx +7 -0
  160. package/src/interfaces/moments-player-style.tsx +40 -1
  161. package/src/interfaces/search-screen-options.tsx +5 -0
  162. package/src/interfaces/stories-player-style.tsx +29 -0
  163. package/src/interfaces/videos-playback-configuration.tsx +22 -0
  164. package/src/interfaces/videos-player-style.tsx +7 -12
  165. package/src/interfaces/widgets-props.interface.tsx +10 -1
  166. package/src/shared/ads/ads-shared.tsx +2 -2
  167. package/src/widgets/BlazeBaseWidgetComponent.tsx +9 -0
  168. package/src/widgets/BlazeBaseWidgetViewProps.tsx +6 -0
package/README.md CHANGED
@@ -3,6 +3,10 @@
3
3
  # Introduction
4
4
  Welcome to WSC Sports React Native SDK.
5
5
 
6
+ ## Platform requirements
7
+
8
+ - iOS: 15.0+
9
+
6
10
  # Getting Started
7
11
  Further details can be found here:<br/>
8
12
  [Getting Started](https://dev.wsc-sports.com/docs/react-native-sdk-init)
@@ -6,7 +6,7 @@ buildscript {
6
6
  blaze_default_compileSdkVersion = 35
7
7
  blaze_default_minSdkVersion = 24
8
8
  blaze_default_kotlin_version = '2.0.21'
9
- blazesdk_version = '1.11.6'
9
+ blazesdk_version = '1.18.0'
10
10
  blaze_gson_version = '2.10.1'
11
11
  }
12
12
 
@@ -2,32 +2,51 @@ package com.blaze.rtnblazesdk
2
2
 
3
3
  import android.util.Log
4
4
  import com.blaze.blazesdk.analytics.models.BlazeAnalyticsEvent
5
+ import com.blaze.blazesdk.delegates.BlazeCastingDelegate
6
+ import com.blaze.blazesdk.delegates.BlazeCastingState
7
+ import com.blaze.blazesdk.delegates.BlazePipDelegate
8
+ import com.blaze.blazesdk.delegates.BlazePipState
9
+ import com.blaze.blazesdk.delegates.BlazeFollowEntitiesDelegate
5
10
  import com.blaze.blazesdk.delegates.BlazePlayerEntryPointDelegate
6
11
  import com.blaze.blazesdk.delegates.BlazeSDKDelegate
7
12
  import com.blaze.blazesdk.delegates.models.BlazeCTAActionType
13
+ import com.blaze.blazesdk.delegates.models.BlazeFollowEntityClickedParams
14
+ import com.blaze.blazesdk.delegates.models.BlazePlaybackModificationRequest
15
+ import com.blaze.blazesdk.delegates.models.BlazePlaybackModificationResponse
16
+ import com.blaze.blazesdk.style.shared.models.BlazePlayerCustomActionButtonParams
8
17
  import com.blaze.blazesdk.delegates.models.BlazePlayerEvent
9
18
  import com.blaze.blazesdk.delegates.models.BlazePlayerType
19
+ import com.blaze.blazesdk.follow.models.BlazeFollowEntity
10
20
  import com.blaze.blazesdk.external_modules.BlazeExternalModulesBinder
21
+ import com.blaze.blazesdk.features.moments.models.configuration.BlazeMomentsLoopBehavior
22
+ import com.blaze.blazesdk.features.moments.models.configuration.BlazeMomentsPlaybackConfiguration
23
+ import com.blaze.blazesdk.features.search.models.BlazeSearchScreenParams
11
24
  import com.blaze.blazesdk.features.shared.models.ui_shared.BlazeLinkActionHandleType
12
25
  import com.blaze.blazesdk.prefetch.models.BlazeCachingLevel
13
26
  import com.blaze.blazesdk.shared.BlazeSDK
14
27
  import com.blaze.blazesdk.shared.models.BlazeEntryPointTriggerSource
15
28
  import com.blaze.blazesdk.shared.results.BlazeResult
16
29
  import com.blaze.rtnblazesdk.events.SdkModuleJsEvent
30
+ import com.blaze.rtnblazesdk.shared.blazeAsyncBridge
31
+ import com.blaze.rtnblazesdk.shared.callJSMethod
17
32
  import com.blaze.rtnblazesdk.utils.extractCachingLevel
18
33
  import com.blaze.rtnblazesdk.utils.extractDataSource
19
34
  import com.blaze.rtnblazesdk.utils.extractMomentsPlayerStyle
20
35
  import com.blaze.rtnblazesdk.utils.extractStoriesPlayerStyle
36
+ import com.blaze.rtnblazesdk.utils.extractMomentsPlaybackConfiguration
37
+ import com.blaze.rtnblazesdk.utils.extractVideosPlaybackConfiguration
21
38
  import com.blaze.rtnblazesdk.utils.extractVideosPlayerStyle
22
39
  import com.blaze.rtnblazesdk.utils.getBooleanOrNull
23
40
  import com.blaze.rtnblazesdk.utils.handleResult
24
41
  import com.blaze.rtnblazesdk.utils.rejectWith
25
42
  import com.facebook.proguard.annotations.DoNotStrip
26
43
  import com.facebook.react.bridge.NoSuchKeyException
44
+ import com.facebook.react.bridge.Arguments
27
45
  import com.facebook.react.bridge.Promise
28
46
  import com.facebook.react.bridge.ReactApplicationContext
29
47
  import com.facebook.react.bridge.ReactContextBaseJavaModule
30
48
  import com.facebook.react.bridge.ReactMethod
49
+ import com.facebook.react.bridge.ReadableArray
31
50
  import com.facebook.react.bridge.ReadableMap
32
51
  import javax.annotation.Nonnull
33
52
 
@@ -51,6 +70,21 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
51
70
  val event = SdkModuleJsEvent.AnalyticEventTriggered(eventData)
52
71
  sendJsEvent(event)
53
72
  }
73
+
74
+ override suspend fun playbackModificationHandler(request: BlazePlaybackModificationRequest): BlazePlaybackModificationResponse {
75
+ val fallbackResponse = request.response()
76
+ val asyncBridge = context.blazeAsyncBridge ?: return fallbackResponse
77
+
78
+ return try {
79
+ asyncBridge.callJSMethod(
80
+ name = PLAYBACK_MODIFICATION_METHOD_NAME,
81
+ params = request,
82
+ )
83
+ } catch (e: Exception) {
84
+ Log.d(TAG, "Error playbackModificationHandler: ${e.message}")
85
+ fallbackResponse
86
+ }
87
+ }
54
88
  }
55
89
 
56
90
  private val playerEntryPointDelegate = object : BlazePlayerEntryPointDelegate {
@@ -117,6 +151,60 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
117
151
  Log.e(TAG, "onPlayerEventTriggered: Exception - $e")
118
152
  }
119
153
  }
154
+
155
+ override fun onTriggerCustomActionButton(
156
+ playerType: BlazePlayerType,
157
+ sourceId: String?,
158
+ customParams: BlazePlayerCustomActionButtonParams
159
+ ) {
160
+ val event = SdkModuleJsEvent.TriggerCustomActionButton(playerType, sourceId, customParams)
161
+ sendJsEvent(event)
162
+ }
163
+
164
+ override fun onReadStatusChanged(
165
+ playerType: BlazePlayerType,
166
+ sourceId: String?,
167
+ dataSourceStringRepresentation: String,
168
+ isEntireContentRead: Boolean,
169
+ itemReadStatus: Map<String, Boolean>
170
+ ) {
171
+ val event = SdkModuleJsEvent.ReadStatusChanged(playerType, sourceId, dataSourceStringRepresentation, isEntireContentRead, itemReadStatus)
172
+ sendJsEvent(event)
173
+ }
174
+ }
175
+
176
+ private val followEntitiesDelegate = object : BlazeFollowEntitiesDelegate {
177
+ override fun onFollowEntityClicked(followEntityParams: BlazeFollowEntityClickedParams) {
178
+ val event = SdkModuleJsEvent.FollowEntityClicked(
179
+ playerType = followEntityParams.playerType,
180
+ sourceId = followEntityParams.sourceId,
181
+ newFollowingState = followEntityParams.newFollowingState,
182
+ followEntityId = followEntityParams.followEntity.entityId
183
+ )
184
+ sendJsEvent(event)
185
+ }
186
+ }
187
+
188
+ private val castingDelegate = object : BlazeCastingDelegate {
189
+ override fun onCastingStateChanged(
190
+ playerType: BlazePlayerType,
191
+ sourceId: String?,
192
+ newState: BlazeCastingState
193
+ ) {
194
+ val event = SdkModuleJsEvent.CastingStateChanged(playerType, sourceId, newState)
195
+ sendJsEvent(event)
196
+ }
197
+ }
198
+
199
+ private val pipDelegate = object : BlazePipDelegate {
200
+ override fun onPipStateChanged(
201
+ playerType: BlazePlayerType,
202
+ sourceId: String?,
203
+ newState: BlazePipState
204
+ ) {
205
+ val event = SdkModuleJsEvent.PiPStateChanged(playerType, sourceId, newState)
206
+ sendJsEvent(event)
207
+ }
120
208
  }
121
209
 
122
210
  init {
@@ -149,6 +237,10 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
149
237
  playerEntryPointDelegate = playerEntryPointDelegate,
150
238
  )
151
239
 
240
+ BlazeSDK.followEntitiesManager.delegate = followEntitiesDelegate
241
+ BlazeSDK.castingManager.delegate = castingDelegate
242
+ BlazeSDK.pipManager.delegate = pipDelegate
243
+
152
244
  val reactStoryPlayerStyle = options.getMap(KEY_INIT_DEFAULT_STORY_PLAYER_STYLE)
153
245
  val reactMomentPlayerStyle = options.getMap(KEY_INIT_DEFAULT_MOMENT_PLAYER_STYLE)
154
246
  val reactVideosPlayerStyle = options.getMap(KEY_INIT_DEFAULT_VIDEO_PLAYER_STYLE)
@@ -222,6 +314,7 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
222
314
  return
223
315
  }
224
316
 
317
+ val entryContentId = options.getString(KEY_ENTRY_POINT_CONTENT_ID)
225
318
  val playerStyle = options.getMap(KEY_ENTRY_POINT_PLAYER_THEME)
226
319
  .extractStoriesPlayerStyle(context)
227
320
  val triggerSource = options.getString("triggerSource")?.asEntryPointTriggerSource
@@ -229,6 +322,7 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
229
322
  val shouldOrderContentByReadStatus = options.getBooleanOrNull("shouldOrderContentByReadStatus") ?: true
230
323
  BlazeSDK.playStories(
231
324
  dataSource = dataSource,
325
+ entryContentId = entryContentId,
232
326
  storyPlayerStyle = playerStyle,
233
327
  triggerSource = triggerSource,
234
328
  shouldOrderContentByReadStatus = shouldOrderContentByReadStatus
@@ -248,7 +342,8 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
248
342
  promise.rejectWith("Error parsing data source for prepareStories")
249
343
  return
250
344
  }
251
- BlazeSDK.prepareStories(dataSource) { result ->
345
+ val entryContentId = options.getString(KEY_ENTRY_POINT_CONTENT_ID)
346
+ BlazeSDK.prepareStories(dataSource = dataSource, entryContentId = entryContentId) { result ->
252
347
  promise.handleResult(result)
253
348
  }
254
349
  } catch (e: Exception) {
@@ -291,6 +386,7 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
291
386
  return
292
387
  }
293
388
 
389
+ val entryContentId = options.getString(KEY_ENTRY_POINT_CONTENT_ID)
294
390
  val playerStyle = options.getMap(KEY_ENTRY_POINT_PLAYER_THEME)
295
391
  .extractMomentsPlayerStyle(context)
296
392
  val triggerSource = options.getString("triggerSource")?.asEntryPointTriggerSource
@@ -298,6 +394,7 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
298
394
  val shouldOrderContentByReadStatus = options.getBooleanOrNull("shouldOrderContentByReadStatus") ?: true
299
395
  BlazeSDK.playMoments(
300
396
  dataSource = dataSource,
397
+ entryContentId = entryContentId,
301
398
  momentsPlayerStyle = playerStyle,
302
399
  triggerSource = triggerSource,
303
400
  shouldOrderContentByReadStatus = shouldOrderContentByReadStatus
@@ -317,7 +414,37 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
317
414
  promise.rejectWith("Error parsing data source for prepareMoments")
318
415
  return
319
416
  }
320
- BlazeSDK.prepareMoments(dataSource) { result ->
417
+ val entryContentId = options.getString(KEY_ENTRY_POINT_CONTENT_ID)
418
+ BlazeSDK.prepareMoments(dataSource = dataSource, entryContentId = entryContentId) { result ->
419
+ promise.handleResult(result)
420
+ }
421
+ } catch (e: Exception) {
422
+ promise.rejectWith(e.toString())
423
+ }
424
+ }
425
+
426
+ @ReactMethod
427
+ @DoNotStrip
428
+ fun appendMomentsToPlayer(options: ReadableMap, promise: Promise) {
429
+ try {
430
+ val sourceId = options.getString(KEY_ENTRY_POINT_SOURCE_ID) ?: run {
431
+ promise.rejectWith("Missing sourceId in appendMomentsToPlayer options")
432
+ return
433
+ }
434
+
435
+ val dataSource = options.getMap(KEY_ENTRY_POINT_DATA_SOURCE)?.extractDataSource() ?: run {
436
+ promise.rejectWith("Error parsing data source for appendMomentsToPlayer")
437
+ return
438
+ }
439
+
440
+ val shouldOrderContentByReadStatus =
441
+ options.getBooleanOrNull("shouldOrderContentByReadStatus") ?: false
442
+
443
+ BlazeSDK.appendMomentsToPlayer(
444
+ sourceId = sourceId,
445
+ dataSourceType = dataSource,
446
+ shouldOrderContentByReadStatus = shouldOrderContentByReadStatus
447
+ ) { result ->
321
448
  promise.handleResult(result)
322
449
  }
323
450
  } catch (e: Exception) {
@@ -338,10 +465,14 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
338
465
  .extractVideosPlayerStyle(context)
339
466
  val triggerSource = options.getString("triggerSource")?.asEntryPointTriggerSource
340
467
  ?: BlazeEntryPointTriggerSource.ENTRYPOINT
468
+ val playbackConfiguration = options.getMap(KEY_ENTRY_POINT_PLAYBACK_CONFIGURATION)
469
+ .extractVideosPlaybackConfiguration()
470
+ ?: BlazeSDK.getDefaultVideosPlaybackConfiguration()
341
471
  BlazeSDK.playVideo(
342
472
  videoId = videoId,
343
473
  videosPlayerStyle = playerStyle,
344
- triggerSource = triggerSource
474
+ triggerSource = triggerSource,
475
+ playbackConfiguration = playbackConfiguration
345
476
  ) { result ->
346
477
  promise.handleResult(result)
347
478
  }
@@ -359,16 +490,22 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
359
490
  return
360
491
  }
361
492
 
493
+ val entryContentId = options.getString(KEY_ENTRY_POINT_CONTENT_ID)
362
494
  val playerStyle = options.getMap(KEY_ENTRY_POINT_PLAYER_THEME)
363
495
  .extractVideosPlayerStyle(context)
364
496
  val triggerSource = options.getString("triggerSource")?.asEntryPointTriggerSource
365
497
  ?: BlazeEntryPointTriggerSource.ENTRYPOINT
366
498
  val shouldOrderContentByReadStatus = options.getBooleanOrNull("shouldOrderContentByReadStatus") ?: true
499
+ val playbackConfiguration = options.getMap(KEY_ENTRY_POINT_PLAYBACK_CONFIGURATION)
500
+ .extractVideosPlaybackConfiguration()
501
+ ?: BlazeSDK.getDefaultVideosPlaybackConfiguration()
367
502
  BlazeSDK.playVideos(
368
503
  dataSource = dataSource,
504
+ entryContentId = entryContentId,
369
505
  videosPlayerStyle = playerStyle,
370
506
  triggerSource = triggerSource,
371
- shouldOrderContentByReadStatus = shouldOrderContentByReadStatus
507
+ shouldOrderContentByReadStatus = shouldOrderContentByReadStatus,
508
+ playbackConfiguration = playbackConfiguration
372
509
  ) { result ->
373
510
  promise.handleResult(result)
374
511
  }
@@ -385,7 +522,8 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
385
522
  promise.rejectWith("Error parsing data source for prepareVideos")
386
523
  return
387
524
  }
388
- BlazeSDK.prepareVideos(dataSource) { result ->
525
+ val entryContentId = options.getString(KEY_ENTRY_POINT_CONTENT_ID)
526
+ BlazeSDK.prepareVideos(dataSource = dataSource, entryContentId = entryContentId) { result ->
389
527
  promise.handleResult(result)
390
528
  }
391
529
  } catch (e: Exception) {
@@ -393,6 +531,82 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
393
531
  }
394
532
  }
395
533
 
534
+ @ReactMethod
535
+ @DoNotStrip
536
+ fun setDefaultVideosPlaybackConfiguration(config: ReadableMap, promise: Promise) {
537
+ try {
538
+ val playbackConfig = (config as ReadableMap?).extractVideosPlaybackConfiguration()
539
+ ?: run {
540
+ promise.rejectWith("Invalid playback configuration")
541
+ return
542
+ }
543
+ BlazeSDK.setDefaultVideosPlaybackConfiguration(playbackConfig)
544
+ promise.resolve(null)
545
+ } catch (e: Exception) {
546
+ promise.rejectWith(e.toString())
547
+ }
548
+ }
549
+
550
+ @ReactMethod
551
+ @DoNotStrip
552
+ fun getDefaultVideosPlaybackConfiguration(promise: Promise) {
553
+ try {
554
+ val config = BlazeSDK.getDefaultVideosPlaybackConfiguration()
555
+ val result = Arguments.createMap().apply {
556
+ putBoolean("multiAspectRatio", config.multiAspectRatio)
557
+ putBoolean("shouldOpenInLandscape", config.shouldOpenOnLandscape)
558
+ putMap("pipConfiguration", Arguments.createMap().apply {
559
+ putBoolean("enterPipOnAppBackground", config.pip.enterPipOnAppBackground)
560
+ })
561
+ }
562
+ promise.resolve(result)
563
+ } catch (e: Exception) {
564
+ promise.rejectWith(e.toString())
565
+ }
566
+ }
567
+
568
+ @ReactMethod
569
+ @DoNotStrip
570
+ fun setDefaultMomentsPlaybackConfiguration(config: ReadableMap, promise: Promise) {
571
+ try {
572
+ val playbackConfig = (config as ReadableMap?).extractMomentsPlaybackConfiguration()
573
+ ?: run {
574
+ promise.rejectWith("Invalid moments playback configuration")
575
+ return
576
+ }
577
+ BlazeSDK.setDefaultMomentsPlaybackConfiguration(playbackConfig)
578
+ promise.resolve(null)
579
+ } catch (e: Exception) {
580
+ promise.rejectWith(e.toString())
581
+ }
582
+ }
583
+
584
+ @ReactMethod
585
+ @DoNotStrip
586
+ fun getDefaultMomentsPlaybackConfiguration(promise: Promise) {
587
+ try {
588
+ val config = BlazeSDK.getDefaultMomentsPlaybackConfiguration()
589
+ val result = Arguments.createMap().apply {
590
+ val loopBehavior = Arguments.createMap().apply {
591
+ when (config.loopBehavior) {
592
+ is BlazeMomentsLoopBehavior.InfiniteLoop -> {
593
+ putString("type", "infiniteLoop")
594
+ }
595
+ is BlazeMomentsLoopBehavior.LoopAndAdvance -> {
596
+ putString("type", "loopAndAdvance")
597
+ putInt("numberOfPlays",
598
+ (config.loopBehavior as BlazeMomentsLoopBehavior.LoopAndAdvance).numberOfPlays)
599
+ }
600
+ }
601
+ }
602
+ putMap("loopBehavior", loopBehavior)
603
+ }
604
+ promise.resolve(result)
605
+ } catch (e: Exception) {
606
+ promise.rejectWith(e.toString())
607
+ }
608
+ }
609
+
396
610
  @ReactMethod
397
611
  @DoNotStrip
398
612
  fun dismissPlayer(promise: Promise) {
@@ -421,6 +635,13 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
421
635
  promise.resolve(doNotTrack)
422
636
  }
423
637
 
638
+ @ReactMethod
639
+ @DoNotStrip
640
+ fun setDisableAnalytics(disableAnalytics: Boolean, promise: Promise) {
641
+ BlazeSDK.disableAnalytics = disableAnalytics
642
+ promise.resolve(disableAnalytics)
643
+ }
644
+
424
645
  @ReactMethod
425
646
  @DoNotStrip
426
647
  fun handleUniversalLink(link: String, promise: Promise) {
@@ -484,6 +705,97 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
484
705
  }
485
706
  }
486
707
 
708
+ @ReactMethod
709
+ @DoNotStrip
710
+ fun setFollowedEntities(entityIds: ReadableArray, promise: Promise) {
711
+ try {
712
+ val entities = (0 until entityIds.size()).mapNotNull { entityIds.getString(it)?.let { id -> BlazeFollowEntity(id) } }.toSet()
713
+ BlazeSDK.followEntitiesManager.setFollowedEntities(entities)
714
+ promise.resolve(null)
715
+ } catch (e: Exception) {
716
+ promise.rejectWith(e.toString())
717
+ }
718
+ }
719
+
720
+ @ReactMethod
721
+ @DoNotStrip
722
+ fun insertFollowedEntities(entityIds: ReadableArray, promise: Promise) {
723
+ try {
724
+ val entities = (0 until entityIds.size()).mapNotNull { entityIds.getString(it)?.let { id -> BlazeFollowEntity(id) } }.toSet()
725
+ BlazeSDK.followEntitiesManager.insertFollowedEntities(entities)
726
+ promise.resolve(null)
727
+ } catch (e: Exception) {
728
+ promise.rejectWith(e.toString())
729
+ }
730
+ }
731
+
732
+ @ReactMethod
733
+ @DoNotStrip
734
+ fun removeFollowedEntities(entityIds: ReadableArray, promise: Promise) {
735
+ try {
736
+ val entities = (0 until entityIds.size()).mapNotNull { entityIds.getString(it)?.let { id -> BlazeFollowEntity(id) } }.toSet()
737
+ BlazeSDK.followEntitiesManager.removeFollowedEntities(entities)
738
+ promise.resolve(null)
739
+ } catch (e: Exception) {
740
+ promise.rejectWith(e.toString())
741
+ }
742
+ }
743
+
744
+ @ReactMethod
745
+ @DoNotStrip
746
+ fun getFollowedEntities(promise: Promise) {
747
+ try {
748
+ val entities = BlazeSDK.followEntitiesManager.getFollowedEntities()
749
+ val ids = Arguments.createArray().apply {
750
+ entities.forEach { pushString(it.entityId) }
751
+ }
752
+ promise.resolve(ids)
753
+ } catch (e: Exception) {
754
+ promise.rejectWith(e.toString())
755
+ }
756
+ }
757
+
758
+ @ReactMethod
759
+ @DoNotStrip
760
+ fun setPreferredLanguage(language: String?, promise: Promise) {
761
+ BlazeSDK.setPreferredLanguage(language)
762
+ promise.resolve(null)
763
+ }
764
+
765
+ @ReactMethod
766
+ @DoNotStrip
767
+ fun showSearchScreen(options: ReadableMap, promise: Promise) {
768
+ val dataSourceType = options.getMap("suggestionsDataSource")?.extractDataSource()
769
+ if (dataSourceType == null) {
770
+ promise.rejectWith("suggestionsDataSource is required on Android")
771
+ return
772
+ }
773
+ val searchParams = BlazeSearchScreenParams(suggestionsDataSource = dataSourceType)
774
+ BlazeSDK.screens.showSearchScreen(searchParams = searchParams) { result ->
775
+ promise.handleResult(result)
776
+ }
777
+ }
778
+
779
+ @ReactMethod
780
+ @DoNotStrip
781
+ fun stopActiveCastingSession(promise: Promise) {
782
+ BlazeSDK.castingManager.stopActiveCastingSession()
783
+ promise.resolve(null)
784
+ }
785
+
786
+ @ReactMethod
787
+ @DoNotStrip
788
+ fun stopActivePiPSession(promise: Promise) {
789
+ BlazeSDK.pipManager.stopActivePiPSession()
790
+ promise.resolve(null)
791
+ }
792
+
793
+ @ReactMethod
794
+ @DoNotStrip
795
+ fun isPiPActive(promise: Promise) {
796
+ promise.resolve(BlazeSDK.pipManager.isActive)
797
+ }
798
+
487
799
  companion object {
488
800
  const val NAME = "RTNBlazeSdk"
489
801
 
@@ -504,7 +816,10 @@ class BlazeSdkModule(private val context: ReactApplicationContext): ReactContext
504
816
  const val KEY_VIDEO_OPT_VIDEO_ID = "videoId"
505
817
  const val KEY_ENTRY_POINT_DATA_SOURCE = "dataSource"
506
818
  const val KEY_ENTRY_POINT_PLAYER_THEME = "playerStyle"
507
-
819
+ const val KEY_ENTRY_POINT_SOURCE_ID = "sourceId"
820
+ const val KEY_ENTRY_POINT_CONTENT_ID = "entryContentId"
821
+ const val KEY_ENTRY_POINT_PLAYBACK_CONFIGURATION = "playbackConfiguration"
822
+ private const val PLAYBACK_MODIFICATION_METHOD_NAME = "Blaze.GlobalDelegate.playbackModificationHandler"
508
823
  }
509
824
 
510
825
  }
@@ -26,10 +26,12 @@ import com.blaze.rtnblazesdk.events.WidgetDataLoadCompletedEvent
26
26
  import com.blaze.rtnblazesdk.events.WidgetDataLoadStartedEvent
27
27
  import com.blaze.rtnblazesdk.events.WidgetHeightChangedEvent
28
28
  import com.blaze.rtnblazesdk.events.WidgetItemClickedEvent
29
+ import com.blaze.rtnblazesdk.events.WidgetCustomActionButtonEvent
29
30
  import com.blaze.rtnblazesdk.events.WidgetOnPlayerEventTriggered
30
31
  import com.blaze.rtnblazesdk.events.WidgetOnTriggerPlayerBodyTextLinkEvent
31
32
  import com.blaze.rtnblazesdk.events.WidgetPlayerDidAppearEvent
32
33
  import com.blaze.rtnblazesdk.events.WidgetPlayerDismissedEvent
34
+ import com.blaze.blazesdk.style.shared.models.BlazePlayerCustomActionButtonParams
33
35
  import com.blaze.rtnblazesdk.utils.extractCachingLevel
34
36
  import com.blaze.rtnblazesdk.utils.extractDataSource
35
37
  import com.blaze.rtnblazesdk.utils.getBooleanOrNull
@@ -61,6 +63,7 @@ abstract class BaseWidgetView @JvmOverloads constructor(
61
63
  var reactWidgetLayoutStyleMap: ReadableMap? = null
62
64
  var reactWidgetPlayerStyleMap: ReadableMap? = null
63
65
  var nativeWidgetLayout: BlazeWidgetLayout? = null
66
+ var reactWidgetPlaybackConfigurationMap: ReadableMap? = null
64
67
 
65
68
  val cachingLevel: BlazeCachingLevel
66
69
  get() = reactCachingLevel?.extractCachingLevel() ?: BlazeSdkModuleRepo.cachingLevel ?: BlazeCachingLevel.DEFAULT
@@ -182,6 +185,22 @@ abstract class BaseWidgetView @JvmOverloads constructor(
182
185
  )
183
186
  )
184
187
  }
188
+
189
+ override fun onTriggerCustomActionButton(
190
+ playerType: BlazePlayerType,
191
+ sourceId: String?,
192
+ customParams: BlazePlayerCustomActionButtonParams
193
+ ) {
194
+ dispatchEvent(
195
+ WidgetCustomActionButtonEvent(
196
+ UIManagerHelper.getSurfaceId(context),
197
+ id,
198
+ playerType = playerType,
199
+ sourceId = sourceId,
200
+ customParams = customParams
201
+ )
202
+ )
203
+ }
185
204
  }
186
205
 
187
206
  abstract fun callInitWidget(dataSource: BlazeDataSourceType)
@@ -2,6 +2,7 @@ package com.blaze.rtnblazesdk.base
2
2
 
3
3
  import androidx.annotation.Keep
4
4
  import com.blaze.rtnblazesdk.events.WidgetCTAClickEvent
5
+ import com.blaze.rtnblazesdk.events.WidgetCustomActionButtonEvent
5
6
  import com.blaze.rtnblazesdk.events.WidgetDataLoadCompletedEvent
6
7
  import com.blaze.rtnblazesdk.events.WidgetDataLoadStartedEvent
7
8
  import com.blaze.rtnblazesdk.events.WidgetHeightChangedEvent
@@ -42,6 +43,7 @@ abstract class BlazeWidgetViewManager<TWidget : BaseWidgetView>(
42
43
  WidgetCTAClickEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onTriggerCTAInternal")),
43
44
  WidgetOnTriggerPlayerBodyTextLinkEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onTriggerPlayerBodyTextLinkInternal")),
44
45
  WidgetOnPlayerEventTriggered.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onPlayerEventTriggeredInternal")),
46
+ WidgetCustomActionButtonEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onTriggerCustomActionButtonInternal")),
45
47
  WidgetHeightChangedEvent.EVENT_NAME to mapOf(Pair(KEY_EVENT_REGISTRATION_NAME, "onHeightChangedInternal")),
46
48
  )
47
49
  return map
@@ -128,6 +130,12 @@ abstract class BlazeWidgetViewManager<TWidget : BaseWidgetView>(
128
130
  view.reactWidgetPlayerStyleMap = value
129
131
  }
130
132
 
133
+ @Keep
134
+ @ReactProp(name = "playbackConfiguration")
135
+ fun setPlaybackConfiguration(view: TWidget, value: ReadableMap?) {
136
+ view.reactWidgetPlaybackConfigurationMap = value
137
+ }
138
+
131
139
  //---------- Props for Grids ----------//
132
140
 
133
141
  @Keep