react-native-firework-sdk 1.1.0 → 1.2.0-beta.10

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 (147) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/gradlew +0 -0
  3. package/android/src/main/AndroidManifest.xml +6 -1
  4. package/android/src/main/java/com/fireworksdk/bridge/{reactnative/FireworkSDKPackage.kt → FireworkSDKPackage.kt} +4 -2
  5. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +19 -6
  6. package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +1 -0
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +2 -1
  8. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +1 -0
  9. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedSource.kt +1 -0
  10. package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWInitializationProvider.kt +99 -0
  11. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +6 -0
  12. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWNavigatorInterface.kt +10 -0
  13. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +2 -2
  14. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +3 -1
  15. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +53 -0
  16. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +4 -15
  17. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +41 -7
  18. package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWContainerActivity.kt +66 -0
  19. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWDataUtils.kt +119 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +50 -3
  21. package/android/src/main/java/com/fireworksdk/bridge/utils/FWBundleUtils.kt +86 -0
  22. package/android/src/main/java/com/fireworksdk/bridge/utils/FWDateUtils.kt +15 -0
  23. package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +12 -2
  24. package/android/src/main/res/layout/fw_bridge_fragment_container.xml +8 -0
  25. package/ios/Components/VideoFeed.swift +6 -25
  26. package/ios/Components/VideoFeedManager.m +1 -0
  27. package/ios/FireworkSdk.xcodeproj/project.pbxproj +202 -18
  28. package/ios/Models/NativeToRN/FireworkEventName.swift +1 -0
  29. package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +0 -20
  30. package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
  31. package/ios/Modules/FWNavigatorModule/FWNavigatorContainerViewController.swift +32 -0
  32. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +17 -0
  33. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +89 -0
  34. package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +13 -0
  35. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +24 -1
  36. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +3 -1
  37. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +51 -31
  38. package/ios/Modules/Shopping/CartViewController.swift +6 -1
  39. package/ios/Modules/Shopping/ShoppingModule.m +1 -2
  40. package/ios/Modules/Shopping/ShoppingModule.swift +10 -12
  41. package/lib/commonjs/FWNavigator.js +66 -0
  42. package/lib/commonjs/FWNavigator.js.map +1 -0
  43. package/lib/commonjs/FireworkSDK.js +59 -5
  44. package/lib/commonjs/FireworkSDK.js.map +1 -1
  45. package/lib/commonjs/LiveStream.js +2 -2
  46. package/lib/commonjs/LiveStream.js.map +1 -1
  47. package/lib/commonjs/VideoShopping.js +4 -18
  48. package/lib/commonjs/VideoShopping.js.map +1 -1
  49. package/lib/commonjs/components/FWVideoFeed.js.map +1 -1
  50. package/lib/commonjs/components/VideoFeed.js +33 -1
  51. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  52. package/lib/commonjs/constants/FWErrorMessage.js.map +1 -1
  53. package/lib/commonjs/index.js +10 -8
  54. package/lib/commonjs/index.js.map +1 -1
  55. package/lib/commonjs/models/FWEventName.js +3 -2
  56. package/lib/commonjs/models/FWEventName.js.map +1 -1
  57. package/lib/commonjs/models/NewNativeContainerProps.js +2 -0
  58. package/lib/commonjs/models/{AdConfig.js.map → NewNativeContainerProps.js.map} +0 -0
  59. package/lib/commonjs/models/VideoFeedSource.js +0 -4
  60. package/lib/commonjs/modules/FWNavigatorModule.js +22 -0
  61. package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -0
  62. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  63. package/lib/commonjs/modules/LiveStreamModule.js.map +1 -1
  64. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  65. package/lib/commonjs/utils/FWLoggerUtil.js +45 -0
  66. package/lib/commonjs/utils/FWLoggerUtil.js.map +1 -0
  67. package/lib/module/FWNavigator.js +49 -0
  68. package/lib/module/FWNavigator.js.map +1 -0
  69. package/lib/module/FireworkSDK.js +54 -5
  70. package/lib/module/FireworkSDK.js.map +1 -1
  71. package/lib/module/LiveStream.js +4 -4
  72. package/lib/module/LiveStream.js.map +1 -1
  73. package/lib/module/VideoShopping.js +4 -18
  74. package/lib/module/VideoShopping.js.map +1 -1
  75. package/lib/module/components/FWVideoFeed.js +1 -1
  76. package/lib/module/components/FWVideoFeed.js.map +1 -1
  77. package/lib/module/components/VideoFeed.js +33 -1
  78. package/lib/module/components/VideoFeed.js.map +1 -1
  79. package/lib/module/constants/FWErrorMessage.js.map +1 -1
  80. package/lib/module/index.js +3 -5
  81. package/lib/module/index.js.map +1 -1
  82. package/lib/module/models/FWEventName.js +3 -2
  83. package/lib/module/models/FWEventName.js.map +1 -1
  84. package/lib/module/models/NewNativeContainerProps.js +2 -0
  85. package/lib/module/models/{AdConfig.js.map → NewNativeContainerProps.js.map} +0 -0
  86. package/lib/module/models/VideoFeedSource.js +1 -1
  87. package/lib/module/modules/FWNavigatorModule.js +13 -0
  88. package/lib/module/modules/FWNavigatorModule.js.map +1 -0
  89. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  90. package/lib/module/modules/LiveStreamModule.js.map +1 -1
  91. package/lib/module/modules/ShoppingModule.js.map +1 -1
  92. package/lib/module/utils/FWLoggerUtil.js +36 -0
  93. package/lib/module/utils/FWLoggerUtil.js.map +1 -0
  94. package/lib/typescript/FWNavigator.d.ts +24 -0
  95. package/lib/typescript/FireworkSDK.d.ts +21 -4
  96. package/lib/typescript/LiveStream.d.ts +1 -1
  97. package/lib/typescript/VideoShopping.d.ts +2 -9
  98. package/lib/typescript/components/VideoFeed.d.ts +8 -1
  99. package/lib/typescript/constants/FWErrorMessage.d.ts +1 -1
  100. package/lib/typescript/index.d.ts +6 -5
  101. package/lib/typescript/models/FWEventName.d.ts +4 -3
  102. package/lib/typescript/models/FeedItemDetails.d.ts +1 -1
  103. package/lib/typescript/models/NewNativeContainerProps.d.ts +6 -0
  104. package/lib/typescript/models/VideoFeedConfiguration.d.ts +4 -0
  105. package/lib/typescript/models/VideoFeedSource.d.ts +1 -2
  106. package/lib/typescript/modules/FWNavigatorModule.d.ts +11 -0
  107. package/lib/typescript/modules/FireworkSDKModule.d.ts +5 -4
  108. package/lib/typescript/modules/ShoppingModule.d.ts +2 -2
  109. package/lib/typescript/utils/FWLoggerUtil.d.ts +6 -0
  110. package/package.json +3 -1
  111. package/react-native-firework-sdk.podspec +1 -1
  112. package/src/FWNavigator.tsx +49 -0
  113. package/src/FireworkSDK.ts +57 -8
  114. package/src/LiveStream.ts +9 -7
  115. package/src/VideoShopping.ts +10 -21
  116. package/src/components/FWVideoFeed.tsx +5 -5
  117. package/src/components/VideoFeed.tsx +48 -14
  118. package/src/constants/FWErrorMessage.ts +1 -3
  119. package/src/index.tsx +9 -10
  120. package/src/models/AdBadgeConfiguration.ts +1 -1
  121. package/src/models/FWError.ts +1 -1
  122. package/src/models/FWEventName.ts +3 -2
  123. package/src/models/FWEvents.ts +1 -1
  124. package/src/models/FeedItemDetails.ts +2 -2
  125. package/src/models/LiveStreamEventDetails.ts +1 -1
  126. package/src/models/LiveStreamMessageDetails.ts +1 -1
  127. package/src/models/NewNativeContainerProps.ts +4 -0
  128. package/src/models/VideoFeedConfiguration.ts +6 -2
  129. package/src/models/VideoFeedSource.ts +6 -2
  130. package/src/models/VideoPlayerConfiguration.ts +2 -2
  131. package/src/modules/FWNavigatorModule.ts +22 -0
  132. package/src/modules/FireworkSDKModule.ts +5 -6
  133. package/src/modules/LiveStreamModule.ts +1 -5
  134. package/src/modules/ShoppingModule.ts +5 -2
  135. package/src/utils/FWLoggerUtil.ts +40 -0
  136. package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWVideoShoppingCartActivity.kt +0 -43
  137. package/ios/Modules/FireworkSDKModule/MobileADConfiguration.swift +0 -17
  138. package/lib/commonjs/components/CartContainer.js +0 -35
  139. package/lib/commonjs/components/CartContainer.js.map +0 -1
  140. package/lib/commonjs/models/AdConfig.js +0 -2
  141. package/lib/module/components/CartContainer.js +0 -18
  142. package/lib/module/components/CartContainer.js.map +0 -1
  143. package/lib/module/models/AdConfig.js +0 -2
  144. package/lib/typescript/components/CartContainer.d.ts +0 -3
  145. package/lib/typescript/models/AdConfig.d.ts +0 -10
  146. package/src/components/CartContainer.tsx +0 -20
  147. package/src/models/AdConfig.ts +0 -10
