react-native-firework-sdk 2.4.2 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/FireworkVideoUI.xcframework/Info.plist +5 -5
  2. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  3. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  4. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  5. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  6. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +1 -1
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfiguration.kt +8 -0
  8. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationDeserializer.kt +25 -5
  9. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationSerializer.kt +17 -4
  10. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +1 -0
  11. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelDeserializer.kt +4 -0
  12. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelSerializer.kt +2 -0
  13. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWProductCardCtaButtonTextValue.kt +18 -0
  14. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWProductCardTheme.kt +18 -0
  15. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoFeedSource.kt +2 -1
  16. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +7 -0
  17. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +7 -0
  18. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +1 -1
  19. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +2 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/utils/FWColorUtil.kt +65 -0
  21. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +7 -8
  22. package/ios/Components/StoryBlock.swift +4 -1
  23. package/ios/Components/StoryBlockManager.m +1 -0
  24. package/ios/Components/VideoFeed.swift +39 -10
  25. package/ios/Components/VideoFeedManager.m +1 -0
  26. package/ios/Components/VideoPlayerConfiguration.swift +10 -0
  27. package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
  28. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +6 -6
  29. package/ios/FireworkVideoUI/Podfile +1 -1
  30. package/ios/FireworkVideoUI/Podfile.lock +4 -4
  31. package/ios/Models/Common/ButtonInfo.swift +37 -0
  32. package/ios/Models/NativeToRN/FireworkEventName.swift +1 -0
  33. package/ios/Models/NativeToRN/FireworkSDK+Json.swift +11 -1
  34. package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +18 -0
  35. package/ios/Models/RNToNative/RCTConvert+StoryBlock.swift +2 -1
  36. package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
  37. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +4 -4
  38. package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +16 -0
  39. package/ios/Modules/Shopping/ShoppingModule.m +1 -0
  40. package/ios/Modules/Shopping/ShoppingModule.swift +58 -17
  41. package/ios/Utils/Extensions/String+Color.swift +53 -27
  42. package/lib/commonjs/FWNavigator.js +0 -6
  43. package/lib/commonjs/FWNavigator.js.map +1 -1
  44. package/lib/commonjs/VideoShopping.js +32 -0
  45. package/lib/commonjs/VideoShopping.js.map +1 -1
  46. package/lib/commonjs/components/StoryBlock.js +2 -0
  47. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  48. package/lib/commonjs/components/VideoFeed.js +2 -0
  49. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  50. package/lib/commonjs/index.js.map +1 -1
  51. package/lib/commonjs/models/ButtonInfo.js +2 -0
  52. package/lib/commonjs/models/ButtonInfo.js.map +1 -0
  53. package/lib/commonjs/models/FWEventName.js +1 -0
  54. package/lib/commonjs/models/FWEventName.js.map +1 -1
  55. package/lib/commonjs/models/VideoPlayerButtonConfiguration.js +2 -0
  56. package/lib/commonjs/models/VideoPlayerButtonConfiguration.js.map +1 -0
  57. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  58. package/lib/module/FWNavigator.js +0 -2
  59. package/lib/module/FWNavigator.js.map +1 -1
  60. package/lib/module/VideoShopping.js +31 -0
  61. package/lib/module/VideoShopping.js.map +1 -1
  62. package/lib/module/components/StoryBlock.js +2 -0
  63. package/lib/module/components/StoryBlock.js.map +1 -1
  64. package/lib/module/components/VideoFeed.js +2 -0
  65. package/lib/module/components/VideoFeed.js.map +1 -1
  66. package/lib/module/index.js.map +1 -1
  67. package/lib/module/models/ButtonInfo.js +2 -0
  68. package/lib/module/models/ButtonInfo.js.map +1 -0
  69. package/lib/module/models/FWEventName.js +1 -0
  70. package/lib/module/models/FWEventName.js.map +1 -1
  71. package/lib/module/models/VideoPlayerButtonConfiguration.js +2 -0
  72. package/lib/module/models/VideoPlayerButtonConfiguration.js.map +1 -0
  73. package/lib/module/modules/ShoppingModule.js.map +1 -1
  74. package/lib/typescript/VideoShopping.d.ts +13 -1
  75. package/lib/typescript/components/StoryBlock.d.ts +4 -0
  76. package/lib/typescript/components/VideoFeed.d.ts +4 -0
  77. package/lib/typescript/index.d.ts +6 -4
  78. package/lib/typescript/models/ButtonInfo.d.ts +18 -0
  79. package/lib/typescript/models/FWEventName.d.ts +2 -1
  80. package/lib/typescript/models/FWEvents.d.ts +18 -0
  81. package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +16 -0
  82. package/lib/typescript/models/StoryBlockSource.d.ts +1 -1
  83. package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
  84. package/lib/typescript/models/VideoPlayerButtonConfiguration.d.ts +39 -0
  85. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +6 -0
  86. package/lib/typescript/modules/ShoppingModule.d.ts +1 -0
  87. package/package.json +1 -1
  88. package/react-native-firework-sdk.podspec +1 -1
  89. package/src/FWNavigator.ts +0 -2
  90. package/src/VideoShopping.ts +40 -0
  91. package/src/components/StoryBlock.tsx +6 -0
  92. package/src/components/VideoFeed.tsx +6 -0
  93. package/src/index.ts +14 -0
  94. package/src/models/ButtonInfo.ts +18 -0
  95. package/src/models/FWEventName.ts +1 -0
  96. package/src/models/FWEvents.ts +19 -0
  97. package/src/models/ProductInfoViewConfiguration.ts +19 -0
  98. package/src/models/StoryBlockSource.ts +2 -1
  99. package/src/models/VideoFeedSource.ts +2 -1
  100. package/src/models/VideoPlayerButtonConfiguration.ts +40 -0
  101. package/src/models/VideoPlayerConfiguration.ts +6 -0
  102. package/src/modules/ShoppingModule.ts +1 -0
