react-native-firework-sdk 2.3.1 → 2.4.0-beta.2

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 (119) hide show
  1. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  2. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  3. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +24 -10
  4. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +1 -1
  5. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  6. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +1 -1
  7. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  8. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  9. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +24 -10
  10. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1 -1
  11. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  12. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -1
  13. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +24 -10
  14. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1 -1
  15. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  16. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1 -1
  17. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +21 -21
  18. package/android/gradle.properties +1 -1
  19. package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +20 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +1 -69
  21. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +3 -1
  22. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelDeserializer.kt +21 -4
  23. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelSerializer.kt +15 -3
  24. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +2 -1
  25. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +3 -0
  26. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +2 -0
  27. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoFeedSource.kt +3 -1
  28. package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +6 -0
  29. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +20 -15
  30. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +45 -16
  31. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +5 -0
  32. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +11 -1
  33. package/android/src/main/java/com/fireworksdk/bridge/utils/FWImageLoaderUtil.kt +16 -0
  34. package/ios/Components/StoryBlock.swift +9 -7
  35. package/ios/Components/StoryBlockConfiguration.swift +13 -0
  36. package/ios/Components/StoryBlockManager.m +6 -1
  37. package/ios/Components/VideoFeed.swift +5 -10
  38. package/ios/Components/VideoFeedManager.m +1 -2
  39. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  40. package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -26
  41. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +13 -2
  42. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -34
  43. package/ios/FireworkVideoUI/Podfile +1 -1
  44. package/ios/FireworkVideoUI/Podfile.lock +4 -4
  45. package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +1 -0
  46. package/ios/Models/RNToNative/RCTConvert+StoryBlock.swift +16 -1
  47. package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
  48. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +8 -4
  49. package/ios/Modules/Shopping/ShoppingModule.swift +6 -5
  50. package/ios/react_native_firework_sdk.h +0 -1
  51. package/lib/commonjs/FireworkSDK.js.map +1 -1
  52. package/lib/commonjs/components/StoryBlock.js +71 -33
  53. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  54. package/lib/commonjs/components/VideoFeed.js +83 -57
  55. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  56. package/lib/commonjs/index.js.map +1 -1
  57. package/lib/commonjs/models/OpenVideoPlayerConfiguration.js +2 -0
  58. package/lib/commonjs/models/OpenVideoPlayerConfiguration.js.map +1 -0
  59. package/lib/commonjs/models/StoryBlockNativeConfiguration.js +2 -0
  60. package/lib/commonjs/models/StoryBlockNativeConfiguration.js.map +1 -0
  61. package/lib/commonjs/models/VideoPlayerNativeConfiguration.js +2 -0
  62. package/lib/commonjs/models/VideoPlayerNativeConfiguration.js.map +1 -0
  63. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  64. package/lib/module/FireworkSDK.js.map +1 -1
  65. package/lib/module/components/StoryBlock.js +67 -33
  66. package/lib/module/components/StoryBlock.js.map +1 -1
  67. package/lib/module/components/VideoFeed.js +79 -57
  68. package/lib/module/components/VideoFeed.js.map +1 -1
  69. package/lib/module/index.js.map +1 -1
  70. package/lib/module/models/OpenVideoPlayerConfiguration.js +2 -0
  71. package/lib/module/models/OpenVideoPlayerConfiguration.js.map +1 -0
  72. package/lib/module/models/StoryBlockNativeConfiguration.js +2 -0
  73. package/lib/module/models/StoryBlockNativeConfiguration.js.map +1 -0
  74. package/lib/module/models/VideoPlayerNativeConfiguration.js +2 -0
  75. package/lib/module/models/VideoPlayerNativeConfiguration.js.map +1 -0
  76. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  77. package/lib/typescript/FireworkSDK.d.ts +2 -2
  78. package/lib/typescript/components/StoryBlock.d.ts +8 -0
  79. package/lib/typescript/components/VideoFeed.d.ts +8 -1
  80. package/lib/typescript/index.d.ts +2 -1
  81. package/lib/typescript/models/AdBadgeConfiguration.d.ts +3 -0
  82. package/lib/typescript/models/AndroidFontInfo.d.ts +1 -1
  83. package/lib/typescript/models/OpenVideoPlayerConfiguration.d.ts +7 -0
  84. package/lib/typescript/models/Product.d.ts +1 -1
  85. package/lib/typescript/models/ProductUnit.d.ts +1 -1
  86. package/lib/typescript/models/StoryBlockConfiguration.d.ts +1 -1
  87. package/lib/typescript/models/StoryBlockNativeConfiguration.d.ts +7 -0
  88. package/lib/typescript/models/StoryBlockSource.d.ts +1 -1
  89. package/lib/typescript/models/VideoFeedConfiguration.d.ts +29 -4
  90. package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
  91. package/lib/typescript/models/VideoPlayerCTAStyle.d.ts +6 -0
  92. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +10 -1
  93. package/lib/typescript/models/VideoPlayerNativeConfiguration.d.ts +7 -0
  94. package/lib/typescript/modules/FireworkSDKModule.d.ts +2 -2
  95. package/package.json +2 -2
  96. package/react-native-firework-sdk.podspec +1 -1
  97. package/src/FireworkSDK.ts +2 -2
  98. package/src/components/StoryBlock.tsx +65 -36
  99. package/src/components/VideoFeed.tsx +87 -74
  100. package/src/index.ts +2 -0
  101. package/src/models/AdBadgeConfiguration.ts +3 -0
  102. package/src/models/AndroidFontInfo.ts +1 -1
  103. package/src/models/OpenVideoPlayerConfiguration.ts +9 -0
  104. package/src/models/Product.ts +1 -1
  105. package/src/models/ProductUnit.ts +1 -1
  106. package/src/models/StoryBlockConfiguration.ts +1 -1
  107. package/src/models/StoryBlockNativeConfiguration.ts +9 -0
  108. package/src/models/StoryBlockSource.ts +2 -1
  109. package/src/models/VideoFeedConfiguration.ts +29 -4
  110. package/src/models/VideoFeedSource.ts +2 -1
  111. package/src/models/VideoPlayerCTAStyle.ts +6 -0
  112. package/src/models/VideoPlayerConfiguration.ts +10 -1
  113. package/src/models/VideoPlayerNativeConfiguration.ts +9 -0
  114. package/src/modules/FireworkSDKModule.ts +2 -2
  115. package/ios/Modules/Shopping/FWCartViewController.swift +0 -14
  116. package/ios/Utils/Extensions/Swizzle/UINavigationController+FWSwizzle.swift +0 -31
  117. package/ios/Utils/FWSwizzleLoader.h +0 -15
  118. package/ios/Utils/FWSwizzleLoader.m +0 -21
  119. package/ios/Utils/FWSwizzleLoader.swift +0 -13