@@ -0,0 +1,119 @@
1
+ package com.fireworksdk.bridge.reactnative.utils
2
+ import com.facebook.react.bridge.*
3
+ import org.json.JSONArray
4
+ import org.json.JSONException
5
+ import org.json.JSONObject
6
+
7
+
8
+ object FWDataUtils {
9
+
10
+ @Throws(JSONException::class)
11
+ fun convertJsonObjectToWritableMap(jsonObject: JSONObject?): WritableMap? {
12
+ if (jsonObject == null) {
13
+ return null
14
+ }
15
+ val map: WritableMap = WritableNativeMap()
16
+ val iterator = jsonObject.keys()
17
+ while (iterator.hasNext()) {
18
+ val key = iterator.next()
19
+ when (val value = jsonObject[key]) {
20
+ is JSONObject -> {
21
+ map.putMap(key, convertJsonObjectToWritableMap(value))
22
+ }
23
+ is JSONArray -> {
24
+ map.putArray(key, convertJsonObjectToWritableArray(value))
25
+ }
26
+ is Boolean -> {
27
+ map.putBoolean(key, value)
28
+ }
29
+ is Int -> {
30
+ map.putInt(key, value)
31
+ }
32
+ is Double -> {
33
+ map.putDouble(key, value)
34
+ }
35
+ is String -> {
36
+ map.putString(key, value)
37
+ }
38
+ else -> {
39
+ map.putString(key, value.toString())
40
+ }
41
+ }
42
+ }
43
+ return map
44
+ }
45
+
46
+ @Throws(JSONException::class)
47
+ fun convertJsonObjectToWritableArray(jsonArray: JSONArray?): WritableArray? {
48
+ if (jsonArray == null) {
49
+ return null
50
+ }
51
+ val array: WritableArray = WritableNativeArray()
52
+ for (i in 0 until jsonArray.length()) {
53
+ when (val value = jsonArray[i]) {
54
+ is JSONObject -> {
55
+ array.pushMap(convertJsonObjectToWritableMap(value))
56
+ }
57
+ is JSONArray -> {
58
+ array.pushArray(convertJsonObjectToWritableArray(value))
59
+ }
60
+ is Boolean -> {
61
+ array.pushBoolean(value)
62
+ }
63
+ is Int -> {
64
+ array.pushInt(value)
65
+ }
66
+ is Double -> {
67
+ array.pushDouble(value)
68
+ }
69
+ is String -> {
70
+ array.pushString(value)
71
+ }
72
+ else -> {
73
+ array.pushString(value.toString())
74
+ }
75
+ }
76
+ }
77
+ return array
78
+ }
79
+
80
+ @Throws(JSONException::class)
81
+ fun convertReadableMapToJsonObject(readableMap: ReadableMap?): JSONObject? {
82
+ if (readableMap == null) {
83
+ return null
84
+ }
85
+ val `object` = JSONObject()
86
+ val iterator = readableMap.keySetIterator()
87
+ while (iterator.hasNextKey()) {
88
+ val key = iterator.nextKey()
89
+ when (readableMap.getType(key)) {
90
+ ReadableType.Null -> `object`.put(key, JSONObject.NULL)
91
+ ReadableType.Boolean -> `object`.put(key, readableMap.getBoolean(key))
92
+ ReadableType.Number -> `object`.put(key, readableMap.getDouble(key))
93
+ ReadableType.String -> `object`.put(key, readableMap.getString(key))
94
+ ReadableType.Map -> `object`.put(key, convertReadableMapToJsonObject(readableMap.getMap(key)))
95
+ ReadableType.Array -> `object`.put(key, convertReadableArrayToJsonObject(readableMap.getArray(key)))
96
+ }
97
+ }
98
+ return `object`
99
+ }
100
+
101
+ @Throws(JSONException::class)
102
+ fun convertReadableArrayToJsonObject(readableArray: ReadableArray?): JSONArray? {
103
+ if (readableArray == null) {
104
+ return null
105
+ }
106
+ val array = JSONArray()
107
+ for (i in 0 until readableArray.size()) {
108
+ when (readableArray.getType(i)) {
109
+ ReadableType.Null -> {}
110
+ ReadableType.Boolean -> array.put(readableArray.getBoolean(i))
111
+ ReadableType.Number -> array.put(readableArray.getDouble(i))
112
+ ReadableType.String -> array.put(readableArray.getString(i))
113
+ ReadableType.Map -> array.put(convertReadableMapToJsonObject(readableArray.getMap(i)))
114
+ ReadableType.Array -> array.put(convertReadableArrayToJsonObject(readableArray.getArray(i)))
115
+ }
116
+ }
117
+ return array
118
+ }
119
+ }
@@ -1,15 +1,52 @@
1
1
  package com.fireworksdk.bridge.reactnative.utils
