react-native-firework-sdk 1.7.1 → 2.0.0-beta.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 (141) hide show
  1. package/android/build.gradle +25 -43
  2. package/android/src/main/AndroidManifest.xml +4 -4
  3. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +48 -194
  4. package/android/src/main/java/com/fireworksdk/bridge/constants/FWVideoPlayerConstant.kt +7 -0
  5. package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModel.kt +2 -0
  6. package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModelDeserializer.kt +24 -0
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +1 -0
  8. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfiguration.kt +17 -0
  9. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationDeserializer.kt +35 -0
  10. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +12 -13
  11. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModelDeserializer.kt +67 -0
  12. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -1
  13. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +9 -10
  14. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelDeserializer.kt +67 -0
  15. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +0 -3
  16. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +19 -11
  17. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +74 -0
  18. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoShoppingProduct.kt +17 -15
  19. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoShoppingProductDeserializer.kt +120 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +4 -130
  21. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +48 -100
  22. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWNavigatorInterface.kt +2 -0
  23. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +2 -1
  24. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +2 -50
  25. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +17 -35
  26. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +152 -108
  27. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +84 -130
  28. package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWContainerActivity.kt +1 -14
  29. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/{FWDataUtils.kt → FWDataConvertUtils.kt} +1 -11
  30. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +14 -5
  31. package/android/src/main/java/com/fireworksdk/bridge/utils/FWCommonUtil.kt +23 -0
  32. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +312 -0
  33. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +14 -0
  34. package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +10 -14
  35. package/android/src/main/res/layout/fw_bridge_fragment_container.xml +2 -2
  36. package/android/src/main/res/values/colors.xml +2 -2
  37. package/android/src/main/res/values/styles.xml +0 -40
  38. package/ios/Components/StoryBlock.swift +1 -8
  39. package/ios/Components/StoryBlockManager.swift +4 -0
  40. package/ios/Components/VideoFeed.swift +9 -14
  41. package/ios/Components/VideoFeedConfiguration.swift +2 -0
  42. package/ios/Components/VideoFeedManager.m +2 -0
  43. package/ios/Components/VideoFeedManager.swift +4 -0
  44. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  45. package/ios/FireworkSdk.xcodeproj/project.pbxproj +12 -8
  46. package/ios/Models/Common/FontInfo.swift +57 -0
  47. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +2 -0
  48. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +295 -103
  49. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +0 -2
  50. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +12 -12
  51. package/ios/Modules/LiveStream/LiveStreamModule.swift +5 -3
  52. package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +7 -2
  53. package/ios/Modules/Shopping/ShoppingModule.m +1 -1
  54. package/ios/Modules/Shopping/ShoppingModule.swift +72 -63
  55. package/ios/Utils/FWSwizzleLoader.m +0 -1
  56. package/lib/commonjs/FWNavigator.js +14 -16
  57. package/lib/commonjs/FWNavigator.js.map +1 -1
  58. package/lib/commonjs/FireworkSDK.js +5 -34
  59. package/lib/commonjs/FireworkSDK.js.map +1 -1
  60. package/lib/commonjs/LiveStream.js +2 -2
  61. package/lib/commonjs/LiveStream.js.map +1 -1
  62. package/lib/commonjs/VideoShopping.js +59 -39
  63. package/lib/commonjs/VideoShopping.js.map +1 -1
  64. package/lib/commonjs/components/StoryBlock.js +3 -0
  65. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  66. package/lib/commonjs/components/VideoFeed.js +14 -5
  67. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  68. package/lib/commonjs/index.js.map +1 -1
  69. package/lib/commonjs/models/FWEventName.js +1 -1
  70. package/lib/commonjs/models/FWEventName.js.map +1 -1
  71. package/lib/commonjs/models/IOSFontInfo.js +2 -0
  72. package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -1
  73. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  74. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  75. package/lib/module/FWNavigator.js +15 -16
  76. package/lib/module/FWNavigator.js.map +1 -1
  77. package/lib/module/FireworkSDK.js +5 -32
  78. package/lib/module/FireworkSDK.js.map +1 -1
  79. package/lib/module/LiveStream.js +2 -2
  80. package/lib/module/LiveStream.js.map +1 -1
  81. package/lib/module/VideoShopping.js +58 -38
  82. package/lib/module/VideoShopping.js.map +1 -1
  83. package/lib/module/components/StoryBlock.js +3 -0
  84. package/lib/module/components/StoryBlock.js.map +1 -1
  85. package/lib/module/components/VideoFeed.js +14 -5
  86. package/lib/module/components/VideoFeed.js.map +1 -1
  87. package/lib/module/index.js.map +1 -1
  88. package/lib/module/models/FWEventName.js +1 -1
  89. package/lib/module/models/FWEventName.js.map +1 -1
  90. package/lib/module/models/IOSFontInfo.js +2 -0
  91. package/lib/module/modules/FWNavigatorModule.js.map +1 -1
  92. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  93. package/lib/module/modules/ShoppingModule.js.map +1 -1
  94. package/lib/typescript/FWNavigator.d.ts +11 -14
  95. package/lib/typescript/FireworkSDK.d.ts +5 -16
  96. package/lib/typescript/LiveStream.d.ts +2 -2
  97. package/lib/typescript/VideoShopping.d.ts +24 -19
  98. package/lib/typescript/components/StoryBlock.d.ts +4 -1
  99. package/lib/typescript/components/VideoFeed.d.ts +7 -3
  100. package/lib/typescript/index.d.ts +6 -5
  101. package/lib/typescript/models/FWEventName.d.ts +2 -2
  102. package/lib/typescript/models/FWEvents.d.ts +5 -6
  103. package/lib/typescript/models/IOSFontInfo.d.ts +19 -0
  104. package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +23 -0
  105. package/lib/typescript/models/VideoFeedConfiguration.d.ts +22 -4
  106. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +18 -2
  107. package/lib/typescript/modules/FWNavigatorModule.d.ts +2 -3
  108. package/lib/typescript/modules/FireworkSDKModule.d.ts +0 -2
  109. package/lib/typescript/modules/ShoppingModule.d.ts +2 -3
  110. package/package.json +1 -1
  111. package/react-native-firework-sdk.podspec +1 -1
  112. package/src/FWNavigator.ts +52 -0
  113. package/src/FireworkSDK.ts +5 -28
  114. package/src/LiveStream.ts +2 -2
  115. package/src/VideoShopping.ts +74 -54
  116. package/src/components/StoryBlock.tsx +4 -1
  117. package/src/components/VideoFeed.tsx +15 -5
  118. package/src/{index.tsx → index.ts} +17 -9
  119. package/src/models/FWEventName.ts +1 -1
  120. package/src/models/FWEvents.ts +6 -7
  121. package/src/models/IOSFontInfo.ts +29 -0
  122. package/src/models/ProductInfoViewConfiguration.ts +25 -0
  123. package/src/models/VideoFeedConfiguration.ts +23 -4
  124. package/src/models/VideoPlayerConfiguration.ts +19 -2
  125. package/src/modules/FWNavigatorModule.ts +2 -1
  126. package/src/modules/FireworkSDKModule.ts +0 -2
  127. package/src/modules/ShoppingModule.ts +2 -9
  128. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGsonUtil.kt +0 -38
  129. package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +0 -122
  130. package/android/src/main/res/layout/fw_bridge_fragment_playlistfeed.xml +0 -18
  131. package/android/src/main/res/layout/fw_bridge_fragment_shoppingcart.xml +0 -8
  132. package/android/src/main/res/layout/fw_bridge_fragment_videofeed.xml +0 -17
  133. package/ios/Utils/FWPiPManager.swift +0 -24
  134. package/ios/Utils/UIButton+FWSwizzle.swift +0 -33
  135. package/lib/commonjs/models/NewNativeContainerProps.js +0 -2
  136. package/lib/module/models/NewNativeContainerProps.js +0 -2
  137. package/lib/typescript/models/NewNativeContainerProps.d.ts +0 -6
  138. package/src/FWNavigator.tsx +0 -58
  139. package/src/models/NewNativeContainerProps.ts +0 -4
  140. /package/lib/commonjs/models/{NewNativeContainerProps.js.map → IOSFontInfo.js.map} +0 -0
  141. /package/lib/module/models/{NewNativeContainerProps.js.map → IOSFontInfo.js.map} +0 -0