@@ -12,9 +12,11 @@ object FWVideoFeedPropsModelSerializer {
12
12
  private const val PLAYLIST_KEY = "playlist"
13
13
  private const val PLAYLIST_GROUP_KEY = "playlistGroup"
14
14
  private const val HASHTAG_FILTER_EXPRESSION_KEY = "hashtagFilterExpression"
15
+ private const val PRODUCT_IDS_KEY = "productIds"
16
+ private const val SHARE_URL_KEY = "shareUrl"
15
17
  private const val MODE_KEY = "mode"
16
- private const val ENABLE_PIP_KEY = "enablePictureInPicture"
17
18
  private const val MARGIN_RIGHT_KEY = "marginRight"
19
+ private const val CORNER_RADIUS_KEY = "cornerRadius"
18
20
 
19
21
  private const val VIDEO_FEED_CONFIGURATION_KEY = "videoFeedConfiguration"
20
22
  private const val VIDEO_PLAYER_CONFIGURATION_KEY = "videoPlayerConfiguration"
@@ -28,8 +30,17 @@ object FWVideoFeedPropsModelSerializer {
28
30
  jsonObject.put(PLAYLIST_KEY, model.playlist)
29
31
  jsonObject.put(PLAYLIST_GROUP_KEY, model.playlistGroup)
30
32
  jsonObject.put(HASHTAG_FILTER_EXPRESSION_KEY, model.hashtagFilterExpression)
33
+
34
+ if (model.productIds != null ) {
35
+ val productIdJsonArray = JSONArray()
36
+ for (item in model.productIds) {
37
+ productIdJsonArray.put(item)
38
+ }
39
+ jsonObject.put(PRODUCT_IDS_KEY, productIdJsonArray)
40
+ }
41
+
42
+ jsonObject.put(SHARE_URL_KEY, model.shareUrl)
31
43
  jsonObject.put(MODE_KEY, FWVideoFeedMode.serialize(model.mode))
32
- jsonObject.put(ENABLE_PIP_KEY, model.enablePictureInPicture)
33
44
  jsonObject.put(VIDEO_FEED_CONFIGURATION_KEY, FWVideoFeedConfigModelSerializer.serialize(model.videoFeedConfiguration))
34
45
  jsonObject.put(VIDEO_PLAYER_CONFIGURATION_KEY, FWVideoPlayerConfigModelSerializer.serialize(model.videoPlayerConfiguration))
35
46
 
@@ -50,7 +61,8 @@ object FWVideoFeedPropsModelSerializer {
50
61
  }
51
62
 
52
63
  jsonObject.put(MARGIN_RIGHT_KEY, model.marginRight)
64
+ jsonObject.put(CORNER_RADIUS_KEY, model.cornerRadius)
53
65
 
54
66
  return jsonObject
55
67
  }
56
- }
68
+ }
@@ -17,7 +17,8 @@ data class FWVideoPlayerConfigModel(
17
17
  val ctaHighlightDelay: FWCtaDelayModel? = null,
18
18
  val shareBaseUrl: String? = null,
19
19
  val ctaWidth: FWVideoPlayerCTAWidth? = null,
20
- ) {
20
+ val enablePictureInPicture: Boolean? = null,
21
+ ) {
21
22
 
22
23
  data class FWCtaButtonStyleModel(
23
24
  val backgroundColor: String? = null,
@@ -19,6 +19,7 @@ object FWVideoPlayerConfigModelDeserializer {
19
19
  private const val CTA_HIGHLIGHT_DELAY_KEY = "ctaHighlightDelay"
20
20
  private const val SHARE_BASE_URL_KEY = "shareBaseURL"
21
21
  private const val CTA_WIDTH_KEY = "ctaWidth"
22
+ private const val ENABLE_PIP_KEY = "enablePictureInPicture"
22
23
 
23
24
  private const val BACKGROUND_COLOR_KEY = "backgroundColor"
24
25
  private const val FONT_SIZE_KEY = "fontSize"
@@ -41,6 +42,7 @@ object FWVideoPlayerConfigModelDeserializer {
41
42
  val ctaHighlightDelay = deserializeCtaDelay(responseJson.optJSONObject(CTA_HIGHLIGHT_DELAY_KEY))
42
43
  val shareBaseUrl = if (responseJson.has(SHARE_BASE_URL_KEY)) responseJson.optString(SHARE_BASE_URL_KEY) else null
43
44
  val ctaWidth = if (responseJson.has(CTA_WIDTH_KEY)) responseJson.optString(CTA_WIDTH_KEY) else null
45
+ val enablePictureInPicture = if (responseJson.has(ENABLE_PIP_KEY)) responseJson.optBoolean(ENABLE_PIP_KEY) else null
44
46
 
45
47
  return FWVideoPlayerConfigModel(
46
48
  playerStyle = if (!playerStyle.isNullOrBlank()) FWPlayerStyle.deserialize(playerStyle) else null,
@@ -54,6 +56,7 @@ object FWVideoPlayerConfigModelDeserializer {
54
56
  ctaHighlightDelay = ctaHighlightDelay,
55
57
  shareBaseUrl = shareBaseUrl,
56
58
  ctaWidth = if (!ctaWidth.isNullOrBlank()) FWVideoPlayerCTAWidth.deserialize(ctaWidth) else null,
59
+ enablePictureInPicture = enablePictureInPicture
57
60
  )
58
61
  }
59
62
 
@@ -19,6 +19,7 @@ object FWVideoPlayerConfigModelSerializer {
19
19
  private const val CTA_HIGHLIGHT_DELAY_KEY = "ctaHighlightDelay"
20
20
  private const val SHARE_BASE_URL_KEY = "shareBaseURL"
21
21
  private const val CTA_WIDTH_KEY = "ctaWidth"
22
+ private const val ENABLE_PIP_KEY = "enablePictureInPicture"
22
23
 
23
24
  private const val BACKGROUND_COLOR_KEY = "backgroundColor"
24
25
  private const val FONT_SIZE_KEY = "fontSize"
@@ -41,6 +42,7 @@ object FWVideoPlayerConfigModelSerializer {
41
42
  jsonObject.put(CTA_HIGHLIGHT_DELAY_KEY, serializeCtaDelay(model.ctaHighlightDelay))
42
43
  jsonObject.put(SHARE_BASE_URL_KEY, model.shareBaseUrl)
43
44
  jsonObject.put(CTA_WIDTH_KEY, FWVideoPlayerCTAWidth.serialize(model.ctaWidth))
45
+ jsonObject.put(ENABLE_PIP_KEY, model.enablePictureInPicture)
44
46
  return jsonObject
45
47
  }
46
48
 
@@ -6,7 +6,9 @@ enum class FWVideoFeedSource(val rawValue: String) {
6
6
  Playlist("playlist"),
7
7
  DynamicContent("dynamicContent"),
8
8
  PlaylistGroup("playlistGroup"),
9
- HashtagPlaylist("hashtagPlaylist");
9
+ HashtagPlaylist("hashtagPlaylist"),
10
+ Sku("sku"),
11
+ ShareUrl("shareUrl");
10
12
 
11
13
  companion object {
12
14
  fun deserialize(rawValue: String?): FWVideoFeedSource? {
@@ -2,7 +2,9 @@ package com.fireworksdk.bridge.reactnative
2
2
 
3
3
  import android.app.Activity
4
4
  import android.content.Context
5
+ import com.firework.imageloading.ImageLoader
5
6
  import com.firework.livestream.LivestreamPlayerInitializer
7
+ import com.fireworksdk.bridge.utils.FWImageLoaderUtil
6
8
  import com.fireworksdk.bridge.utils.FWLanguageUtil
7
9
  import com.fireworksdk.bridge.utils.FWLiveStreamUtil
8
10
 
@@ -12,6 +14,10 @@ object FWReactNativeSDK {
12
14
  FWLiveStreamUtil.addLivestreamPlayerInitializer(initializer)
13
15
  }
14
16
 
17
+ fun setImageLoader(imageLoader: ImageLoader?) {
18
+ FWImageLoaderUtil.setImageLoader(imageLoader)
19
+ }
20
+
15
21
  fun updateBaseContextLocale(context: Context): Context {
16
22
  return FWLanguageUtil.getInstance(context).updateBaseContextLocale(context)
17
23
  }
@@ -99,18 +99,26 @@ class FWStoryBlockManager : ViewGroupManager<StoryBlockFrameLayout>() {
99
99
  }
100
100
 
101
101
  @Suppress("UNCHECKED_CAST")
102
- @ReactProp(name = "dynamicContentParameters")
103
- fun setDynamicContentParameters(view: StoryBlockFrameLayout, parameters: ReadableMap?) {
104
- val parametersMap = parameters?.toHashMap() as? HashMap<String, List<String>>
102
+ @ReactProp(name = "productIds")
103
+ fun setProductIds(view: StoryBlockFrameLayout, productIdArray: ReadableArray?) {
105
104
  view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
106
- dynamicContentParameters = parametersMap
105
+ productIds = productIdArray?.toArrayList() as ArrayList<String>?
107
106
  )
108
107
  }
109
108
 
110
- @ReactProp(name = "enablePictureInPicture")
111
- fun setEnablePictureInPicture(view: StoryBlockFrameLayout, enablePictureInPicture: Boolean?) {
109
+ @ReactProp(name = "shareUrl")
110
+ fun setShareUrl(view: StoryBlockFrameLayout, shareUrl: String?) {
112
111
  view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
113
- enablePictureInPicture = enablePictureInPicture
112
+ shareUrl = shareUrl
113
+ )
114
+ }
115
+
116
+ @Suppress("UNCHECKED_CAST")
117
+ @ReactProp(name = "dynamicContentParameters")
118
+ fun setDynamicContentParameters(view: StoryBlockFrameLayout, parameters: ReadableMap?) {
119
+ val parametersMap = parameters?.toHashMap() as? HashMap<String, List<String>>
120
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
121
+ dynamicContentParameters = parametersMap
114
122
  )
115
123
  }
116
124
 
@@ -124,8 +132,8 @@ class FWStoryBlockManager : ViewGroupManager<StoryBlockFrameLayout>() {
124
132
  )
125
133
  }
126
134
 
127
- @ReactProp(name = "videoPlayerConfiguration")
128
- fun setVideoPlayerConfig(view: StoryBlockFrameLayout, config: ReadableMap?) {
135
+ @ReactProp(name = "storyBlockConfiguration")
136
+ fun setStoryBlockConfig(view: StoryBlockFrameLayout, config: ReadableMap?) {
129
137
  val configMap = config?.toHashMap() ?: hashMapOf()
130
138
  val jsonObject = JSONObject(configMap)
131
139
  val videoPlayerConfigModel = FWVideoPlayerConfigModelDeserializer.deserialize(jsonObject)
@@ -134,13 +142,10 @@ class FWStoryBlockManager : ViewGroupManager<StoryBlockFrameLayout>() {
134
142
  )
135
143
  }
136
144
 
137
- @ReactProp(name = "storyBlockConfiguration")
138
- fun setStoryBlockConfig(view: StoryBlockFrameLayout, config: ReadableMap?) {
139
- val configMap = config?.toHashMap() ?: hashMapOf()
140
- val jsonObject = JSONObject(configMap)
141
- val videoPlayerConfigModel = FWVideoPlayerConfigModelDeserializer.deserialize(jsonObject)
145
+ @ReactProp(name = "cornerRadius")
146
+ fun setCornerRadius(view: StoryBlockFrameLayout, cornerRadius: Int?) {
142
147
  view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
143
- videoPlayerConfiguration = videoPlayerConfigModel
148
+ cornerRadius = cornerRadius
144
149
  )
145
150
  }
146
151
 
@@ -15,6 +15,8 @@ import com.fireworksdk.bridge.models.FWVideoFeedConfigModelDeserializer
15
15
  import com.fireworksdk.bridge.models.FWVideoFeedItemDetailsModel
16
16
  import com.fireworksdk.bridge.models.FWVideoPlayerConfigModelDeserializer
17
17
  import com.fireworksdk.bridge.models.enums.FWFeedViewEventName
18
+ import com.fireworksdk.bridge.models.enums.FWVideoFeedMode
19
+ import com.fireworksdk.bridge.models.enums.FWVideoFeedSource
18
20
  import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
19
21
  import com.fireworksdk.bridge.utils.FWLogUtils
20
22
  import org.json.JSONObject
@@ -43,49 +45,72 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
43
45
 
44
46
  override fun onAfterUpdateTransaction(view: FWVideoFeed) {
45
47
  super.onAfterUpdateTransaction(view)
46
- view.afterUpdateTransaction()
48
+ view.initVideoFeedView()
47
49
  }
48
50
 
49
51
  @ReactProp(name = "source")
50
52
  fun setSource(view: FWVideoFeed, source: String?) {
51
- view.setSourceProps(source)
53
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
54
+ source = if (!source.isNullOrBlank()) FWVideoFeedSource.deserialize(source) else null
55
+ )
52
56
  }
53
57
 
54
58
  @ReactProp(name = "channel")
55
59
  fun setChannel(view: FWVideoFeed, channel: String?) {
56
- view.setChannelProps(channel)
60
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
61
+ channel = channel
62
+ )
57
63
  }
58
64
 
59
65
  @ReactProp(name = "playlist")
60
66
  fun setPlaylist(view: FWVideoFeed, playlist: String?) {
61
- view.setPlaylistProps(playlist)
67
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
68
+ playlist = playlist
69
+ )
62
70
  }
63
71
 
64
72
  @ReactProp(name = "playlistGroup")
65
73
  fun setPlaylistGroup(view: FWVideoFeed, playlistGroup: String?) {
66
- view.setPlaylistGroupProps(playlistGroup)
74
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
75
+ playlistGroup = playlistGroup
76
+ )
67
77
  }
68
78
 
69
79
  @ReactProp(name = "hashtagFilterExpression")
70
80
  fun setHashtagFilterExpression(view: FWVideoFeed, hashtagFilterExpression: String?) {
71
- view.setHashtagFilterExpressionProps(hashtagFilterExpression)
81
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
82
+ hashtagFilterExpression = hashtagFilterExpression
83
+ )
72
84
  }
73
85
 
74
- @ReactProp(name = "mode")
75
- fun setMode(view: FWVideoFeed, mode: String?) {
76
- view.setModeProps(mode)
86
+ @Suppress("UNCHECKED_CAST")
87
+ @ReactProp(name = "productIds")
88
+ fun setProductIds(view: FWVideoFeed, productIdArray: ReadableArray?) {
89
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
90
+ productIds = productIdArray?.toArrayList() as ArrayList<String>?
91
+ )
77
92
  }
78
93
 
79
- @ReactProp(name = "enablePictureInPicture")
80
- fun setEnablePictureInPicture(view: FWVideoFeed, enablePictureInPicture: Boolean?) {
81
- view.setEnablePictureInPicture(enablePictureInPicture)
94
+ @ReactProp(name = "shareUrl")
95
+ fun setShareUrl(view: FWVideoFeed, shareUrl: String?) {
96
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
97
+ shareUrl = shareUrl
98
+ )
99
+ }
100
+
101
+ @ReactProp(name = "mode")
102
+ fun setMode(view: FWVideoFeed, mode: String?) {
103
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
104
+ mode = if (!mode.isNullOrBlank()) FWVideoFeedMode.deserialize(mode) else null
105
+ )
82
106
  }
83
107
 
84
108
  @Suppress("UNCHECKED_CAST")
85
109
  @ReactProp(name = "dynamicContentParameters")
86
110
  fun setDynamicContentParameters(view: FWVideoFeed, parameters: ReadableMap?) {
87
- val parametersMap = parameters?.toHashMap() as? HashMap<String, List<String>>
88
- view.setDynamicContentParametersProps(parametersMap)
111
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
112
+ dynamicContentParameters = parameters?.toHashMap() as? HashMap<String, List<String>>
113
+ )
89
114
  }