@@ -6,30 +6,30 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_x86_64-simulator</string>
9
+ <string>ios-arm64</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>FireworkVideoUI.framework</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
- <string>x86_64</string>
16
15
  </array>
17
16
  <key>SupportedPlatform</key>
18
17
  <string>ios</string>
19
- <key>SupportedPlatformVariant</key>
20
- <string>simulator</string>
21
18
  </dict>
22
19
  <dict>
23
20
  <key>LibraryIdentifier</key>
24
- <string>ios-arm64</string>
21
+ <string>ios-arm64_x86_64-simulator</string>
25
22
  <key>LibraryPath</key>
26
23
  <string>FireworkVideoUI.framework</string>
27
24
  <key>SupportedArchitectures</key>
28
25
  <array>
29
26
  <string>arm64</string>
27
+ <string>x86_64</string>
30
28
  </array>
31
29
  <key>SupportedPlatform</key>
32
30
  <string>ios</string>
31
+ <key>SupportedPlatformVariant</key>
32
+ <string>simulator</string>
33
33
  </dict>
34
34
  </array>
35
35
  <key>CFBundlePackageType</key>
@@ -14,7 +14,7 @@
14
14
  </data>
15
15
  <key>Info.plist</key>
16
16
  <data>
17
- 85EsI3LO/3Cyvsf61nuxOhuVZjY=
17
+ SjR62D/B5znofcUiChZk6KjmKwg=
18
18
  </data>
19
19
  <key>Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
20
20
  <data>
@@ -1,10 +1,13 @@
1
1
  package com.fireworksdk.bridge.models
2
2
 
3
3
  import com.fireworksdk.bridge.models.enums.FWCtaButtonTextValue
4
+ import com.fireworksdk.bridge.models.enums.FWProductCardCtaButtonTextValue
5
+ import com.fireworksdk.bridge.models.enums.FWProductCardTheme
4
6
 