2
2
 
3
- import com.facebook.react.bridge.Arguments
4
- import com.facebook.react.bridge.ReactContext
5
- import com.facebook.react.bridge.WritableMap
3
+ import android.util.Log
4
+ import com.facebook.react.bridge.*
6
5
  import com.facebook.react.modules.core.DeviceEventManagerModule
7
6
  import com.facebook.react.uimanager.events.RCTEventEmitter
8
7
  import com.fireworksdk.bridge.models.*
8
+ import com.fireworksdk.bridge.reactnative.FWInitializationProvider
9
+ import com.fireworksdk.bridge.reactnative.module.FireworkSDKModule
10
+ import com.fireworksdk.bridge.reactnative.pages.FWContainerActivity
11
+ import com.fireworksdk.bridge.utils.FWDateUtils
12
+ import com.fireworksdk.bridge.utils.FWLogUtils
9
13
  import com.loopnow.fireworklibrary.data.Product
14
+ import java.util.*
10
15
 
11
16
  object FWEventUtils {
12
17
 
18
+ fun pushNativeContainer(reactContext: ReactContext, props: ReadableMap?, promise: Promise?) {
19
+ FWLogUtils.d { "FWNavigatorModule pushNativeContainer: $props" }
20
+ val activity = FWInitializationProvider.INSTANCE.resumedActivity
21
+
22
+ if (activity == null) {
23
+ promise?.resolve(false)
24
+ return
25
+ }
26
+
27
+ sendLogMessageEvent(reactContext, "[Android] Enter pushNativeContainer ${
28
+ FWDateUtils.getDateString(
29
+ Date()
30
+ )}")
31
+
32
+ UiThreadUtil.runOnUiThread {
33
+
34
+ sendLogMessageEvent(reactContext, "[Android] Before Starting container activity ${
35
+ FWDateUtils.getDateString(
36
+ Date()
37
+ )}")
38
+
39
+ activity.startActivity(FWContainerActivity.createIntent(activity, FireworkSDKModule.appComponentName, props?.toHashMap()))
40
+
41
+ sendLogMessageEvent(reactContext, "[Android] After Starting container activity ${
42
+ FWDateUtils.getDateString(
43
+ Date()
44
+ )}")
45
+ }
46
+
47
+ promise?.resolve(true)
48
+ }
49
+
13
50
  fun sendInitSuccessEvent(reactContext: ReactContext) {
14
51
  sendEvent(reactContext, FWEventName.SDKIni.rawValue, Arguments.createMap())
15
52
  }
@@ -109,6 +146,16 @@ object FWEventUtils {
109
146
  .emit(eventName, params)
110
147
  }
111
148
 
149
+ fun sendLogMessageEvent(reactContext: ReactContext, message: String?) {
150
+ FWLogUtils.d { message }
151
+
152
+ if (Log.DEBUG >= FWLogUtils.logLevel) {
153
+ val eventMap = Arguments.createMap()
154
+ eventMap.putString("message", message)
155
+ sendEvent(reactContext, FWEventName.LogMessage.rawValue, eventMap)
156
+ }
157
+ }
158
+
112
159
  fun receiveVideoFeedLoadFinishedSuccessEvent(reactContext: ReactContext, targetTag: Int) {
113
160
  receiveEvent(reactContext, targetTag, FWFeedViewEventName.VideoFeedLoadFinished.rawValue, null)
114
161
  }
@@ -0,0 +1,86 @@
1
+ package com.fireworksdk.bridge.utils
2
+
3
+ import android.os.Bundle
4
+ import android.os.Parcelable
5
+
6
+
7
+ object FWBundleUtils {
8
+
9
+ fun mapToBundle(map: Map<String, Any?>?): Bundle? {
10
+ if (map == null) {
11
+ return null
12
+ }
13
+ val bundle = Bundle()
14
+ for ((key, value) in map) {
15
+ if (value is Double) {
16
+ bundle.putDouble(key, value)
17
+ } else if (value is Int) {
18
+ bundle.putInt(key, value)
19
+ } else if (value is String) {
20
+ bundle.putString(key, value)
21
+ } else if (value is Boolean) {
22
+ bundle.putBoolean(key, value)
23
+ } else if (value is List<*>) {
24
+ val list = value as List<Any>
25
+ val first = list[0]
26
+ if (first == null || first is Double) {
27
+ bundle.putDoubleArray(key, listToDoubleArray(list))
28
+ } else if (first is Int) {
29
+ bundle.putIntArray(key, listToIntArray(list))
30
+ } else if (first is String) {
31
+ bundle.putStringArray(key, listToStringArray(list))
32
+ } else if (first is Map<*, *>) {
33
+ bundle.putParcelableArrayList(key, listToParcelableArrayList(list))
34
+ }
35
+ } else if (value is Map<*, *>) {
36
+ bundle.putBundle(key, mapToBundle(value as Map<String, Any>))
37
+ }
38
+ }
39
+ return bundle
40
+ }
41
+
42
+ private fun listToDoubleArray(list: List<Any>?): DoubleArray? {
43
+ if (list == null) {
44
+ return null
45
+ }
46
+ val doubles = DoubleArray(list.size)
47
+ for (i in list.indices) {
48
+ doubles[i] = list[i] as Double
49
+ }
50
+ return doubles
51
+ }
52
+
53
+ private fun listToIntArray(list: List<Any>?): IntArray? {
54
+ if (list == null) {
55
+ return null
56
+ }
57
+ val integers = IntArray(list.size)
58
+ for (i in list.indices) {
59
+ integers[i] = list[i] as Int
60
+ }
61
+ return integers
62
+ }
63
+
64
+ private fun listToStringArray(list: List<Any>?): Array<String?>? {
65
+ if (list == null) {
66
+ return null
67
+ }
68
+ val strings = arrayOfNulls<String>(list.size)
69
+ for (i in list.indices) {
70
+ strings[i] = list[i].toString()
71
+ }
72
+ return strings
73
+ }
74
+
75
+ private fun listToParcelableArrayList(list: List<Any>?): ArrayList<Parcelable?>? {
76
+ if (list == null) {
77
+ return null
78
+ }
79
+ val arrayList: ArrayList<Parcelable?> = ArrayList()
80
+ for (item in list) {
81
+ val map = item as Map<String, Any>
82
+ arrayList.add(mapToBundle(map))
83
+ }
84
+ return arrayList
85
+ }
86
+ }
@@ -0,0 +1,15 @@
1
+ package com.fireworksdk.bridge.utils
2
+
3
+ import org.jetbrains.annotations.NotNull
4
+ import java.text.DateFormat
5
+ import java.text.SimpleDateFormat
6
+ import java.util.*
7
+
8
+ object FWDateUtils {
9
+
10
+ fun getDateString(@NotNull date: Date): String {
11
+ val dateFormat: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())
12
+ dateFormat.timeZone = TimeZone.getDefault()
13
+ return dateFormat.format(date)
14
+ }
15
+ }
@@ -1,5 +1,6 @@
1
1
  package com.fireworksdk.bridge.utils