90
115
 
91
116
  @ReactProp(name = "videoFeedConfiguration")
@@ -93,7 +118,9 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
93
118
  val configMap = config?.toHashMap() ?: hashMapOf()
94
119
  val jsonObject = JSONObject(configMap)
95
120
  val videoFeedConfigModel = FWVideoFeedConfigModelDeserializer.deserialize(jsonObject)
96
- view.setVideoFeedConfigProps(videoFeedConfigModel)
121
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
122
+ videoFeedConfiguration = videoFeedConfigModel
123
+ )
97
124
  }
98
125
 
99
126
  @ReactProp(name = "videoPlayerConfiguration")
@@ -101,7 +128,9 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
101
128
  val configMap = config?.toHashMap() ?: hashMapOf()
102
129
  val jsonObject = JSONObject(configMap)
103
130
  val videoPlayerConfigModel = FWVideoPlayerConfigModelDeserializer.deserialize(jsonObject)
104
- view.setVideoPlayerConfigProps(videoPlayerConfigModel)
131
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
132
+ videoPlayerConfiguration = videoPlayerConfigModel
133
+ )
105
134
  }
106
135
 
107
136
  private fun addVideoFeedListener(reactContext: ThemedReactContext, videoFeed: FWVideoFeed?) {
@@ -159,6 +159,11 @@ class FireworkSDKModule(
159
159
  else -> {}
160
160
  }
161
161
 
162
+ val imageLoader = FWImageLoaderUtil.getImageLoader()
163
+ if (imageLoader != null) {
164
+ configBuilder.imageLoader(imageLoader)
165
+ }
166
+
162
167
  val config = configBuilder.build()
163
168
 
164
169
  FireworkSdk.init(
@@ -74,6 +74,16 @@ object FWConfigUtil {
74
74
  }
75
75
  }
76
76
  }