@@ -5,7 +5,7 @@ buildscript {
5
5
  repositories {
6
6
  google()
7
7
  mavenCentral()
8
- maven { url "https://jitpack.io" }
8
+ mavenLocal()
9
9
  }
10
10
 
11
11
  dependencies {
@@ -28,10 +28,6 @@ def getExtOrIntegerDefault(name) {
28
28
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['FireworkSDK_' + name]).toInteger()
29
29
  }
30
30
 
31
- //static def getTime() {
32
- // return new Date().format("yyyyMMdd", TimeZone.getDefault());
33
- //}
34
-
35
31
  android {
36
32
  compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
37
33
  defaultConfig {
@@ -67,35 +63,20 @@ android {
67
63
  targetCompatibility JavaVersion.VERSION_1_8
68
64
  }
69
65
 
70
- // when set classpath("com.android.tools.build:gradle:4.2.2"), will show error:
71
- // No such property: outputFactory for class: com.android.build.gradle.internal.variant.LibraryVariantData
72
- // afterEvaluate {
73
- // libraryVariants.all { variant ->
74
- // variant.variantData.outputFactory.apkDataList.each { apkData ->
75
- // def flavor = variant.mergedFlavor
76
- // def name = flavor.getVersionName()
77
- // def code = flavor.getVersionCode()
78
- //
79
- // // project.name ->
80
- // // buildType.name -> debug
81
- // // apkData.outputFileName -> ${project.name}-${buildType.name}.aar
82
- // if (variant.name == 'debug') {
83
- // apkData.outputFileName = "fireworksdk_bridge" + "-" + variant.name + ".aar"
84
- // // apkData.outputFileName = apkData.outputFileName.replace(".aar","-" + name + ".aar" )
85
- // } else if (variant.name == 'release') {
86
- // apkData.outputFileName = "fireworksdk_bridge" + "-" + variant.name + ".aar"
87
- // // apkData.outputFileName = apkData.outputFileName.replace(".aar","-" + name + ".aar" )
88
- // }
89
- // }
90
- // }
91
- // }
92
-
93
66
  }
94
67
 
95
68
  repositories {
96
- maven { url 'https://jitpack.io' }
97
69
  mavenCentral()
98
70
  google()
71
+ maven { url 'https://jitpack.io' }
72
+ mavenLocal()
73
+
74
+ maven {
75
+ setUrl("https://s01.oss.sonatype.org/content/repositories/snapshots/")
76
+ mavenContent {
77
+ snapshotsOnly()
78
+ }
79
+ }
99
80
 
100
81
  def found = false
101
82
  def defaultDir = null
@@ -166,24 +147,24 @@ repositories {
166
147
  def kotlin_version = getExtOrDefault('kotlinVersion')
167
148
 
168
149
  dependencies {
169
-
170
- def firework_sdk_version = 'v5.14.14'
171
- implementation "com.github.loopsocial:firework_sdk:$firework_sdk_version"
172
-
173
- // noinspection GradleDynamicVersion
174
150
  api 'com.facebook.react:react-native:+'
175
151
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
176
- implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
152
+
153
+
154
+ def fireworkSdkVersion = "6.0.0-RC.2"
155
+ implementation "com.firework:sdk:$fireworkSdkVersion"
156
+ implementation "com.firework.external.imageloading:glide:$fireworkSdkVersion"
157
+ implementation "com.firework.external.livestream:singleHostPlayer:$fireworkSdkVersion"
158
+ implementation "com.firework.external.livestream:multiHostPlayer:$fireworkSdkVersion"
159
+
160
+ // def fireworkSdkVersion = "unspecified"
161
+ // implementation "firework_sdk_v2:fireworkSdk:$fireworkSdkVersion"
162
+ // implementation "firework_sdk_v2.external:glideImageLoader:$fireworkSdkVersion"
163
+ // implementation "firework_sdk_v2.external:singleHostLivestreamPlayer:$fireworkSdkVersion"
164
+ // implementation "firework_sdk_v2.external:multiHostLivestreamPlayer:$fireworkSdkVersion"
165
+
177
166
  // required to avoid crash on Android 12 API 31
178
167
  implementation 'androidx.work:work-runtime-ktx:2.7.0'
179
- // if RN is 0.66.4, you cannot use okhttp3 3.x versions
180
- implementation 'com.squareup.okhttp3:okhttp:4.9.0'
181
- implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
182
- // react-native 0.61.3
183
- implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
184
-
185
- implementation "com.google.code.gson:gson:2.9.0"
186
- implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
187
168
  }
188
169
 
189
170
  configurations.all {
@@ -192,3 +173,4 @@ configurations.all {
192
173
  force 'androidx.core:core:1.6.0'
193
174
  }
194
175
  }
176
+
@@ -4,24 +4,24 @@
4
4
  <uses-permission android:name="android.permission.INTERNET" />
5
5
 
6
6
  <application>
7
- <activity
8
- android:name="com.loopnow.fireworklibrary.PlaybackActivity"
9
- />
10
7
  <activity
11
8
  android:name="com.fireworksdk.bridge.reactnative.pages.FWContainerActivity"
12
- android:theme="@style/Theme.AppCompat.Light.NoActionBar"
13
9
  />
10
+
14
11
  <provider
15
12
  android:authorities="${applicationId}.fwBridgeProvider"
16
13
  android:name="com.fireworksdk.bridge.FWInitializationProvider"
17
14
  android:exported="false"
18
15
  />
16
+
19
17
  <meta-data
20
18
  android:name="com.google.android.gms.ads.AD_MANAGER_APP"
21
19
  android:value="true" />
20
+
22
21
  <meta-data
23
22
  android:name="Firework:RecyclerViewRequestLayoutEnable"
24
23
  android:value="true" />
24
+
25
25
  </application>
26
26
 
27
27
  </manifest>
@@ -2,17 +2,11 @@ package com.fireworksdk.bridge.components.videofeed
2
2
 
3
3
  import android.content.Context
4
4
  import android.util.AttributeSet
5
- import android.util.Log
6
- import android.view.LayoutInflater
5
+ import android.view.ViewGroup
7
6
  import android.widget.RelativeLayout
8
- import androidx.constraintlayout.widget.ConstraintLayout
9
- import com.loopnow.fireworklibrary.FeedType
10
- import com.loopnow.fireworklibrary.models.FeedLayout
11
- import com.loopnow.fireworklibrary.views.VideoFeedView
12
- import com.fireworksdk.bridge.R
7
+ import com.firework.videofeed.FwVideoFeedView
13
8
  import com.fireworksdk.bridge.models.*
14
- import com.fireworksdk.bridge.utils.FWVideoPlayerUtils
15
- import com.loopnow.fireworklibrary.views.PlaylistGroupFeedView
9
+ import com.fireworksdk.bridge.utils.FWConfigUtil
16
10
 
17
11
 
18
12
  class FWVideoFeed(
@@ -20,223 +14,83 @@ class FWVideoFeed(
20
14
  attrs: AttributeSet?
21
15
  ) : RelativeLayout(context, attrs) {
22
16
 
23
- private var videoFeedViewContainer: ConstraintLayout? = null
24
- var videoFeedView: VideoFeedView? = null
17
+ constructor(context: Context) : this(context, null)
25
18
 
26
- private var playlistGroupFeedViewContainer: ConstraintLayout? = null
27
- var playlistGroupFeedView: PlaylistGroupFeedView? = null
19
+ val videoFeedView = FwVideoFeedView(context)
20
+ var videoFeedPropsModel: FWVideoFeedPropsModel = FWVideoFeedPropsModel()
28
21
 
29
- val videoFeedPropsModel: FWVideoFeedPropsModel by lazy { FWVideoFeedPropsModel() }
30
- private var currentMode: String? = null
31
- private var currentPlaylistGroupId: String? = null
22
+ init {
23
+ videoFeedView.layoutDirection = LAYOUT_DIRECTION_LOCALE
24
+ addView(videoFeedView, LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
25
+ }
32
26
 
33
- constructor(context: Context) : this(context, null)
27
+ fun afterUpdateTransaction() {
28
+ val viewOptionsBuilder = FWConfigUtil.generateViewOptionsBuilder(videoFeedPropsModel)
29
+ videoFeedView.init(viewOptionsBuilder.build())
30
+ }
34
31
 
35
32
  fun setProps(props: FWVideoFeedPropsModel?) {
36
- if (props != null) {
37
- videoFeedPropsModel.source = props.source
38
- videoFeedPropsModel.channel = props.channel
39
- videoFeedPropsModel.playlist = props.playlist
40
- videoFeedPropsModel.playlistGroup = props.playlistGroup
41
- videoFeedPropsModel.mode = props.mode
42
- videoFeedPropsModel.videoFeedConfiguration = props.videoFeedConfiguration
43
- videoFeedPropsModel.videoPlayerConfiguration = props.videoPlayerConfiguration
44
- videoFeedPropsModel.dynamicContentParameters = props.dynamicContentParameters
45
- }
46
- setData()
33
+ props ?: return
34
+ videoFeedPropsModel = props
35
+ afterUpdateTransaction()
47
36
  }
48
37
 
49
38
  fun setSourceProps(source: String?) {
50
- videoFeedPropsModel.source = source
51
- setData()
39
+ videoFeedPropsModel = videoFeedPropsModel.copy(
40
+ source = source
41
+ )
52
42
  }
53
43
 
54
44
  fun setChannelProps(channel: String?) {
55
- videoFeedPropsModel.channel = channel
56
- setData()
45
+ videoFeedPropsModel = videoFeedPropsModel.copy(
46
+ channel = channel
47
+ )
57
48
  }
58
49
 
59
50
  fun setPlaylistProps(playlist: String?) {
60
- videoFeedPropsModel.playlist = playlist
61
- setData()
51
+ videoFeedPropsModel = videoFeedPropsModel.copy(
52
+ playlist = playlist
53
+ )
62
54
  }
63
55
 
64
56
  fun setPlaylistGroupProps(playlistGroup: String?) {
65
- videoFeedPropsModel.playlistGroup = playlistGroup
66
- setData()
57
+ videoFeedPropsModel = videoFeedPropsModel.copy(
58
+ playlistGroup = playlistGroup
59
+ )
67
60
  }
68
61
 
69
62
  fun setModeProps(mode: String?) {
70
- videoFeedPropsModel.mode = mode
71
- setData()
63
+ videoFeedPropsModel = videoFeedPropsModel.copy(
64
+ mode = mode
65
+ )
66
+ }
67
+
68
+ fun setEnablePictureInPicture(enablePictureInPicture: Boolean?) {
69
+ videoFeedPropsModel = videoFeedPropsModel.copy(
70
+ enablePictureInPicture = enablePictureInPicture
71
+ )
72
72
  }
73
73
 
74
74
  fun setDynamicContentParametersProps(dynamicContentParameters: HashMap<String, List<String>>?) {
75
- videoFeedPropsModel.dynamicContentParameters = dynamicContentParameters
76
- setData()
75
+ videoFeedPropsModel = videoFeedPropsModel.copy(
76
+ dynamicContentParameters = dynamicContentParameters
77
+ )
77
78
  }
78
79
 
79
80
  fun setVideoFeedConfigProps(config: FWVideoFeedConfigModel?) {
80
- videoFeedPropsModel.videoFeedConfiguration = config
81
- setData()
81
+ videoFeedPropsModel = videoFeedPropsModel.copy(
82
+ videoFeedConfiguration = config
83
+ )
82
84
  }
83
85
 
84
86
  fun setVideoPlayerConfigProps(config: FWVideoPlayerConfigModel?) {
85
- videoFeedPropsModel.videoPlayerConfiguration = config
86
- setData()
87
+ videoFeedPropsModel = videoFeedPropsModel.copy(
88
+ videoPlayerConfiguration = config
89
+ )
87
90
  }
88
91
 
89
92
  fun refresh() {
90
- videoFeedView?.refreshFeed()
91
- playlistGroupFeedView?.refresh()
92
- }
93
-
94
- private fun setData() {
95
- val source = videoFeedPropsModel.source
96
- val mode = videoFeedPropsModel.mode
97
- val dynamicContentParameters = videoFeedPropsModel.dynamicContentParameters
98
- val channel = videoFeedPropsModel.channel
99
- val playlist = videoFeedPropsModel.playlist
100
- val playlistGroup = videoFeedPropsModel.playlistGroup
101
- val videoFeedConfiguration = videoFeedPropsModel.videoFeedConfiguration
102
- val videoPlayerConfiguration = videoFeedPropsModel.videoPlayerConfiguration
103
-
104
- if (source.isNullOrBlank()) {
105
- return
106
- }
107
- when (source) {
108
- FWVideoFeedSource.PlaylistGroup.rawValue -> {
109
- setPlaylistGroupFeed(mode, playlistGroup, videoFeedConfiguration, videoPlayerConfiguration)
110
- }
111
- FWVideoFeedSource.DynamicContent.rawValue -> {
112
- setFeed(mode, channel, playlist, FeedType.DYNAMIC_CONTENT, dynamicContentParameters, videoFeedConfiguration, videoPlayerConfiguration)
113
- }
114
- FWVideoFeedSource.Playlist.rawValue -> {
115
- setFeed(mode, channel, playlist, FeedType.PLAYLIST, null, videoFeedConfiguration, videoPlayerConfiguration)
116
- }
117
- FWVideoFeedSource.Channel.rawValue -> {
118
- setFeed(mode, channel, null, FeedType.CHANNEL, null, videoFeedConfiguration, videoPlayerConfiguration)
119
- }
120
- else -> {
121
- setFeed(mode, null, null, FeedType.DISCOVER, null, videoFeedConfiguration, videoPlayerConfiguration)
122
- }
123
- }
124
- }
125
-
126
- private fun setFeed(
127
- mode: String?,
128
- channelId: String?, playlistId: String?, feedType: FeedType?,
129
- dynamicContentParameters: HashMap<String, List<String>>?,
130
- videoFeedConfiguration: FWVideoFeedConfigModel?,
131
- videoPlayerConfiguration: FWVideoPlayerConfigModel?,
132
- ) {
133
- // add view
134
- addVideoFeedView()
135
-
136
- // set layout
137
- val feedLayout = when {
138
- mode.equals(FWVideoFeedModel.Column.rawValue) -> FeedLayout.VERTICAL
139
- mode.equals(FWVideoFeedModel.Grid.rawValue) -> FeedLayout.GRID
140
- else -> FeedLayout.HORIZONTAL
141
- }
142
- if (mode.isNullOrBlank() || mode != currentMode) {
143
- videoFeedView?.setLayout(feedLayout)
144
- currentMode = mode
145
- }
146
-
147
- // set channel playlistId feedType
148
- if (feedType == FeedType.DYNAMIC_CONTENT && !channelId.isNullOrBlank()) {
149
- videoFeedView?.setDynamicContent(channelId, dynamicContentParameters?:hashMapOf())
150
- } else if (feedType == FeedType.CHANNEL && !channelId.isNullOrBlank()) {
151
- videoFeedView?.setFeed(channelId, null, FeedType.CHANNEL)
152
- } else if (feedType == FeedType.PLAYLIST && !channelId.isNullOrBlank() && !playlistId.isNullOrBlank()) {
153
- videoFeedView?.setFeed(channelId, playlistId, FeedType.PLAYLIST)
154
- } else {
155
- videoFeedView?.setFeed(null, null, FeedType.DISCOVER)
156
- }
157
-
158
- // set Feed Configuration
159
- FWVideoPlayerUtils.setVideoFeedConfig(context, videoFeedView, videoFeedConfiguration)
160
- // set Player Configuration
161
- FWVideoPlayerUtils.setVideoPlayerConfig(videoPlayerConfiguration)
93
+ videoFeedView.refresh()
162
94
  }
163
95
 
164
- private fun setPlaylistGroupFeed(
165
- mode: String?,
166
- playlistGroupId: String?,
167
- videoFeedConfiguration: FWVideoFeedConfigModel?,
168
- videoPlayerConfiguration: FWVideoPlayerConfigModel?,
169
- ) {
170
- // add view
171
- addPlaylistGroupFeedView()
172
-
173
- // set layout
174
- val feedLayout = when {
175
- mode.equals(FWVideoFeedModel.Column.rawValue) -> FeedLayout.VERTICAL
176
- mode.equals(FWVideoFeedModel.Grid.rawValue) -> FeedLayout.GRID
177
- else -> FeedLayout.HORIZONTAL
178
- }
179
-
180
- if (mode.isNullOrBlank() || mode != currentMode) {
181
- playlistGroupFeedView?.setLayout(feedLayout)
182
- currentMode = mode
183
- }
184
-
185
- // set playlistGroupId
186
- if (playlistGroupId != currentPlaylistGroupId) {
187
- playlistGroupFeedView?.setPlaylistGroupId(playlistGroupId)
188
- currentPlaylistGroupId = playlistGroupId
189
- }
190
-
191
- // set Feed Configuration
192
- FWVideoPlayerUtils.setPlaylistGroupFeedConfig(context, playlistGroupFeedView, videoFeedConfiguration)
193
- // set Player Configuration
194
- FWVideoPlayerUtils.setVideoPlayerConfig(videoPlayerConfiguration)
195
- }
196
-
197
- private fun addVideoFeedView() {
198
- removePlaylistGroupFeedView()
199
- if (videoFeedView != null) {
200
- return
201
- }
202
- videoFeedViewContainer =
203
- LayoutInflater.from(context).inflate(R.layout.fw_bridge_fragment_videofeed, this, false) as ConstraintLayout?
204
- videoFeedView = videoFeedViewContainer?.findViewById(R.id.fw_bridge_videofeed)
205
- if (videoFeedView != null) {
206
- Log.e("videoFeedView", "layoutDirection: " + videoFeedView?.layoutDirection.toString())
207
- videoFeedView?.layoutDirection = LAYOUT_DIRECTION_LOCALE
208
- addView(videoFeedViewContainer)
209
- }
210
- }
211
-
212
- private fun removeVideoFeedView() {
213
- if (videoFeedViewContainer == null) {
214
- return
215
- }
216
- removeView(videoFeedViewContainer)
217
- videoFeedViewContainer = null
218
- videoFeedView = null
219
- }
220
-
221
- private fun addPlaylistGroupFeedView() {
222
- removeVideoFeedView()
223
- if (playlistGroupFeedView != null) {
224
- return
225
- }
226
- playlistGroupFeedViewContainer =
227
- LayoutInflater.from(context).inflate(R.layout.fw_bridge_fragment_playlistfeed, this, false) as ConstraintLayout?
228
- playlistGroupFeedView = playlistGroupFeedViewContainer?.findViewById(R.id.fw_bridge_playlistfeed)
229
- if (playlistGroupFeedView != null) {
230
- addView(playlistGroupFeedViewContainer)
231
- }
232
- }
233
-
234
- private fun removePlaylistGroupFeedView() {
235
- if (playlistGroupFeedViewContainer == null) {
236
- return
237
- }
238
- removeView(playlistGroupFeedViewContainer)
239
- playlistGroupFeedViewContainer = null
240
- playlistGroupFeedView = null
241
- }
242
96
  }
@@ -29,4 +29,11 @@ object FWVideoPlayerConstant {
29
29
  */
30
30
  const val FW_PLAYER_LAUNCH_BEHAVIOR_DEFAULT = "default"
31
31
  const val FW_PLAYER_LAUNCH_BEHAVIOR_MUTE_ON_FIRST_LAUNCH = "muteOnFirstLaunch"
32
+
33
+ /**
34
+ * cta delay type
35
+ */
36
+ const val FW_CTA_DELAY_TYPE_CONSTANT = "constant"
37
+ const val FW_CTA_DELAY_TYPE_PERCENTAGE = "percentage"
38
+
32
39
  }
@@ -6,4 +6,6 @@ import kotlinx.android.parcel.Parcelize
6
6
  @Parcelize
7
7
  data class FWAdBadgeConfigModel(
8
8
  var badgeTextType: String? = null,
9
+ var backgroundColor: String? = null,
10
+ var textColor: String? = null,
9
11
  ) : Parcelable
@@ -0,0 +1,24 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import org.json.JSONObject
4
+
5
+ object FWAdBadgeConfigModelDeserializer {
6
+
7
+ private const val BADGE_TEXT_TYPE_KEY = "badgeTextType"
8
+ private const val BACKGROUND_COLOR_KEY = "backgroundColor"
9
+ private const val TEXT_COLOR_KEY = "textColor"
10
+
11
+ fun deserialize(responseJson: JSONObject?): FWAdBadgeConfigModel? {
12
+ responseJson ?: return null
13
+
14
+ val badgeTextType = responseJson.optString(BADGE_TEXT_TYPE_KEY)
15
+ val backgroundColor = responseJson.optString(BACKGROUND_COLOR_KEY)
16
+ val textColor = responseJson.optString(TEXT_COLOR_KEY)
17
+
18
+ return FWAdBadgeConfigModel(
19
+ badgeTextType = badgeTextType,
20
+ backgroundColor = backgroundColor,
21
+ textColor = textColor,
22
+ )
23
+ }
24
+ }
@@ -35,6 +35,7 @@ enum class FWVideoShoppingEventName(val rawValue: String) {
35
35
  ClickCartIcon("fw:shopping:click-cart-icon"),
36
36
  UpdateProductDetails("fw:shopping:update-product-details"),
37
37
  WillDisplayProduct("fw:shopping:will-display-product"),
38
+ CustomLinkButtonClick("fw:shopping:custom-link-button-click"),
38
39
  }
39
40
 
40
41
  enum class FWLiveStreamEventName(val rawValue: String) {
@@ -0,0 +1,17 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import android.os.Parcelable
4
+ import kotlinx.android.parcel.Parcelize
5
+
6
+ @Parcelize
7
+ data class FWProductInfoViewConfiguration(
8
+ var addToCartButton: AddToCartButtonStyle? = null,
9
+ ) : Parcelable {
10
+
11
+ @Parcelize
12
+ data class AddToCartButtonStyle(
13
+ var backgroundColor: String? = null,
14
+ var textColor: String? = null,
15
+ var fontSize: Int? = null,
16
+ ) : Parcelable
17
+ }
@@ -0,0 +1,35 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import org.json.JSONObject
4
+
5
+ object FWProductInfoViewConfigurationDeserializer {
6
+
7
+ private const val ADD_TO_CART_BUTTON_STYLE = "addToCartButton"
8
+
9
+ private const val BACKGROUND_COLOR_KEY = "backgroundColor"
10
+ private const val TEXT_COLOR_KEY = "textColor"
11
+ private const val FONT_SIZE_KEY = "fontSize"
12
+
13
+ fun deserialize(responseJson: JSONObject?): FWProductInfoViewConfiguration? {
14
+ responseJson ?: return null
15
+
16
+ val addToCartButton = deserializeAddToCartButtonStyle(responseJson.optJSONObject(ADD_TO_CART_BUTTON_STYLE))
17
+
18
+ return FWProductInfoViewConfiguration(
19
+ addToCartButton = addToCartButton
20
+ )
21
+ }
22
+
23
+ private fun deserializeAddToCartButtonStyle(addToCartButtonStyleJson: JSONObject?): FWProductInfoViewConfiguration.AddToCartButtonStyle {
24
+ val backgroundColor = addToCartButtonStyleJson?.optString(BACKGROUND_COLOR_KEY)
25
+ val textColor = addToCartButtonStyleJson?.optString(TEXT_COLOR_KEY)
26
+ val fontSize = addToCartButtonStyleJson?.optInt(FONT_SIZE_KEY)
27
+
28
+ return FWProductInfoViewConfiguration.AddToCartButtonStyle(
29
+ backgroundColor = backgroundColor,
30
+ textColor = textColor,
31
+ fontSize = fontSize,
32
+ )
33
+ }
34
+
35
+ }
@@ -5,27 +5,26 @@ import kotlinx.android.parcel.Parcelize
5
5
 
6
6
  @Parcelize
7
7
  data class FWVideoFeedConfigModel(
8
- var backgroundColor: String? = null,
9
- var cornerRadius: Int? = null,
10
- var title: FWTitleModel? = null,
11
- var titlePosition: String? = null,
12
- var playIcon: FWPlayIconModel? = null,
13
- var showAdBadge: Boolean? = null,
14
- var customLayoutName: String? = null,
15
- var enableAutoplay: Boolean? = null,
8
+ val backgroundColor: String? = null,
9
+ val cornerRadius: Int? = null,
10
+ val title: FWTitleModel? = null,
11
+ val titlePosition: String? = null,
12
+ val playIcon: FWPlayIconModel? = null,
13
+ val showAdBadge: Boolean? = null,
14
+ val enableAutoplay: Boolean? = null,
16
15
  val gridColumns: Int? = null,
17
16
  ) : Parcelable {
18
17
 
19
18
  @Parcelize
20
19
  data class FWTitleModel(
21
- var hidden: Boolean? = null,
22
- var textColor: String? = null,
23
- var fontSize: Int? = null,
20
+ val hidden: Boolean? = null,
21
+ val textColor: String? = null,
22
+ val fontSize: Int? = null,
24
23
  ) : Parcelable
25
24
 
26
25
  @Parcelize
27
26
  data class FWPlayIconModel(
28
- var hidden: Boolean? = null,
29
- var iconWidth: Int? = null,
27
+ val hidden: Boolean? = null,
28
+ val iconWidth: Int? = null,
30
29
  ) : Parcelable
31
30
  }
@@ -0,0 +1,67 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import org.json.JSONObject
4
+
5
+ object FWVideoFeedConfigModelDeserializer {
6
+
7
+ private const val BACKGROUND_COLOR_KEY = "backgroundColor"
8
+ private const val CORNER_RADIUS_KEY = "cornerRadius"
9
+ private const val TITLE_KEY = "title"
10
+ private const val TITLE_POSITION_KEY = "titlePosition"
11
+ private const val PLAY_ICON_KEY = "playIcon"
12
+ private const val SHOW_AD_BADGE_KEY = "showAdBadge"
13
+ private const val ENABLE_AUTOPLAY_KEY = "enableAutoplay"
14
+ private const val GRID_COLUMNS_KEY = "gridColumns"
15
+
16
+ private const val HIDDEN_KEY = "hidden"
17
+ private const val TEXT_COLOR_KEY = "textColor"
18
+ private const val FONT_SIZE_KEY = "fontSize"
19
+
20
+ private const val ICON_WIDTH_KEY = "iconWidth"
21
+
22
+ fun deserialize(responseJson: JSONObject?): FWVideoFeedConfigModel? {
23
+ responseJson?: return null
24
+
25
+ val backgroundColor = responseJson.optString(BACKGROUND_COLOR_KEY)
26
+ val cornerRadius = responseJson.optInt(CORNER_RADIUS_KEY)
27
+ val title = deserializeTitle(responseJson.optJSONObject(TITLE_KEY))
28
+ val titlePosition = responseJson.optString(TITLE_POSITION_KEY)
29
+ val playIcon = deserializePlayIcon(responseJson.optJSONObject(PLAY_ICON_KEY))
30
+ val showAdBadge = responseJson.optBoolean(SHOW_AD_BADGE_KEY)
31
+ val enableAutoplay = responseJson.optBoolean(ENABLE_AUTOPLAY_KEY)
32
+ val gridColumns = responseJson.optInt(GRID_COLUMNS_KEY)
33
+
34
+ return FWVideoFeedConfigModel(
35
+ backgroundColor = backgroundColor,
36
+ cornerRadius = cornerRadius,
37
+ title = title,
38
+ titlePosition = titlePosition,
39
+ playIcon = playIcon,
40
+ showAdBadge = showAdBadge,
41
+ enableAutoplay = enableAutoplay,
42
+ gridColumns = gridColumns,
43
+ )
44
+ }
45
+
46
+ private fun deserializeTitle(titleJson: JSONObject?): FWVideoFeedConfigModel.FWTitleModel {
47
+ val hidden = titleJson?.optBoolean(HIDDEN_KEY)
48
+ val textColor = titleJson?.optString(TEXT_COLOR_KEY)
49
+ val fontSize = titleJson?.optInt(FONT_SIZE_KEY)
50
+
51
+ return FWVideoFeedConfigModel.FWTitleModel(
52
+ hidden = hidden,
53
+ textColor = textColor,
54
+ fontSize = fontSize
55
+ )
56
+ }
57
+
58
+ private fun deserializePlayIcon(titleJson: JSONObject?): FWVideoFeedConfigModel.FWPlayIconModel {
59
+ val hidden = titleJson?.optBoolean(HIDDEN_KEY)
60
+ val iconWidth = titleJson?.optInt(ICON_WIDTH_KEY)
61
+
62
+ return FWVideoFeedConfigModel.FWPlayIconModel(
63
+ hidden = hidden,
64
+ iconWidth = iconWidth,
65
+ )
66
+ }
67
+ }
@@ -13,5 +13,5 @@ data class FWVideoFeedItemDetailsModel(
13
13
  val playlistGroup: String?,
14
14
  val playlist: String?,
15
15
  val channel: String?,
16
- val dynamicContentParameters: HashMap<String, List<String>>?,
16
+ val dynamicContentParameters: Map<String, List<String>>?,
17
17
  ) : Parcelable
@@ -1,19 +1,18 @@
1
1
  package com.fireworksdk.bridge.models
2
2
 
3
3
  import android.os.Parcelable
4
- import com.fireworksdk.bridge.models.FWVideoFeedConfigModel
5
- import com.fireworksdk.bridge.models.FWVideoPlayerConfigModel
6
4
  import kotlinx.android.parcel.Parcelize
7
5
 
8
6
 
9
7
  @Parcelize
10
8
  data class FWVideoFeedPropsModel(
11
- var source: String? = null,
12
- var channel: String? = null,
13
- var playlist: String? = null,
14
- var playlistGroup: String? = null,
15
- var mode: String? = null,
16
- var videoFeedConfiguration: FWVideoFeedConfigModel? = null,
17
- var videoPlayerConfiguration: FWVideoPlayerConfigModel? = null,
18
- var dynamicContentParameters: HashMap<String, List<String>>? = null,
9
+ val source: String? = null,
10
+ val channel: String? = null,
11
+ val playlist: String? = null,
12
+ val playlistGroup: String? = null,
13
+ val mode: String? = null,
14
+ val enablePictureInPicture: Boolean? = null,
15
+ val videoFeedConfiguration: FWVideoFeedConfigModel? = null,
16
+ val videoPlayerConfiguration: FWVideoPlayerConfigModel? = null,
17
+ val dynamicContentParameters: Map<String, List<String>>? = null,
19
18
  ) : Parcelable