2
2
 
3
+ import android.content.Context
3
4
  import android.graphics.Color
4
5
  import com.loopnow.fireworklibrary.VideoPlayerProperties
5
6
  import com.fireworksdk.bridge.constants.FWVideoPlayerConstant
@@ -44,7 +45,11 @@ object FWVideoPlayerUtils {
44
45
  }
45
46
  }
46
47
 
47
- fun setPlaylistGroupFeedConfig(feedView: PlaylistGroupFeedView?, config: FWVideoFeedConfigModel?) {
48
+ fun setPlaylistGroupFeedConfig(context: Context, feedView: PlaylistGroupFeedView?, config: FWVideoFeedConfigModel?) {
49
+ config?.customLayoutName?.let {
50
+ val layout = context.resources.getIdentifier(it, "layout", context.packageName)
51
+ feedView?.setCustomLayout(layout)
52
+ }
48
53
  val backgroundColor = config?.backgroundColor
49
54
  if (!backgroundColor.isNullOrBlank()) {
50
55
  feedView?.setBackgroundColor(Color.parseColor(backgroundColor))
@@ -62,7 +67,12 @@ object FWVideoPlayerUtils {
62
67
  VideoFeedProperties.displayAdLabel = config?.showAdBadge == true
63
68
  }
64
69
 
65
- fun setVideoFeedConfig(feedView: VideoFeedView?, config: FWVideoFeedConfigModel?) {
70
+ fun setVideoFeedConfig(context: Context, feedView: VideoFeedView?, config: FWVideoFeedConfigModel?) {
71
+ config?.customLayoutName?.let {
72
+ val layout = context.resources.getIdentifier(it, "layout", context.packageName)
73
+ feedView?.setCustomLayout(layout)
74
+ }
75
+
66
76
  val backgroundColor = config?.backgroundColor
67
77
  if (!backgroundColor.isNullOrBlank()) {
68
78
  feedView?.setBackgroundColor(Color.parseColor(backgroundColor))
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <androidx.constraintlayout.widget.ConstraintLayout
3
+ xmlns:android="http://schemas.android.com/apk/res/android"
4
+ android:id="@+id/fw_bridge_container"
5
+ android:layout_width="match_parent"
6
+ android:layout_height="match_parent">
7
+
8
+ </androidx.constraintlayout.widget.ConstraintLayout>
@@ -31,7 +31,7 @@ public enum VideoFeedMode: Int {
31
31
 
32
32
  @objc
33
33
  public enum VideFeedSourceType: Int {
34
- case discover, channel, playlist, playlistGroup
34
+ case discover, channel, playlist, playlistGroup, dynamicContent
35
35
  }
36
36
 
37
37
  public protocol VideoFeedViewDelegate: AnyObject {
@@ -48,6 +48,7 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
48
48
  @objc public var channel: String = ""
49
49
  @objc public var playlist: String = ""
50
50
  @objc public var playlistGroup: String = ""
51
+ @objc public var dynamicContentParameters: NSDictionary = NSDictionary()
51
52
  @objc public var mode: VideoFeedMode = .row
52
53
  @objc public var feedViewConfig: VideoFeedConfiguration? {
53
54
  didSet {
@@ -81,6 +82,9 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
81
82
  return .channelPlaylist(channelID: channel, playlistID: playlist)
82
83
  case .playlistGroup:
83
84
  return .playlistGroup(groupID: playlistGroup)
85
+ case .dynamicContent:
86
+ let parameters = dynamicContentParameters as? [String: [String]]
87
+ return .dynamicContent(channelID: channel, parameters: parameters ?? [:])
84
88
  }
85
89
  }
86
90
 
@@ -153,28 +157,6 @@ public class VideoFeed: UIView, VideoFeedViewControllerDelegate {
153
157
  }
154
158
 
155
159
  extension VideoFeed {
156
- private func convertToFWAdBadgeConfiguration(_ adBadgeConfiguration: AdBadgeConfiguration?) -> FireworkVideo.AdBadgeConfiguration? {
157
- guard let adBadgeConfiguration = adBadgeConfiguration else {
158
- return nil
159
- }
160
-
161
- var fwAdBadgeConfiguration = FireworkVideo.AdBadgeConfiguration()
162
- if let textColor = adBadgeConfiguration.textColor {
163
- fwAdBadgeConfiguration.textColor = textColor.uicolor()
164
- }
165
- if let backgroundColor = adBadgeConfiguration.backgroundColor {
166
- fwAdBadgeConfiguration.backgroundColor = backgroundColor.uicolor()
167
- }
168
- switch adBadgeConfiguration.badgeTextType {
169
- case .sponsored:
170
- fwAdBadgeConfiguration.badgeText = FireworkVideo.AdBadgeConfiguration.BadgeText.sponsored
171
- default:
172
- fwAdBadgeConfiguration.badgeText = FireworkVideo.AdBadgeConfiguration.BadgeText.ad
173
- }
174
-
175
- return fwAdBadgeConfiguration
176
- }
177
-
178
160
  private func convertToVideoFeedConentConfiguration() -> VideoFeedContentConfiguration {
179
161
  var videoConfig = VideoFeedContentConfiguration()
180
162
  //set default value so that behavior will the same with Android
@@ -196,8 +178,7 @@ extension VideoFeed {
196
178
  if let shareBaseUrl = gShareBaseURL {
197
179
  videoConfig.playerView.shareButton.behavior.baseURL = URL(string:shareBaseUrl)
198
180
  }
199
- let adBadge = self.convertToFWAdBadgeConfiguration(gAdBadgeConfiguration)
200
- if let adBadge = adBadge {
181
+ if let adBadge = FireworkSDKModule.convertToFWAdBadgeConfiguration(gAdBadgeConfiguration) {
201
182
  videoConfig.adBadge = adBadge
202
183
  }
203
184
 
@@ -22,6 +22,7 @@ RCT_CUSTOM_VIEW_PROPERTY(source, VideFeedSourceType, VideoFeed) {
22
22
  RCT_EXPORT_VIEW_PROPERTY(channel, NSString)
23
23
  RCT_EXPORT_VIEW_PROPERTY(playlist, NSString)
24
24
  RCT_EXPORT_VIEW_PROPERTY(playlistGroup, NSString)
25
+ RCT_EXPORT_VIEW_PROPERTY(dynamicContentParameters, NSDictionary)
25
26
 
26
27
  RCT_CUSTOM_VIEW_PROPERTY(mode, VideoFeedMode, VideoFeed) {
27
28
  if (json) {