77
+ FWVideoFeedSource.Sku -> {
78
+ videoFeedPropsModel.channel?.let { channel ->
79
+ baseOptionBuilder.feedResource(FeedResource.Sku(channel, videoFeedPropsModel.productIds ?: emptyList()))
80
+ }
81
+ }
82
+ FWVideoFeedSource.ShareUrl -> {
83
+ videoFeedPropsModel.shareUrl?.let { shareUrl ->
84
+ baseOptionBuilder.feedResource(FeedResource.ShareUrl(shareUrl))
85
+ }
86
+ }
77
87
  else -> {}
78
88
  }
79
89
 
@@ -270,7 +280,7 @@ object FWConfigUtil {
270
280
  playerOptionBuilder.showShareButton(it)
271
281
  }
272
282
 
273
- val enablePipMode = videoFeedPropsModel.enablePictureInPicture
283
+ val enablePipMode = videoFeedPropsModel.videoPlayerConfiguration?.enablePictureInPicture
274
284
  enablePipMode?.let {
275
285
  playerOptionBuilder.enablePipMode(it)
276
286
  }
@@ -0,0 +1,16 @@
1
+ package com.fireworksdk.bridge.utils
2
+
3
+ import com.firework.imageloading.ImageLoader
4
+
5
+ object FWImageLoaderUtil {
6
+
7
+ private var imageLoader: ImageLoader? = null
8
+
9
+ fun setImageLoader(imageLoader: ImageLoader?) {
10
+ this.imageLoader = imageLoader
11
+ }
12
+
13
+ fun getImageLoader(): ImageLoader? {
14
+ return imageLoader
15
+ }
16
+ }
@@ -10,7 +10,7 @@ import UIKit
10
10
 
