react-native-firework-sdk 1.9.0-beta.3 → 2.0.0-beta.5

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 (187) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +25 -43
  3. package/android/src/main/AndroidManifest.xml +4 -4
  4. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +48 -193
  5. package/android/src/main/java/com/fireworksdk/bridge/constants/FWVideoPlayerConstant.kt +7 -0
  6. package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModel.kt +2 -0
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModelDeserializer.kt +24 -0
  8. package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModel.kt +10 -0
  9. package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModelDeserializer.kt +21 -0
  10. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfiguration.kt +17 -0
  11. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationDeserializer.kt +35 -0
  12. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModel.kt +11 -0
  13. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +24 -0
  14. package/android/src/main/java/com/fireworksdk/bridge/models/FWSystemTypeface.kt +9 -0
  15. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModel.kt +13 -13
  16. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModelDeserializer.kt +70 -0
  17. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -1
  18. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +9 -10
  19. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelDeserializer.kt +67 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +0 -3
  21. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +19 -11
  22. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +74 -0
  23. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoShoppingProduct.kt +17 -15
  24. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoShoppingProductDeserializer.kt +120 -0
  25. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +4 -130
  26. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +71 -100
  27. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWNavigatorInterface.kt +2 -0
  28. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWVideoShoppingInterface.kt +1 -1
  29. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +1 -1
  30. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +2 -50
  31. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +17 -35
  32. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +145 -111
  33. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +104 -133
  34. package/android/src/main/java/com/fireworksdk/bridge/reactnative/pages/FWContainerActivity.kt +1 -14
  35. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/{FWDataUtils.kt → FWDataConvertUtils.kt} +1 -11
  36. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +5 -5
  37. package/android/src/main/java/com/fireworksdk/bridge/utils/FWCommonUtil.kt +23 -0
  38. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +339 -0
  39. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +14 -0
  40. package/android/src/main/java/com/fireworksdk/bridge/utils/FWLanguageUtil.kt +10 -12
  41. package/android/src/main/res/layout/fw_bridge_fragment_container.xml +2 -2
  42. package/android/src/main/res/values/colors.xml +2 -2
  43. package/android/src/main/res/values/styles.xml +0 -40
  44. package/ios/Components/StoryBlock.swift +1 -5
  45. package/ios/Components/VideoFeed.swift +17 -32
  46. package/ios/Components/VideoPlayerConfiguration.swift +0 -5
  47. package/ios/FireworkSdk-Bridging-Header.h +0 -6
  48. package/ios/FireworkSdk.xcodeproj/project.pbxproj +208 -374
  49. package/ios/Models/NativeToRN/FireworkEventName.swift +1 -1
  50. package/ios/Models/RNToNative/RCTConvert+FireworkSDKModule.swift +20 -0
  51. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +86 -33
  52. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -2
  53. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +13 -34
  54. package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +29 -0
  55. package/ios/Utils/{Extensions/DispatchQueue+FWOnce.swift → DispatchQueue+FWOnce.swift} +3 -3
  56. package/ios/Utils/FWSwizzleLoader.m +1 -1
  57. package/ios/Utils/FWSwizzleUtil.swift +9 -17
  58. package/ios/Utils/{Extensions/Swizzle/UINavigationController+FWSwizzle.swift → UINavigationController+FWSwizzle.swift} +8 -6
  59. package/ios/Utils/UIView+ParentViewController.swift +21 -0
  60. package/ios/react_native_firework_sdk.h +0 -1
  61. package/lib/commonjs/FWNavigator.js +8 -41
  62. package/lib/commonjs/FWNavigator.js.map +1 -1
  63. package/lib/commonjs/FireworkSDK.js +50 -77
  64. package/lib/commonjs/FireworkSDK.js.map +1 -1
  65. package/lib/commonjs/LiveStream.js +2 -2
  66. package/lib/commonjs/LiveStream.js.map +1 -1
  67. package/lib/commonjs/VideoShopping.js +3 -38
  68. package/lib/commonjs/VideoShopping.js.map +1 -1
  69. package/lib/commonjs/components/StoryBlock.js +22 -4
  70. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  71. package/lib/commonjs/components/VideoFeed.js +17 -26
  72. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  73. package/lib/commonjs/index.js.map +1 -1
  74. package/lib/commonjs/models/AndroidFontInfo.js +2 -0
  75. package/lib/commonjs/models/FWEventName.js +1 -2
  76. package/lib/commonjs/models/FWEventName.js.map +1 -1
  77. package/lib/commonjs/models/SDKInitOptions.js +2 -0
  78. package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -1
  79. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  80. package/lib/commonjs/modules/ShoppingModule.js.map +1 -1
  81. package/lib/module/FWNavigator.js +9 -40
  82. package/lib/module/FWNavigator.js.map +1 -1
  83. package/lib/module/FireworkSDK.js +51 -76
  84. package/lib/module/FireworkSDK.js.map +1 -1
  85. package/lib/module/LiveStream.js +2 -2
  86. package/lib/module/LiveStream.js.map +1 -1
  87. package/lib/module/VideoShopping.js +3 -37
  88. package/lib/module/VideoShopping.js.map +1 -1
  89. package/lib/module/components/StoryBlock.js +20 -4
  90. package/lib/module/components/StoryBlock.js.map +1 -1
  91. package/lib/module/components/VideoFeed.js +18 -23
  92. package/lib/module/components/VideoFeed.js.map +1 -1
  93. package/lib/module/index.js.map +1 -1
  94. package/lib/module/models/AndroidFontInfo.js +2 -0
  95. package/lib/module/models/AndroidFontInfo.js.map +1 -0
  96. package/lib/module/models/FWEventName.js +1 -2
  97. package/lib/module/models/FWEventName.js.map +1 -1
  98. package/lib/module/models/SDKInitOptions.js +2 -0
  99. package/lib/module/models/SDKInitOptions.js.map +1 -0
  100. package/lib/module/modules/FWNavigatorModule.js.map +1 -1
  101. package/lib/module/modules/FireworkSDKModule.js +1 -2
  102. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  103. package/lib/module/modules/ShoppingModule.js.map +1 -1
  104. package/lib/typescript/FWNavigator.d.ts +6 -24
  105. package/lib/typescript/FireworkSDK.d.ts +22 -28
  106. package/lib/typescript/LiveStream.d.ts +2 -2
  107. package/lib/typescript/VideoShopping.d.ts +1 -18
  108. package/lib/typescript/components/StoryBlock.d.ts +9 -2
  109. package/lib/typescript/components/VideoFeed.d.ts +12 -5
  110. package/lib/typescript/index.d.ts +7 -6
  111. package/lib/typescript/models/AndroidFontInfo.d.ts +14 -0
  112. package/lib/typescript/models/FWEventName.d.ts +1 -2
  113. package/lib/typescript/models/FWEvents.d.ts +0 -6
  114. package/lib/typescript/models/SDKInitOptions.d.ts +6 -0
  115. package/lib/typescript/models/VideoFeedConfiguration.d.ts +11 -14
  116. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +1 -6
  117. package/lib/typescript/modules/FWNavigatorModule.d.ts +0 -3
  118. package/lib/typescript/modules/FireworkSDKModule.d.ts +4 -5
  119. package/lib/typescript/modules/ShoppingModule.d.ts +0 -2
  120. package/package.json +1 -1
  121. package/react-native-firework-sdk.podspec +18 -15
  122. package/src/FWNavigator.ts +8 -42
  123. package/src/FireworkSDK.ts +55 -71
  124. package/src/LiveStream.ts +2 -2
  125. package/src/VideoShopping.ts +4 -54
  126. package/src/components/StoryBlock.tsx +25 -4
  127. package/src/components/VideoFeed.tsx +22 -21
  128. package/src/index.ts +5 -11
  129. package/src/models/AndroidFontInfo.ts +14 -0
  130. package/src/models/FWEventName.ts +1 -2
  131. package/src/models/FWEvents.ts +0 -7
  132. package/src/models/SDKInitOptions.ts +7 -0
  133. package/src/models/VideoFeedConfiguration.ts +11 -14
  134. package/src/models/VideoPlayerConfiguration.ts +1 -7
  135. package/src/modules/FWNavigatorModule.ts +0 -1
  136. package/src/modules/FireworkSDKModule.ts +6 -8
  137. package/src/modules/ShoppingModule.ts +0 -5
  138. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGsonUtil.kt +0 -38
  139. package/android/src/main/java/com/fireworksdk/bridge/utils/FWVideoPlayerUtils.kt +0 -123
  140. package/android/src/main/res/layout/fw_bridge_fragment_playlistfeed.xml +0 -18
  141. package/android/src/main/res/layout/fw_bridge_fragment_shoppingcart.xml +0 -8
  142. package/android/src/main/res/layout/fw_bridge_fragment_videofeed.xml +0 -17
  143. package/ios/Utils/AppLanguage/Bundle+FWSwizzle.swift +0 -58
  144. package/ios/Utils/AppLanguage/FWAppLanguageManager.swift +0 -118
  145. package/ios/Utils/AppLanguage/FWLanguageUtil.swift +0 -39
  146. package/ios/Utils/AppLanguage/NumberFormatter+FWSwizzle.swift +0 -25
  147. package/ios/Utils/AppLanguage/UIImageView+FWSwizzle.swift +0 -91
  148. package/ios/Utils/AppLanguage/UILabel+FWSwizzle.swift +0 -98
  149. package/ios/Utils/AppLanguage/UITextField+FWSwizzle.swift +0 -97
  150. package/ios/Utils/AppLanguage/UITextView+FWSwizzle.swift +0 -97
  151. package/ios/Utils/AppLanguage/UIView+FWSwizzle.swift +0 -38
  152. package/ios/Utils/AppLanguage/UIViewController+FWSwizzle.swift +0 -32
  153. package/ios/Utils/AppLanguage/UIWindow+FWSwizzle.swift +0 -26
  154. package/ios/Utils/AppLanguage/URLSession+FWSwizzle.swift +0 -69
  155. package/ios/Utils/Extensions/UIView+FWUIHierarchy.swift +0 -47
  156. package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.h +0 -25
  157. package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.m +0 -75
  158. package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.h +0 -21
  159. package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.m +0 -124
  160. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.h +0 -11
  161. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.m +0 -86
  162. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.h +0 -16
  163. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.m +0 -55
  164. package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.h +0 -18
  165. package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.m +0 -39
  166. package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.h +0 -54
  167. package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.m +0 -141
  168. package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.h +0 -16
  169. package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.m +0 -20
  170. package/ios/Utils/FWRTL/Classes/Utils/FWRTLDefinitions.h +0 -52
  171. package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.h +0 -19
  172. package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.m +0 -49
  173. package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.h +0 -21
  174. package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.m +0 -38
  175. package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.h +0 -18
  176. package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.m +0 -43
  177. package/ios/Utils/FWSwizzleLoader.swift +0 -13
  178. package/ios/scripts/firework_sdk_pods.rb +0 -3
  179. package/lib/commonjs/models/NewNativeContainerProps.js +0 -2
  180. package/lib/module/models/NewNativeContainerProps.js +0 -2
  181. package/lib/typescript/models/NewNativeContainerProps.d.ts +0 -6
  182. package/src/models/NewNativeContainerProps.ts +0 -4
  183. /package/ios/Utils/{Extensions/String+Color.swift → String+Color.swift} +0 -0
  184. /package/ios/Utils/{Extensions/UIView+Constraints.swift → UIView+Constraints.swift} +0 -0
  185. /package/ios/Utils/{Extensions/UIViewController+AttachChild.swift → UIViewController+AttachChild.swift} +0 -0
  186. /package/lib/commonjs/models/{NewNativeContainerProps.js.map → AndroidFontInfo.js.map} +0 -0
  187. /package/lib/{module/models/NewNativeContainerProps.js.map → commonjs/models/SDKInitOptions.js.map} +0 -0
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # Firework React Native SDK
2
2
 