5
7
  data class FWProductInfoViewConfiguration(
6
8
  val ctaButton: CtaButtonConfiguration? = null,
7
9
  val linkButton: LinkButtonConfiguration? = null,
10
+ val productCard: ProductCardConfiguration? = null,
8
11
  ) {
9
12
 
10
13
  data class CtaButtonConfiguration(
@@ -17,4 +20,9 @@ data class FWProductInfoViewConfiguration(
17
20
  data class LinkButtonConfiguration(
18
21
  val isHidden: Boolean? = null,
19
22
  )
23
+
24
+ data class ProductCardConfiguration(
25
+ val ctaButtonText: FWProductCardCtaButtonTextValue? = null,
26
+ val theme: FWProductCardTheme? = null,
27
+ )
20
28
  }
@@ -1,12 +1,15 @@
1
1
  package com.fireworksdk.bridge.models
2
2
 
3
3
  import com.fireworksdk.bridge.models.enums.FWCtaButtonTextValue
4
+ import com.fireworksdk.bridge.models.enums.FWProductCardCtaButtonTextValue
5
+ import com.fireworksdk.bridge.models.enums.FWProductCardTheme
4
6
  import org.json.JSONObject
5
7
 
6
8
  object FWProductInfoViewConfigurationDeserializer {
7
9
 
8
- private const val CTA_BUTTON = "ctaButton"
9
- private const val LINK_BUTTON = "linkButton"
10
+ private const val CTA_BUTTON_KEY = "ctaButton"
11
+ private const val LINK_BUTTON_KEY = "linkButton"
12
+ private const val PRODUCT_CARD_KEY = "productCard"
10
13
 
11
14
  private const val TEXT_KEY = "text"
12
15
  private const val BACKGROUND_COLOR_KEY = "backgroundColor"
@@ -15,15 +18,20 @@ object FWProductInfoViewConfigurationDeserializer {
15
18
 
16
19
  private const val IS_HIDDEN_KEY = "isHidden"
17
20
 
21
+ private const val CTA_BUTTON_TEXT_KEY = "ctaButtonText"
22
+ private const val THEME_KEY = "theme"
23
+
18
24
  fun deserialize(responseJson: JSONObject?): FWProductInfoViewConfiguration? {
19
25
  responseJson ?: return null
20
26
 
21
- val ctaButtonConfiguration = deserializeCtaButtonConfiguration(responseJson.optJSONObject(CTA_BUTTON))
22
- val linkButtonConfiguration = deserializeLinkButtonConfiguration(responseJson.optJSONObject(LINK_BUTTON))
27
+ val ctaButtonConfiguration = deserializeCtaButtonConfiguration(responseJson.optJSONObject(CTA_BUTTON_KEY))
28
+ val linkButtonConfiguration = deserializeLinkButtonConfiguration(responseJson.optJSONObject(LINK_BUTTON_KEY))
29
+ val productCardConfiguration = deserializeProductCardConfiguration(responseJson.optJSONObject(PRODUCT_CARD_KEY))
23
30
 
24
31
  return FWProductInfoViewConfiguration(
25
32
  ctaButton = ctaButtonConfiguration,
26
33
  linkButton = linkButtonConfiguration,
34
+ productCard = productCardConfiguration,
27
35
  )
28
36
  }
29
37
 
@@ -36,7 +44,7 @@ object FWProductInfoViewConfigurationDeserializer {
36
44
  val fontSize = if (ctaButtonConfiguration.has(FONT_SIZE_KEY)) ctaButtonConfiguration.optInt(FONT_SIZE_KEY) else null
37
45
 
38
46
  return FWProductInfoViewConfiguration.CtaButtonConfiguration(
39
- text = FWCtaButtonTextValue.deserialize(textString ?: FWCtaButtonTextValue.AddToCart.rawValue),
47
+ text = FWCtaButtonTextValue.deserialize(textString),
40
48
  backgroundColor = backgroundColor,
41
49
  textColor = textColor,
42
50
  fontSize = fontSize,
@@ -53,4 +61,16 @@ object FWProductInfoViewConfigurationDeserializer {
53
61
  )
54
62
  }
55
63
 
64
+ private fun deserializeProductCardConfiguration(productCardConfigJson: JSONObject?): FWProductInfoViewConfiguration.ProductCardConfiguration {
65
+ productCardConfigJson ?: return FWProductInfoViewConfiguration.ProductCardConfiguration()
66
+
67
+ val ctaButtonTextString = if (productCardConfigJson.has(CTA_BUTTON_TEXT_KEY)) productCardConfigJson.optString(CTA_BUTTON_TEXT_KEY) else null
68
+ val themeString = if (productCardConfigJson.has(THEME_KEY)) productCardConfigJson.optString(THEME_KEY) else null
69
+
70
+ return FWProductInfoViewConfiguration.ProductCardConfiguration(
71
+ ctaButtonText = FWProductCardCtaButtonTextValue.deserialize(ctaButtonTextString),
72
+ theme = FWProductCardTheme.deserialize(themeString),
73
+ )
74
+ }
75
+
56
76
  }
@@ -5,8 +5,9 @@ import org.json.JSONObject
5
5
 
6
6
  object FWProductInfoViewConfigurationSerializer {
7
7
 
8
- private const val CTA_BUTTON = "ctaButton"
9
- private const val LINK_BUTTON = "linkButton"
8
+ private const val CTA_BUTTON_KEY = "ctaButton"
9
+ private const val LINK_BUTTON_KEY = "linkButton"
10
+ private const val PRODUCT_CARD_KEY = "productCard"
10
11
 
11
12
  private const val TEXT_KEY = "text"
12
13
  private const val BACKGROUND_COLOR_KEY = "backgroundColor"
@@ -15,11 +16,15 @@ object FWProductInfoViewConfigurationSerializer {
15
16
 
16
17
  private const val IS_HIDDEN_KEY = "isHidden"
17
18
 
19
+ private const val CTA_BUTTON_TEXT_KEY = "ctaButtonText"
20
+ private const val THEME_KEY = "theme"
21
+
18
22
  fun serialize(model: FWProductInfoViewConfiguration?): JSONObject? {
19
23
  model ?: return null
20
24
  val jsonObject = JSONObject()
21
- jsonObject.put(CTA_BUTTON, serializeCtaButtonConfiguration(model.ctaButton))
22
- jsonObject.put(LINK_BUTTON, serializeLinkButtonConfiguration(model.linkButton))
25
+ jsonObject.put(CTA_BUTTON_KEY, serializeCtaButtonConfiguration(model.ctaButton))
26
+ jsonObject.put(LINK_BUTTON_KEY, serializeLinkButtonConfiguration(model.linkButton))
27
+ jsonObject.put(PRODUCT_CARD_KEY, serializeProductCardConfiguration(model.productCard))
23
28
  return jsonObject
24
29
  }
25
30
 
@@ -39,4 +44,12 @@ object FWProductInfoViewConfigurationSerializer {
39
44
  jsonObject.put(IS_HIDDEN_KEY, model.isHidden)
40
45
  return jsonObject
41
46
  }
47
+
48
+ private fun serializeProductCardConfiguration(model: FWProductInfoViewConfiguration.ProductCardConfiguration?): JSONObject? {
49
+ model ?: return null
50
+ val jsonObject = JSONObject()
51
+ jsonObject.put(CTA_BUTTON_TEXT_KEY, model.ctaButtonText)
52
+ jsonObject.put(THEME_KEY, model.theme)
53
+ return jsonObject
54
+ }
42
55
  }
@@ -10,6 +10,7 @@ data class FWVideoFeedPropsModel(
10
10
  val playlistGroup: String? = null,
11
11
  val hashtagFilterExpression: String? = null,
12
12
  val productIds: List<String>? = null,
13
+ val contentId: String? = null,
13
14
  val shareUrl: String? = null,
14
15
  val mode: FWVideoFeedMode? = null,
15
16
  val videoFeedConfiguration: FWVideoFeedConfigModel? = null,
@@ -12,6 +12,7 @@ object FWVideoFeedPropsModelDeserializer {
12
12
  private const val PLAYLIST_GROUP_KEY = "playlistGroup"
13
13
  private const val HASHTAG_FILTER_EXPRESSION_KEY = "hashtagFilterExpression"
14
14
  private const val PRODUCT_IDS_KEY = "productIds"
15
+ private const val CONTENT_ID_KEY = "contentId"
15
16
  private const val SHARE_URL_KEY = "shareUrl"
16
17
  private const val MODE_KEY = "mode"
17
18
  private const val MARGIN_RIGHT_KEY = "marginRight"
@@ -43,6 +44,8 @@ object FWVideoFeedPropsModelDeserializer {
43
44
  productIds = list
44
45
  }
45
46
 
47
+ val contentId = if (responseJson.has(CONTENT_ID_KEY)) responseJson.optString(CONTENT_ID_KEY) else null
48
+
46
49
  val shareUrl = if (responseJson.has(SHARE_URL_KEY)) responseJson.optString(SHARE_URL_KEY) else null
47
50
  val mode = if (responseJson.has(MODE_KEY)) responseJson.optString(MODE_KEY) else null
48
51
 
@@ -86,6 +89,7 @@ object FWVideoFeedPropsModelDeserializer {
86
89
  playlistGroup = playlistGroup,
87
90
  hashtagFilterExpression = hashtagFilterExpression,
88
91
  productIds = productIds,
92
+ contentId = contentId,
89
93
  shareUrl = shareUrl,
90
94
  mode = if (!mode.isNullOrBlank()) FWVideoFeedMode.deserialize(mode) else null,
91
95
  videoFeedConfiguration = videoFeedConfiguration,
@@ -13,6 +13,7 @@ object FWVideoFeedPropsModelSerializer {
13
13
  private const val PLAYLIST_GROUP_KEY = "playlistGroup"
14
14
  private const val HASHTAG_FILTER_EXPRESSION_KEY = "hashtagFilterExpression"
15
15
  private const val PRODUCT_IDS_KEY = "productIds"
16
+ private const val CONTENT_ID_KEY = "contentId"
16
17
  private const val SHARE_URL_KEY = "shareUrl"
17
18
  private const val MODE_KEY = "mode"
18
19
  private const val MARGIN_RIGHT_KEY = "marginRight"
@@ -39,6 +40,7 @@ object FWVideoFeedPropsModelSerializer {
39
40
  jsonObject.put(PRODUCT_IDS_KEY, productIdJsonArray)
40
41
  }
41
42
 
43
+ jsonObject.put(CONTENT_ID_KEY, model.contentId)
42
44
  jsonObject.put(SHARE_URL_KEY, model.shareUrl)
43
45
  jsonObject.put(MODE_KEY, FWVideoFeedMode.serialize(model.mode))
44
46
  jsonObject.put(VIDEO_FEED_CONFIGURATION_KEY, FWVideoFeedConfigModelSerializer.serialize(model.videoFeedConfiguration))
@@ -0,0 +1,18 @@
1
+ package com.fireworksdk.bridge.models.enums
2
+
3
+ enum class FWProductCardCtaButtonTextValue(val rawValue: String) {
4
+ ShopNow("shopNow"),
5
+ BuyNow("buyNow");
6
+
7
+ companion object {
8
+ fun deserialize(rawValue: String?): FWProductCardCtaButtonTextValue? {
9
+ rawValue ?: return null
10
+ return values().first { it.rawValue == rawValue }
11
+ }
12
+
13
+ fun serialize(model: FWProductCardCtaButtonTextValue?): String? {
14
+ model ?: return null
15
+ return model.rawValue
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,18 @@
1
+ package com.fireworksdk.bridge.models.enums
2
+
3
+ enum class FWProductCardTheme(val rawValue: String) {
4
+ Dark("dark"),
5
+ Light("light");
6
+
7
+ companion object {
8
+ fun deserialize(rawValue: String?): FWProductCardTheme? {
9
+ rawValue ?: return null
10
+ return values().first { it.rawValue == rawValue }
11
+ }
12
+
13
+ fun serialize(model: FWProductCardTheme?): String? {
14
+ model ?: return null
15
+ return model.rawValue
16
+ }
17
+ }
18
+ }
@@ -8,7 +8,8 @@ enum class FWVideoFeedSource(val rawValue: String) {
8
8
  PlaylistGroup("playlistGroup"),
9
9
  HashtagPlaylist("hashtagPlaylist"),
10
10
  Sku("sku"),
11
- ShareUrl("shareUrl");
11
+ ShareUrl("shareUrl"),
12
+ SingleContent("singleContent");
12
13
 
13
14
  companion object {
14
15
  fun deserialize(rawValue: String?): FWVideoFeedSource? {
@@ -107,6 +107,13 @@ class FWStoryBlockManager : ViewGroupManager<StoryBlockFrameLayout>() {
107
107
  )
108
108
  }
109
109
 
110
+ @ReactProp(name = "contentId")
111
+ fun setContentId(view: StoryBlockFrameLayout, contentId: String?) {
112
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
113
+ contentId = contentId
114
+ )
115
+ }
116
+
110
117
  @ReactProp(name = "shareUrl")
111
118
  fun setShareUrl(view: StoryBlockFrameLayout, shareUrl: String?) {
112
119
  view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
@@ -91,6 +91,13 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
91
91
  )
92
92
  }
93
93
 
94
+ @ReactProp(name = "contentId")
95
+ fun setContentId(view: FWVideoFeed, contentId: String?) {
96
+ view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
97
+ contentId = contentId
98
+ )
99
+ }
100
+
94
101
  @ReactProp(name = "shareUrl")
95
102
  fun setShareUrl(view: FWVideoFeed, shareUrl: String?) {
96
103
  view.videoFeedPropsModel = view.videoFeedPropsModel.copy(
@@ -151,7 +151,7 @@ class FWVideoShoppingModule(
151
151
 
152
152
  FireworkSdk.shopping.setShoppingViewOptions(
153
153
  ShoppingViewOptions(
154
- ProductDetailsOptions(
154
+ productDetailsOptions = ProductDetailsOptions(
155
155
  linkButtonOptions = LinkButtonOptions(isVisible = !isLinkButtonHidden),
156
156
  shoppingCtaButtonOptions = ShoppingCtaButtonOptions(text = text),
157
157
  ),
@@ -51,6 +51,8 @@ class FireworkSDKModule(
51
51
  */
52
52
  @ReactMethod
53
53
  override fun init(config: ReadableMap?, promise: Promise) {
54
+ FWColorUtil.useRgba = true
55
+
54
56
  val configMap = config?.toHashMap() ?: hashMapOf()
55
57
  val jsonObject = JSONObject(configMap)
56
58
  val sdkInitOptionsModel = FWSDKInitOptionsModelDeserializer.deserialize(jsonObject)
@@ -0,0 +1,65 @@
1
+ package com.fireworksdk.bridge.utils
2
+
3
+ import android.graphics.Color
4
+
5
+ object FWColorUtil {
6
+
7
+ /**
8
+ * android system default: argb
9
+ */
10
+ var useRgba: Boolean = false
11
+
12
+ /**
13
+ * color:
14
+ * #FF3A86FF, #3A86FF
15
+ * 0xFF3A86FF, 0XFF3A86FF, 0x3A86FF, 0X3A86FF
16
+ */
17
+ fun parseColor(color: String): Int {
18
+ return when {
19
+ color.startsWith("0x") || color.startsWith("0X") -> {
20
+ parseIntColor(color)
21
+ }
22
+
23
+ else -> {
24
+ parseHashtagColor(color)
25
+ }
26
+ }
27
+ }
28
+
29
+ /**
30
+ * color: #FF3A86FF, #3A86FF
31
+ */
32
+ private fun parseHashtagColor(color: String): Int {
33
+
34
+ if (useRgba) {
35
+ when (color.length) {
36
+ 9 -> {
37
+ val argbStr = color.substring(0, 1) + color.substring(7, 9) + color.substring(1, 7)
38
+ return Color.parseColor(argbStr)
39
+ }
40
+ else -> {}
41
+ }
42
+ }
43
+
44
+ return Color.parseColor(color)
45
+ }
46
+
47
+ /**
48
+ * color: 0xFF3A86FF, 0XFF3A86FF, 0x3A86FF, 0X3A86FF
49
+ */
50
+ private fun parseIntColor(color: String): Int {
51
+
52
+ if (useRgba) {
53
+ when (color.length) {
54
+ 10 -> {
55
+ val argbStr = color.substring(0, 2) + color.substring(8, 10) + color.substring(2, 8)
56
+ return argbStr.toInt()
57
+ }
58
+ else -> {}
59
+ }
60
+ }
61
+
62
+ return color.toInt()
63
+ }
64
+
65
+ }
@@ -1,7 +1,6 @@
1
1
  package com.fireworksdk.bridge.utils
2
2
 
3
3
  import android.content.Context
4
- import android.graphics.Color
5
4
  import android.graphics.Typeface
6
5
  import android.graphics.drawable.GradientDrawable
7
6
  import com.firework.common.PlayerMode
@@ -84,6 +83,7 @@ object FWConfigUtil {
84
83
  baseOptionBuilder.feedResource(FeedResource.ShareUrl(shareUrl))
85
84
  }
86
85
  }
86
+ FWVideoFeedSource.SingleContent -> {}
87
87
  else -> {}
88
88
  }
89
89
 
@@ -102,7 +102,7 @@ object FWConfigUtil {
102
102
 
103
103
  val backgroundColor = videoFeedPropsModel.videoFeedConfiguration?.backgroundColor
104
104
  if (!backgroundColor.isNullOrBlank()) {
105
- layoutOptionBuilder.backgroundColor(Color.parseColor(backgroundColor))
105
+ layoutOptionBuilder.backgroundColor(FWColorUtil.parseColor(backgroundColor))
106
106
  }
107
107
 
108
108
  val cornerRadius = videoFeedPropsModel.videoFeedConfiguration?.cornerRadius
@@ -123,7 +123,7 @@ object FWConfigUtil {
123
123
  titleOptionBuilder.showFeedTitle(!titleHidden)
124
124
  }
125
125
  if (!titleTextColor.isNullOrBlank()) {
126
- titleOptionBuilder.feedTitleTextColor(Color.parseColor(titleTextColor))
126
+ titleOptionBuilder.feedTitleTextColor(FWColorUtil.parseColor(titleTextColor))
127
127
  }
128
128
  if (titleFontSize != null && titleFontSize > 0) {
129
129
  titleOptionBuilder.feedTitleTextSize(FWCommonUtil.spToPx(titleFontSize.toFloat(), context))
@@ -132,7 +132,7 @@ object FWConfigUtil {
132
132
  titleOptionBuilder.feedTitleTextTypeface(it)
133
133
  }
134
134
  if (!titleBackgroundColor.isNullOrBlank()) {
135
- titleOptionBuilder.feedTitleBackgroundColor(Color.parseColor(titleBackgroundColor))
135
+ titleOptionBuilder.feedTitleBackgroundColor(FWColorUtil.parseColor(titleBackgroundColor))
136
136
  }
137
137
  if (titleGradientDrawable != null) {
138
138
  val orientation = titleGradientDrawable.orientation
@@ -167,7 +167,7 @@ object FWConfigUtil {
167
167
  else -> {}
168
168
  }
169
169
  val intColors = colors.map {
170
- Color.parseColor(it)
170
+ FWColorUtil.parseColor(it)
171
171
  }
172
172
  titleOptionBuilder.feedTitleBackgroundDrawable(
173
173
  GradientDrawable(
@@ -219,10 +219,10 @@ object FWConfigUtil {
219
219
  else -> {}
220
220
  }
221
221
  if (!adBadgeBackgroundColor.isNullOrBlank()) {
222
- adBadgeOptionBuilder.adBadgeBackColor(Color.parseColor(adBadgeBackgroundColor))
222
+ adBadgeOptionBuilder.adBadgeBackColor(FWColorUtil.parseColor(adBadgeBackgroundColor))
223
223
  }
224
224
  if (!adBadgeTextColor.isNullOrBlank()) {
225
- adBadgeOptionBuilder.adBadgeTextColor(Color.parseColor(adBadgeTextColor))
225
+ adBadgeOptionBuilder.adBadgeTextColor(FWColorUtil.parseColor(adBadgeTextColor))
226
226
  }
227
227
  adBadgeTypeface?.let {
228
228
  adBadgeOptionBuilder.adBadgeTypeface(it)
@@ -381,7 +381,6 @@ object FWConfigUtil {
381
381
  }
382
382
 
383
383
  private fun getDefaultAdBadgeOptionBuilder(): AdBadgeOption.Builder {
384
-
385
384
  return AdBadgeOption.Builder()
386
385
  }
387
386
 
@@ -10,7 +10,7 @@ import UIKit
10
10
 
11
11
  @objc
12
12
  public enum StoryBlockSourceType: Int {
13
- case discover, channel, playlist, dynamicContent, hashtagPlaylist, sku
13
+ case discover, channel, playlist, dynamicContent, hashtagPlaylist, sku, singleContent
14
14
  }
15
15
 
16
16
  public protocol StoryBlockViewDelegate: AnyObject {
@@ -26,6 +26,7 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
26
26
  @objc public var dynamicContentParameters: NSDictionary = NSDictionary()
27
27
  @objc public var hashtagFilterExpression: String = ""
28
28
  @objc public var productIds: NSArray = NSArray()
29
+ @objc public var contentId: String = ""
29
30
  @objc public var adConfiguration: AdConfiguration?
30
31
  @objc public var storyBlockConfiguration: StoryBlockConfiguration?
31
32
 
@@ -50,6 +51,8 @@ public class StoryBlock: UIView, StoryBlockViewControllerDelegate {
50
51
  return .hashtagPlaylist(channelID: channel, filterExpression: hashtagFilterExpression)
51
52
  case .sku:
52
53
  return .skuPlaylist(channelID: channel, productIDs: (productIds as? [String]) ?? [])
54
+ case .singleContent:
55
+ return .singleContent(videoOrLiveStreamID: contentId)
53
56
  }
54
57
  }
55
58
 
@@ -29,6 +29,7 @@ RCT_EXPORT_VIEW_PROPERTY(playlist, NSString)
29
29
  RCT_EXPORT_VIEW_PROPERTY(dynamicContentParameters, NSDictionary)
30
30
  RCT_EXPORT_VIEW_PROPERTY(hashtagFilterExpression, NSString)
31
31
  RCT_EXPORT_VIEW_PROPERTY(productIds, NSArray)
32
+ RCT_EXPORT_VIEW_PROPERTY(contentId, NSString)
32
33
 
33
34
  RCT_CUSTOM_VIEW_PROPERTY(adConfiguration, AdConfiguration, StoryBlock) {
34
35
  AdConfiguration *config = [RCTConvert adConfiguration:json];
@@ -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, sku
23
+ case discover, channel, playlist, playlistGroup, dynamicContent, hashtagPlaylist, sku, singleContent
24
24
  }
25
25
 
26
26
  public protocol VideoFeedDelegate: AnyObject {
@@ -39,8 +39,9 @@ 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()
43
42
  @objc public var hashtagFilterExpression: String = ""
43
+ @objc public var productIds: NSArray = NSArray()
44
+ @objc public var contentId: String = ""
44
45
  @objc public var mode: VideoFeedMode = .row
45
46
  @objc public var feedViewConfig: VideoFeedConfiguration? {
46
47
  didSet {
@@ -84,6 +85,8 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
84
85
  return .hashtagPlaylist(channelID: channel, filterExpression: hashtagFilterExpression)
85
86
  case .sku:
86
87
  return .skuPlaylist(channelID: channel, productIDs: (productIds as? [String]) ?? [])
88
+ case .singleContent:
89
+ return .singleContent(videoOrLiveStreamID: contentId)
87
90
  }
88
91
  }
89
92
 
@@ -257,8 +260,8 @@ extension VideoFeed {
257
260
  if let hidden = title.hidden {
258
261
  vfcConfig.title.isHidden = hidden
259
262
  }
260
- if let textcolor = title.textColor {
261
- vfcConfig.title.textColor = textcolor.uicolor()
263
+ if let textcolor = title.textColor, let color = textcolor.uicolor() {
264
+ vfcConfig.title.textColor = color
262
265
  }
263
266
  if let numberOfLines = title.numberOfLines {
264
267
  vfcConfig.title.numberOfLines = numberOfLines
@@ -342,11 +345,11 @@ extension VideoFeed {
342
345
  vpcConfig.shareButton.isHidden = !showShareButton
343
346
  }
344
347
  if let ctaButtonStyle = config.ctaButtonStyle {
345
- if let backgroundColor = ctaButtonStyle.backgroundColor {
346
- vpcConfig.ctaButton.contentConfiguration.backgroundColor = backgroundColor.uicolor()
348
+ if let backgroundColor = ctaButtonStyle.backgroundColor, let color = backgroundColor.uicolor() {
349
+ vpcConfig.ctaButton.contentConfiguration.backgroundColor = color
347
350
  }
348
- if let textcolor = ctaButtonStyle.textColor {
349
- vpcConfig.ctaButton.contentConfiguration.textColor = textcolor.uicolor()
351
+ if let textcolor = ctaButtonStyle.textColor, let color = textcolor.uicolor() {
352
+ vpcConfig.ctaButton.contentConfiguration.textColor = color
350
353
  }
351
354
  if let fontSize = ctaButtonStyle.fontSize {
352
355
  let iOSFontInfo = ctaButtonStyle.iOSFontInfo ?? FontInfo()
@@ -399,6 +402,32 @@ extension VideoFeed {
399
402
  vpcConfig.ctaButton.width = ctaWidth.width()
400
403
  }
401
404
 
405
+ if let buttonConfiguration = config.buttonConfiguration {
406
+ if let videoDetailButtonDisplay = buttonConfiguration.videoDetailButton?.getButtonDisplayConfiguration() {
407
+ vpcConfig.videoDetailButtonDisplayConfiguration = videoDetailButtonDisplay
408
+ }
409
+
410
+ if let closeButtonDisplay = buttonConfiguration.closeButton?.getButtonDisplayConfiguration() {
411
+ vpcConfig.closeButtonConfiguration.closeDisplay = closeButtonDisplay
412
+ }
413
+
414
+ if let muteButtonDisplay = buttonConfiguration.muteButton?.getButtonDisplayConfiguration() {
415
+ vpcConfig.muteButton.muteDisplay = muteButtonDisplay
416
+ }
417
+
418
+ if let unmuteButtonDisplay = buttonConfiguration.unmuteButton?.getButtonDisplayConfiguration() {
419
+ vpcConfig.muteButton.unmuteDisplay = unmuteButtonDisplay
420
+ }
421
+
422
+ if let playButtonDisplay = buttonConfiguration.playButton?.getButtonDisplayConfiguration() {
423
+ vpcConfig.playbackButton.playDisplay = playButtonDisplay
424
+ }
425
+
426
+ if let pauseButtonDisplay = buttonConfiguration.pauseButton?.getButtonDisplayConfiguration() {
427
+ vpcConfig.playbackButton.pauseDisplay = pauseButtonDisplay
428
+ }
429
+ }
430
+
402
431
  return vpcConfig
403
432
  }
404
433
 
@@ -414,8 +443,8 @@ extension VideoFeed {
414
443
  videoConfig.playerView = vpcConfig
415
444
  }
416
445
 
417
- if let backgroundColor = feedViewConfig?.backgroundColor {
418
- videoConfig.backgroundColor = backgroundColor.uicolor()
446
+ if let backgroundColor = feedViewConfig?.backgroundColor, let color = backgroundColor.uicolor() {
447
+ videoConfig.backgroundColor = color
419
448
  }
420
449
 
421
450
  if let adBadge = FireworkSDKModule.convertToFWAdBadgeConfiguration(gAdBadgeConfiguration) {
@@ -30,6 +30,7 @@ RCT_EXPORT_VIEW_PROPERTY(playlistGroup, NSString)
30
30
  RCT_EXPORT_VIEW_PROPERTY(dynamicContentParameters, NSDictionary)
31
31
  RCT_EXPORT_VIEW_PROPERTY(hashtagFilterExpression, NSString)
32
32
  RCT_EXPORT_VIEW_PROPERTY(productIds, NSArray)
33
+ RCT_EXPORT_VIEW_PROPERTY(contentId, NSString)
33
34
 
34
35
  RCT_CUSTOM_VIEW_PROPERTY(mode, VideoFeedMode, VideoFeed) {
35
36
  if (json) {
@@ -22,6 +22,7 @@ public class VideoPlayerConfiguration: NSObject, Codable {
22
22
  var shareBaseURL: String?
23
23
  var ctaWidth: VideoPlayerCTAWidth?
24
24
  var enablePictureInPicture: Bool?
25
+ var buttonConfiguration: VideoPlayerButtonConfiguration?
25
26
 
26
27
  public enum VideoPlayerStyle: String, Codable {
27
28
  case full, fit
@@ -61,4 +62,13 @@ public class VideoPlayerConfiguration: NSObject, Codable {
61
62
  }
62
63
  }
63
64
  }
65
+
66
+ public class VideoPlayerButtonConfiguration: NSObject, Codable {
67
+ var videoDetailButton: ButtonInfo?
68
+ var closeButton: ButtonInfo?
69
+ var muteButton: ButtonInfo?
70
+ var unmuteButton: ButtonInfo?
71
+ var playButton: ButtonInfo?
72
+ var pauseButton: ButtonInfo?
73
+ }
64
74
  }