11
11
  @objc
12
12
  public enum StoryBlockSourceType: Int {
13
- case discover, channel, playlist, dynamicContent, hashtagPlaylist
13
+ case discover, channel, playlist, dynamicContent, hashtagPlaylist, sku
14
14
  }
15
15
 
16
16
  public protocol StoryBlockViewDelegate: AnyObject {
@@ -23,10 +23,11 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
23
23
  @objc public var sourceType: StoryBlockSourceType = .discover
24
24
  @objc public var channel: String = ""
25
25
  @objc public var playlist: String = ""
26
- @objc public var dynamicContentParameters: [String: [String]] = [:]
26
+ @objc public var dynamicContentParameters: NSDictionary = NSDictionary()
27
27
  @objc public var hashtagFilterExpression: String = ""
28
- @objc public var enablePictureInPicture: Bool = false
28
+ @objc public var productIds: NSArray = NSArray()
29
29
  @objc public var adConfiguration: AdConfiguration?
30
+ @objc public var storyBlockConfiguration: StoryBlockConfiguration?
30
31
 
31
32
  public weak var delegate: StoryBlockViewDelegate?
32
33
 
@@ -43,9 +44,12 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
43
44
  case .playlist:
44
45
  return .channelPlaylist(channelID: channel, playlistID: playlist)
45
46
  case .dynamicContent:
46
- return .dynamicContent(channelID: channel, parameters: dynamicContentParameters)
47
+ let parameters = dynamicContentParameters as? [String: [String]]
48
+ return .dynamicContent(channelID: channel, parameters: parameters ?? [:])
47
49
  case .hashtagPlaylist:
48
50
  return .hashtagPlaylist(channelID: channel, filterExpression: hashtagFilterExpression)
51
+ case .sku:
52
+ return .skuPlaylist(channelID: channel, productIDs: (productIds as? [String]) ?? [])
49
53
  }