3
- Please refer to the integration guide here: https://docs.firework.tv/react-native-sdk/integration-guide
3
+ Please refer to the integration guide here: https://docs.firework.tv/react-native-sdk/integration-guide-v2
@@ -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"
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,222 +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
- videoFeedView?.layoutDirection = LAYOUT_DIRECTION_LOCALE
207
- addView(videoFeedViewContainer)
208
- }
209
- }
210
-
211
- private fun removeVideoFeedView() {
212
- if (videoFeedViewContainer == null) {
213
- return
214
- }
215
- removeView(videoFeedViewContainer)
216
- videoFeedViewContainer = null
217
- videoFeedView = null
218
- }
219
-
220
- private fun addPlaylistGroupFeedView() {
221
- removeVideoFeedView()
222
- if (playlistGroupFeedView != null) {
223
- return
224
- }
225
- playlistGroupFeedViewContainer =
226
- LayoutInflater.from(context).inflate(R.layout.fw_bridge_fragment_playlistfeed, this, false) as ConstraintLayout?
227
- playlistGroupFeedView = playlistGroupFeedViewContainer?.findViewById(R.id.fw_bridge_playlistfeed)
228
- if (playlistGroupFeedView != null) {
229
- addView(playlistGroupFeedViewContainer)
230
- }
231
- }
232
-
233
- private fun removePlaylistGroupFeedView() {
234
- if (playlistGroupFeedViewContainer == null) {
235
- return
236
- }
237
- removeView(playlistGroupFeedViewContainer)
238
- playlistGroupFeedViewContainer = null
239
- playlistGroupFeedView = null
240
- }
241
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
+ }
@@ -0,0 +1,10 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import android.os.Parcelable
4
+ import kotlinx.android.parcel.Parcelize
5
+
6
+ @Parcelize
7
+ data class FWFontInfoModel(
8
+ var isCustom: Boolean? = null,
9
+ var typefaceName: String? = null,
10
+ ) : Parcelable
@@ -0,0 +1,21 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import org.json.JSONObject
4
+
5
+ object FWFontInfoModelDeserializer {
6
+
7
+ private const val IS_CUSTOM_KEY = "isCustom"
8
+ private const val TYPEFACE_NAME_KEY = "typefaceName"
9
+
10
+ fun deserialize(responseJson: JSONObject?): FWFontInfoModel? {
11
+ responseJson ?: return null
12
+
13
+ val isCustom = responseJson.optBoolean(IS_CUSTOM_KEY, false)
14
+ val typefaceName = responseJson.optString(TYPEFACE_NAME_KEY)
15
+
16
+ return FWFontInfoModel(
17
+ isCustom = isCustom,
18
+ typefaceName = typefaceName,
19
+ )
20
+ }
21
+ }
@@ -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
+ }
@@ -0,0 +1,11 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import android.os.Parcelable
4
+ import kotlinx.android.parcel.Parcelize
5
+
6
+ @Parcelize
7
+ data class FWSDKInitOptionsModel(
8
+ val userId: String? = null,
9
+ val shareBaseURL: String? = null,
10
+ val videoLaunchBehavior: String? = null,
11
+ ) : Parcelable
@@ -0,0 +1,24 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import org.json.JSONObject
4
+
5
+ object FWSDKInitOptionsModelDeserializer {
6
+
7
+ private const val USER_ID_KEY = "userId"
8
+ private const val SHARE_BASE_URL_KEY = "shareBaseURL"
9
+ private const val VIDEO_LAUNCH_BEHAVIOR_KEY = "videoLaunchBehavior"
10
+
11
+ fun deserialize(responseJson: JSONObject?): FWSDKInitOptionsModel? {
12
+ responseJson?: return null
13
+
14
+ val userId = responseJson.optString(USER_ID_KEY)
15
+ val shareBaseURL = responseJson.optString(SHARE_BASE_URL_KEY)
16
+ val videoLaunchBehavior = responseJson.optString(VIDEO_LAUNCH_BEHAVIOR_KEY)
17
+
18
+ return FWSDKInitOptionsModel(
19
+ userId = userId,
20
+ shareBaseURL = shareBaseURL,
21
+ videoLaunchBehavior = videoLaunchBehavior,
22
+ )
23
+ }
24
+ }
@@ -0,0 +1,9 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ enum class FWSystemTypeface(val rawValue: String) {
4
+ Default("DEFAULT"),
5
+ DefaultBold("DEFAULT_BOLD"),
6
+ SansSerif("SANS_SERIF"),
7
+ Serif("SERIF"),
8
+ Monospace("MONOSPACE"),
9
+ }
@@ -5,27 +5,27 @@ 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,
23
+ val fontInfo: FWFontInfoModel? = null,
24
24
  ) : Parcelable
25
25
 
26
26
  @Parcelize
27
27
  data class FWPlayIconModel(
28
- var hidden: Boolean? = null,
29
- var iconWidth: Int? = null,
28
+ val hidden: Boolean? = null,
29
+ val iconWidth: Int? = null,
30
30
  ) : Parcelable
31
31
  }