50
54
  }
51
55
 
@@ -83,9 +87,7 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
83
87
  return
84
88
  }
85
89
 
86
- if self.enablePictureInPicture {
87
- storyBlockVC.isPictureInPictureEnabled = true
88
- }
90
+ storyBlockVC.isPictureInPictureEnabled = storyBlockConfiguration?.enablePictureInPicture ?? true
89
91
 
90
92
  storyBlockVC.delegate = self
91
93
  self.storyBlockVC = storyBlockVC
@@ -0,0 +1,13 @@
1
+ //
2
+ // StoryBlockConfiguration.swift
3
+ // FireworkSdk
4
+ //
5
+ // Created by linjie jiang on 6/26/23.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ @objc
11
+ public class StoryBlockConfiguration: NSObject, Codable {
12
+ var enablePictureInPicture: Bool?
13
+ }
@@ -28,13 +28,18 @@ RCT_EXPORT_VIEW_PROPERTY(channel, NSString)
28
28
  RCT_EXPORT_VIEW_PROPERTY(playlist, NSString)
29
29
  RCT_EXPORT_VIEW_PROPERTY(dynamicContentParameters, NSDictionary)
30
30
  RCT_EXPORT_VIEW_PROPERTY(hashtagFilterExpression, NSString)
31
- RCT_EXPORT_VIEW_PROPERTY(enablePictureInPicture, BOOL)
31
+ RCT_EXPORT_VIEW_PROPERTY(productIds, NSArray)
32
32
 
33
33
  RCT_CUSTOM_VIEW_PROPERTY(adConfiguration, AdConfiguration, StoryBlock) {
34
34
  AdConfiguration *config = [RCTConvert adConfiguration:json];
35
35
  view.adConfiguration = config;
36
36
  }
37
37
 
38
+ RCT_CUSTOM_VIEW_PROPERTY(storyBlockConfiguration, StoryBlockConfiguration, StoryBlock) {
39
+ StoryBlockConfiguration *config = [RCTConvert storyBlockConfiguration:json];
40
+ view.storyBlockConfiguration = config;
41
+ }
42
+
38
43
  RCT_EXPORT_VIEW_PROPERTY(onStoryBlockLoadFinished, RCTBubblingEventBlock)
39
44
 
40
45
  RCT_EXPORT_METHOD(play:(nonnull NSNumber *)reactTag) {
@@ -20,7 +20,7 @@ public enum VideoFeedMode: Int {
20
20
 
21
21
  @objc
22
22
  public enum VideFeedSourceType: Int {
23
- case discover, channel, playlist, playlistGroup, dynamicContent, hashtagPlaylist
23
+ case discover, channel, playlist, playlistGroup, dynamicContent, hashtagPlaylist, sku
24
24
  }
25
25
 
26
26
  public protocol VideoFeedDelegate: AnyObject {
@@ -39,6 +39,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
39
39
  @objc public var playlist: String = ""
40
40
  @objc public var playlistGroup: String = ""
41
41
  @objc public var dynamicContentParameters: NSDictionary = NSDictionary()
42
+ @objc public var productIds: NSArray = NSArray()
42
43
  @objc public var hashtagFilterExpression: String = ""
43
44
  @objc public var mode: VideoFeedMode = .row
44
45
  @objc public var feedViewConfig: VideoFeedConfiguration? {
@@ -59,7 +60,6 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
59
60
  }
60
61
  }
61
62
  @objc public var adConfiguration: AdConfiguration?
62
- @objc public var enablePictureInPicture: Bool = false
63
63
 
64
64
  @objc var onVideoFeedLoadFinished: RCTBubblingEventBlock?
65
65
  // @objc var onVideoFeedClick: RCTBubblingEventBlock?
@@ -82,6 +82,8 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
82
82
  return .dynamicContent(channelID: channel, parameters: parameters ?? [:])
83
83
  case .hashtagPlaylist:
84
84
  return .hashtagPlaylist(channelID: channel, filterExpression: hashtagFilterExpression)
85
+ case .sku:
86
+ return .skuPlaylist(channelID: channel, productIDs: (productIds as? [String]) ?? [])
85
87
  }
86
88
  }
87
89
 
@@ -190,9 +192,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
190
192
  feedVC.viewConfiguration = viewConfiguration
191
193
  }
192
194
 
193
- if self.enablePictureInPicture {
194
- feedVC.isPictureInPictureEnabled = true
195
- }
195
+ feedVC.isPictureInPictureEnabled = playerViewConfig?.enablePictureInPicture ?? true
196
196
 
197
197
  feedVC.delegate = self
198
198
  self.feedVC = feedVC
@@ -422,11 +422,6 @@ extension VideoFeed {
422
422
  videoConfig.adBadge = adBadge
423
423
  }
424
424
 
425
- // set a value different from default value to compatible with FireworkVideo SDK misalign bug
426
- if videoConfig.itemView.titleLayoutConfiguration.insets == UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8) {
427
- videoConfig.itemView.titleLayoutConfiguration.insets = UIEdgeInsets(top: 7, left: 7, bottom: 7, right: 7)
428
- }
429
-
430
425
  return videoConfig
431
426
  }
432
427
  }
@@ -29,6 +29,7 @@ RCT_EXPORT_VIEW_PROPERTY(playlist, NSString)
29
29
  RCT_EXPORT_VIEW_PROPERTY(playlistGroup, NSString)
30
30
  RCT_EXPORT_VIEW_PROPERTY(dynamicContentParameters, NSDictionary)
31
31
  RCT_EXPORT_VIEW_PROPERTY(hashtagFilterExpression, NSString)
32
+ RCT_EXPORT_VIEW_PROPERTY(productIds, NSArray)
32
33
 
33
34
  RCT_CUSTOM_VIEW_PROPERTY(mode, VideoFeedMode, VideoFeed) {
34
35
  if (json) {
@@ -50,8 +51,6 @@ RCT_CUSTOM_VIEW_PROPERTY(adConfiguration, AdConfiguration, VideoFeed) {
50
51
  view.adConfiguration = config;
51
52
  }
52
53
 
53
- RCT_EXPORT_VIEW_PROPERTY(enablePictureInPicture, BOOL)
54
-
55
54
  RCT_EXPORT_VIEW_PROPERTY(onVideoFeedLoadFinished, RCTBubblingEventBlock)
56
55
  //RCT_EXPORT_VIEW_PROPERTY(onVideoFeedClick, RCTBubblingEventBlock)
57
56
 
@@ -21,6 +21,7 @@ public class VideoPlayerConfiguration: NSObject, Codable {
21
21
  var ctaHighlightDelay: VideoPlayerCTADelay?
22
22
  var shareBaseURL: String?
23
23
  var ctaWidth: VideoPlayerCTAWidth?
24
+ var enablePictureInPicture: Bool?
24
25
 
25
26
  public enum VideoPlayerStyle: String, Codable {
26
27
  case full, fit