react-native-firework-sdk 2.10.0 → 2.11.0

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 (159) hide show
  1. package/android/gradle.properties +1 -1
  2. package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +18 -1
  3. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +4 -0
  4. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModel.kt +0 -1
  5. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +0 -3
  6. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelSerializer.kt +0 -2
  7. package/android/src/main/java/com/fireworksdk/bridge/models/FWSdkInitResultModel.kt +6 -0
  8. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModel.kt +9 -0
  9. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelDeserializer.kt +45 -0
  10. package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelSerializer.kt +34 -0
  11. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -0
  12. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +1 -0
  13. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +2 -1
  14. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +4 -1
  15. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +2 -0
  16. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModel.kt +8 -0
  17. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelDeserializer.kt +23 -0
  18. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelSerializer.kt +18 -0
  19. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +2 -0
  20. package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoPlayerLogoOption.kt +19 -0
  21. package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +103 -0
  22. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +12 -0
  23. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +8 -0
  24. package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +2 -0
  25. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +2 -0
  26. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +22 -9
  27. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +78 -122
  28. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +34 -9
  29. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +13 -0
  30. package/android/src/main/java/com/fireworksdk/bridge/utils/FWFragmentUtil.kt +3 -3
  31. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +5 -2
  32. package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +64 -0
  33. package/ios/Components/ReplayBadgeConfiguration.swift +12 -0
  34. package/ios/Components/StoryBlock.swift +31 -0
  35. package/ios/Components/StoryBlockConfiguration.swift +1 -0
  36. package/ios/Components/StoryBlockManager.m +24 -0
  37. package/ios/Components/StoryBlockManager.swift +6 -3
  38. package/ios/Components/VideoFeed.swift +18 -3
  39. package/ios/Components/VideoFeedConfiguration.swift +1 -0
  40. package/ios/Components/VideoFeedManager.m +4 -1
  41. package/ios/Components/VideoFeedManager.swift +6 -3
  42. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  43. package/ios/FWReactNativeSDK.swift +14 -0
  44. package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
  45. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +17 -15
  46. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +1 -11
  47. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
  48. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +80 -81
  49. package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +9 -5
  50. package/ios/Modules/Shopping/ShoppingModule.swift +10 -74
  51. package/lib/commonjs/FireworkSDK.js +30 -25
  52. package/lib/commonjs/FireworkSDK.js.map +1 -1
  53. package/lib/commonjs/VideoShopping.js +6 -12
  54. package/lib/commonjs/VideoShopping.js.map +1 -1
  55. package/lib/commonjs/components/StoryBlock.js +54 -3
  56. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  57. package/lib/commonjs/components/VideoFeed.js +46 -4
  58. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  59. package/lib/commonjs/index.js.map +1 -1
  60. package/lib/commonjs/models/FWNativeErrorAction.js +14 -0
  61. package/lib/commonjs/models/FWNativeErrorAction.js.map +1 -0
  62. package/lib/commonjs/models/ReplayBadgeConfiguration.js +2 -0
  63. package/lib/commonjs/models/ReplayBadgeConfiguration.js.map +1 -0
  64. package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
  65. package/lib/module/FireworkSDK.js +29 -25
  66. package/lib/module/FireworkSDK.js.map +1 -1
  67. package/lib/module/VideoShopping.js +6 -12
  68. package/lib/module/VideoShopping.js.map +1 -1
  69. package/lib/module/components/StoryBlock.js +53 -3
  70. package/lib/module/components/StoryBlock.js.map +1 -1
  71. package/lib/module/components/VideoFeed.js +42 -4
  72. package/lib/module/components/VideoFeed.js.map +1 -1
  73. package/lib/module/index.js.map +1 -1
  74. package/lib/module/models/FWNativeErrorAction.js +7 -0
  75. package/lib/module/models/FWNativeErrorAction.js.map +1 -0
  76. package/lib/module/models/ReplayBadgeConfiguration.js +2 -0
  77. package/lib/module/models/ReplayBadgeConfiguration.js.map +1 -0
  78. package/lib/module/modules/FireworkSDKModule.js.map +1 -1
  79. package/lib/typescript/VideoShopping.d.ts +2 -2
  80. package/lib/typescript/components/StoryBlock.d.ts +18 -1
  81. package/lib/typescript/components/VideoFeed.d.ts +7 -1
  82. package/lib/typescript/index.d.ts +2 -2
  83. package/lib/typescript/models/FWEvents.d.ts +26 -3
  84. package/lib/typescript/models/FWNativeErrorAction.d.ts +4 -0
  85. package/lib/typescript/models/FeedItemDetails.d.ts +6 -1
  86. package/lib/typescript/models/ReplayBadgeConfiguration.d.ts +7 -0
  87. package/lib/typescript/models/StoryBlockConfiguration.d.ts +6 -1
  88. package/lib/typescript/models/VideoFeedConfiguration.d.ts +6 -0
  89. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +6 -1
  90. package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -0
  91. package/package.json +1 -5
  92. package/react-native-firework-sdk.podspec +3 -5
  93. package/src/FireworkSDK.ts +27 -24
  94. package/src/VideoShopping.ts +9 -11
  95. package/src/components/StoryBlock.tsx +69 -7
  96. package/src/components/VideoFeed.tsx +57 -12
  97. package/src/index.ts +2 -0
  98. package/src/models/FWEvents.ts +28 -3
  99. package/src/models/FWNativeErrorAction.ts +4 -0
  100. package/src/models/FeedItemDetails.ts +7 -1
  101. package/src/models/ReplayBadgeConfiguration.ts +7 -0
  102. package/src/models/StoryBlockConfiguration.ts +6 -1
  103. package/src/models/VideoFeedConfiguration.ts +6 -0
  104. package/src/models/VideoPlayerConfiguration.ts +6 -1
  105. package/src/modules/FireworkSDKModule.ts +1 -0
  106. package/FireworkVideoUI.xcframework/Info.plist +0 -40
  107. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  108. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -280
  109. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  110. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  111. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +0 -1313
  112. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -42
  113. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  114. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +0 -42
  115. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  116. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  117. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -556
  118. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
  119. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  120. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -1313
  121. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -42
  122. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  123. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -42
  124. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -1313
  125. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -42
  126. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  127. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -42
  128. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
  129. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +0 -245
  130. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +0 -13
  131. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +0 -18
  132. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +0 -154
  133. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +0 -73
  134. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +0 -25
  135. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +0 -52
  136. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -60
  137. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +0 -98
  138. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +0 -97
  139. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +0 -97
  140. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +0 -71
  141. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +0 -48
  142. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +0 -26
  143. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +0 -43
  144. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +0 -42
  145. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +0 -149
  146. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +0 -35
  147. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +0 -202
  148. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +0 -59
  149. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift +0 -32
  150. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +0 -18
  151. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +0 -46
  152. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +0 -37
  153. package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +0 -766
  154. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +0 -10
  155. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  156. package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +0 -37
  157. package/ios/FireworkVideoUI/Podfile +0 -15
  158. package/ios/FireworkVideoUI/Podfile.lock +0 -16
  159. package/ios/scripts/react_native_firework_sdk_pods.rb +0 -27
@@ -5,4 +5,4 @@ FireworkSDK_kotlinVersion=1.6.10
5
5
  FireworkSDK_minSdkVersion=21
6
6
  FireworkSDK_compileSdkVersion=33
7
7
  FireworkSDK_targetSdkVersion=33
8
- FireworkSDK_fwNativeVersion=6.8.1
8
+ FireworkSDK_fwNativeVersion=6.9.1
@@ -25,6 +25,7 @@ import com.fireworksdk.bridge.models.FWVideoFeedPropsModelDeserializer
25
25
  import com.fireworksdk.bridge.models.FWVideoFeedPropsModelSerializer
26
26
  import com.fireworksdk.bridge.utils.FWCommonUtil
27
27
  import com.fireworksdk.bridge.utils.FWConfigUtil
28
+ import com.fireworksdk.bridge.utils.FWGlobalDataUtil
28
29
  import com.fireworksdk.bridge.utils.FWLanguageUtil
29
30
  import org.json.JSONObject
30
31
  import java.lang.reflect.Method
@@ -97,6 +98,11 @@ class StoryBlockFragment : FWBaseFragment() {
97
98
  super.onViewCreated(view, savedInstanceState)
98
99
  setStoryBlockContainerCorner()
99
100
  initStoryBlock()
101
+ createViewCallback?.onCreateView()
102
+ }
103
+
104
+ fun getFeedId(): String? {
105
+ return fwStoryBlockView?.feedId
100
106
  }
101
107
 
102
108
 
@@ -112,7 +118,7 @@ class StoryBlockFragment : FWBaseFragment() {
112
118
  childFragmentManager,
113
119
  viewLifecycleOwner,
114
120
  viewOptionsBuilder.build(),
115
- true
121
+ FWGlobalDataUtil.pauseWhenNotVisible
116
122
  )
117
123
  isStoryBlockInitializer = true
118
124
 
@@ -396,4 +402,15 @@ class StoryBlockFragment : FWBaseFragment() {
396
402
  }, 1000)
397
403
  }
398
404
  }
405
+
406
+ private var createViewCallback: OnCreateViewCallback? = null
407
+
408
+ fun setCreateViewCallback(createViewCallback: OnCreateViewCallback?) {
409
+ this.createViewCallback = createViewCallback
410
+ }
411
+
412
+ interface OnCreateViewCallback {
413
+ fun onCreateView()
414
+ }
415
+
399
416
  }
@@ -51,6 +51,10 @@ class FWVideoFeed(
51
51
  videoFeedView.refresh()
52
52
  }
53
53
 
54
+ fun getFeedId(): String {
55
+ return videoFeedView.feedId
56
+ }
57
+
54
58
  fun setOnFeedViewStateListener(feedViewStateListener: FeedViewStateListener?) {
55
59
  this.feedViewStateListener = feedViewStateListener
56
60
  videoFeedView.setOnFeedViewStateListener { feedViewState ->
@@ -4,6 +4,5 @@ import com.fireworksdk.bridge.models.enums.FWPlayerLaunchBehavior
4
4
 
5
5
  data class FWSDKInitOptionsModel(
6
6
  val userId: String? = null,
7
- val shareBaseURL: String? = null,
8
7
  val videoLaunchBehavior: FWPlayerLaunchBehavior? = null,
9
8
  )
@@ -6,19 +6,16 @@ import org.json.JSONObject
6
6
  object FWSDKInitOptionsModelDeserializer {
7
7
 
8
8
  private const val USER_ID_KEY = "userId"
9
- private const val SHARE_BASE_URL_KEY = "shareBaseURL"
10
9
  private const val VIDEO_LAUNCH_BEHAVIOR_KEY = "videoLaunchBehavior"
11
10
 
12
11
  fun deserialize(responseJson: JSONObject?): FWSDKInitOptionsModel? {
13
12
  responseJson?: return null
14
13
 
15
14
  val userId = if (responseJson.has(USER_ID_KEY)) responseJson.optString(USER_ID_KEY) else null
16
- val shareBaseURL = if (responseJson.has(SHARE_BASE_URL_KEY)) responseJson.optString(SHARE_BASE_URL_KEY) else null
17
15
  val videoLaunchBehavior = if (responseJson.has(VIDEO_LAUNCH_BEHAVIOR_KEY)) responseJson.optString(VIDEO_LAUNCH_BEHAVIOR_KEY) else null
18
16
 
19
17
  return FWSDKInitOptionsModel(
20
18
  userId = userId,
21
- shareBaseURL = shareBaseURL,
22
19
  videoLaunchBehavior = if (!videoLaunchBehavior.isNullOrBlank()) FWPlayerLaunchBehavior.deserialize(videoLaunchBehavior) else null ,
23
20
  )
24
21
  }
@@ -6,14 +6,12 @@ import org.json.JSONObject
6
6
  object FWSDKInitOptionsModelSerializer {
7
7
 
8
8
  private const val USER_ID_KEY = "userId"
9
- private const val SHARE_BASE_URL_KEY = "shareBaseURL"
10
9
  private const val VIDEO_LAUNCH_BEHAVIOR_KEY = "videoLaunchBehavior"
11
10
 
12
11
  fun serialize(model: FWSDKInitOptionsModel?): JSONObject? {
13
12
  model ?: return null
14
13
  val jsonObject = JSONObject()
15
14
  jsonObject.put(USER_ID_KEY, model.userId)
16
- jsonObject.put(SHARE_BASE_URL_KEY, model.shareBaseURL)
17
15
  jsonObject.put(VIDEO_LAUNCH_BEHAVIOR_KEY, FWPlayerLaunchBehavior.serialize(model.videoLaunchBehavior))
18
16
  return jsonObject
19
17
  }
@@ -0,0 +1,6 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ data class FWSdkInitResultModel(
4
+ val success: Boolean? = null,
5
+ val reason: String? = null,
6
+ )
@@ -0,0 +1,9 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ data class FWTrackPurchaseModel(
4
+ val orderId: String? = null,
5
+ val value: Double? = null,
6
+ val currencyCode: String? = null,
7
+ val countryCode: String? = null,
8
+ val additionalInfo: Map<String, String>? = null,
9
+ )
@@ -0,0 +1,45 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import org.json.JSONObject
4
+
5
+ object FWTrackPurchaseModelDeserializer {
6
+
7
+ private const val ORDER_ID_KEY = "orderId"
8
+ private const val VALUE_KEY = "value"
9
+ private const val CURRENCY_CODE_KEY = "currencyCode"
10
+ private const val COUNTRY_KEY = "countryCode"
11
+ private const val ADDITIONAL_INFO_KEY = "additionalInfo"
12
+
13
+
14
+ fun deserialize(responseJson: JSONObject?): FWTrackPurchaseModel? {
15
+ responseJson ?: return null
16
+ val productId = if (responseJson.has(ORDER_ID_KEY)) responseJson.optString(ORDER_ID_KEY) else null
17
+ val value = if (responseJson.has(VALUE_KEY)) responseJson.optDouble(VALUE_KEY) else null
18
+ val currencyCode = if (responseJson.has(CURRENCY_CODE_KEY)) responseJson.optString(CURRENCY_CODE_KEY) else null
19
+ val countryCode = if (responseJson.has(COUNTRY_KEY)) responseJson.optString(COUNTRY_KEY) else null
20
+ val additionalInfoObject = if (responseJson.has(ADDITIONAL_INFO_KEY)) responseJson.optJSONObject(ADDITIONAL_INFO_KEY) else null
21
+
22
+ var additionalInfo: Map<String, String>? = null
23
+
24
+ val keys = additionalInfoObject?.keys()
25
+ if (keys != null) {
26
+ val additionalInfoMutableMap: MutableMap<String, String> = mutableMapOf()
27
+ for (key in keys) {
28
+ val v = if (additionalInfoObject.has(key)) additionalInfoObject.optString(key) else null
29
+ if (v != null) {
30
+ additionalInfoMutableMap[key] = v
31
+ }
32
+ }
33
+ additionalInfo = additionalInfoMutableMap.toMap()
34
+ }
35
+
36
+ return FWTrackPurchaseModel(
37
+ orderId = productId,
38
+ value = value,
39
+ currencyCode = currencyCode,
40
+ countryCode = countryCode,
41
+ additionalInfo = additionalInfo,
42
+ )
43
+ }
44
+
45
+ }
@@ -0,0 +1,34 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import org.json.JSONObject
4
+
5
+ object FWTrackPurchaseModelSerializer {
6
+
7
+ private const val ORDER_ID_KEY = "orderId"
8
+ private const val VALUE_KEY = "value"
9
+ private const val CURRENCY_CODE_KEY = "currencyCode"
10
+ private const val COUNTRY_KEY = "countryCode"
11
+ private const val ADDITIONAL_INFO_KEY = "additionalInfo"
12
+
13
+ fun serialize(model: FWTrackPurchaseModel?): JSONObject? {
14
+ model ?: return null
15
+ val jsonObject = JSONObject()
16
+ jsonObject.put(ORDER_ID_KEY, model.orderId)
17
+ jsonObject.put(VALUE_KEY, model.value)
18
+ jsonObject.put(CURRENCY_CODE_KEY, model.currencyCode)
19
+ jsonObject.put(COUNTRY_KEY, model.countryCode)
20
+
21
+ if (model.additionalInfo != null) {
22
+ val additionalInfoJsonObject = JSONObject()
23
+ val keys = model.additionalInfo.keys
24
+ for (key in keys) {
25
+ val value = model.additionalInfo[key]
26
+ additionalInfoJsonObject.put(key, value);
27
+ }
28
+ jsonObject.put(ADDITIONAL_INFO_KEY, additionalInfoJsonObject)
29
+ }
30
+
31
+ return jsonObject
32
+ }
33
+
34
+ }
@@ -1,6 +1,7 @@
1
1
  package com.fireworksdk.bridge.models
2
2
 
3
3
  data class FWVideoFeedItemDetailsModel(
4
+ val feedId: String?,
4
5
  val index: Int?,
5
6
  val id: String?,
6
7
  val duration: Int?,
@@ -16,4 +16,5 @@ data class FWVideoPlaybackDetails(
16
16
  val progress: Double? = null,
17
17
  val actionUrl: String? = null,
18
18
  val label: String? = null,
19
+ val feedId: String? = null,
19
20
  )
@@ -19,7 +19,8 @@ data class FWVideoPlayerConfigModel(
19
19
  val ctaWidth: FWVideoPlayerCTAWidth? = null,
20
20
  val enablePictureInPicture: Boolean? = null,
21
21
  val showVideoDetailTitle: Boolean? = null,
22
- val buttonConfiguration: FWPlayerButtonConfigurationModel?
22
+ val buttonConfiguration: FWPlayerButtonConfigurationModel? = null,
23
+ val videoPlayerLogoConfiguration: FWVideoPlayerLogoConfigurationModel? = null,
23
24
  ) {
24
25
 
25
26
  data class FWCtaButtonStyleModel(
@@ -22,6 +22,7 @@ object FWVideoPlayerConfigModelDeserializer {
22
22
  private const val ENABLE_PIP_KEY = "enablePictureInPicture"
23
23
  private const val SHOW_VIDEO_DETAIL_TITLE_KEY = "showVideoDetailTitle"
24
24
  private const val BUTTON_CONFIGURATION_KEY = "buttonConfiguration"
25
+ private const val VIDEO_PLAYER_LOGO_CONFIGURATION_KEY = "videoPlayerLogoConfiguration"
25
26
 
26
27
  private const val BACKGROUND_COLOR_KEY = "backgroundColor"
27
28
  private const val FONT_SIZE_KEY = "fontSize"
@@ -47,6 +48,7 @@ object FWVideoPlayerConfigModelDeserializer {
47
48
  val enablePictureInPicture = if (responseJson.has(ENABLE_PIP_KEY)) responseJson.optBoolean(ENABLE_PIP_KEY) else null
48
49
  val showVideoDetailTitle = if (responseJson.has(SHOW_VIDEO_DETAIL_TITLE_KEY)) responseJson.optBoolean(SHOW_VIDEO_DETAIL_TITLE_KEY) else null
49
50
  val buttonConfigurationJsonObject = responseJson.optJSONObject(BUTTON_CONFIGURATION_KEY)
51
+ val videoPlayerLogoConfigurationJsonObject = responseJson.optJSONObject(VIDEO_PLAYER_LOGO_CONFIGURATION_KEY)
50
52
 
51
53
  return FWVideoPlayerConfigModel(
52
54
  playerStyle = if (!playerStyle.isNullOrBlank()) FWPlayerStyle.deserialize(playerStyle) else null,
@@ -62,7 +64,8 @@ object FWVideoPlayerConfigModelDeserializer {
62
64
  ctaWidth = if (!ctaWidth.isNullOrBlank()) FWVideoPlayerCTAWidth.deserialize(ctaWidth) else null,
63
65
  enablePictureInPicture = enablePictureInPicture,
64
66
  showVideoDetailTitle = showVideoDetailTitle,
65
- buttonConfiguration = FWPlayerButtonConfigurationDeserializer.deserialize(buttonConfigurationJsonObject)
67
+ buttonConfiguration = FWPlayerButtonConfigurationDeserializer.deserialize(buttonConfigurationJsonObject),
68
+ videoPlayerLogoConfiguration = FWVideoPlayerLogoConfigurationModelDeserializer.deserialize(videoPlayerLogoConfigurationJsonObject),
66
69
  )
67
70
  }
68
71
 
@@ -22,6 +22,7 @@ object FWVideoPlayerConfigModelSerializer {
22
22
  private const val ENABLE_PIP_KEY = "enablePictureInPicture"
23
23
  private const val SHOW_VIDEO_DETAIL_TITLE_KEY = "showVideoDetailTitle"
24
24
  private const val BUTTON_CONFIGURATION_KEY = "buttonConfiguration"
25
+ private const val VIDEO_PLAYER_LOGO_CONFIGURATION_KEY = "videoPlayerLogoConfiguration"
25
26
 
26
27
  private const val BACKGROUND_COLOR_KEY = "backgroundColor"
27
28
  private const val FONT_SIZE_KEY = "fontSize"
@@ -47,6 +48,7 @@ object FWVideoPlayerConfigModelSerializer {
47
48
  jsonObject.put(ENABLE_PIP_KEY, model.enablePictureInPicture)
48
49
  jsonObject.put(SHOW_VIDEO_DETAIL_TITLE_KEY, model.showVideoDetailTitle)
49
50
  jsonObject.put(BUTTON_CONFIGURATION_KEY, FWPlayerButtonConfigurationSerializer.serialize(model.buttonConfiguration))
51
+ jsonObject.put(VIDEO_PLAYER_LOGO_CONFIGURATION_KEY, FWVideoPlayerLogoConfigurationModelSerializer.serialize(model.videoPlayerLogoConfiguration))
50
52
  return jsonObject
51
53
  }
52
54
 
@@ -0,0 +1,8 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import com.fireworksdk.bridge.models.enums.FWVideoPlayerLogoOption
4
+
5
+ data class FWVideoPlayerLogoConfigurationModel(
6
+ val option: FWVideoPlayerLogoOption?,
7
+ val encodedId: String?,
8
+ )
@@ -0,0 +1,23 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import com.fireworksdk.bridge.models.enums.FWVideoPlayerLogoOption
4
+ import org.json.JSONObject
5
+
6
+ object FWVideoPlayerLogoConfigurationModelDeserializer {
7
+
8
+ private const val OPTION_KEY = "option"
9
+ private const val ENCODED_ID_KEY = "encodedId"
10
+
11
+ fun deserialize(responseJson: JSONObject?): FWVideoPlayerLogoConfigurationModel? {
12
+ responseJson ?: return null
13
+
14
+ val option = if (responseJson.has(OPTION_KEY)) responseJson.optString(OPTION_KEY) else null
15
+ val encodedId = if (responseJson.has(ENCODED_ID_KEY)) responseJson.optString(ENCODED_ID_KEY) else null
16
+
17
+ return FWVideoPlayerLogoConfigurationModel(
18
+ option = if (!option.isNullOrBlank()) FWVideoPlayerLogoOption.deserialize(option) else null,
19
+ encodedId = encodedId,
20
+ )
21
+ }
22
+
23
+ }
@@ -0,0 +1,18 @@
1
+ package com.fireworksdk.bridge.models
2
+
3
+ import com.fireworksdk.bridge.models.enums.FWVideoPlayerLogoOption
4
+ import org.json.JSONObject
5
+
6
+ object FWVideoPlayerLogoConfigurationModelSerializer {
7
+
8
+ private const val OPTION_KEY = "option"
9
+ private const val ENCODED_ID_KEY = "encodedId"
10
+
11
+ fun serialize(model: FWVideoPlayerLogoConfigurationModel?): JSONObject? {
12
+ model ?: return null
13
+ val jsonObject = JSONObject()
14
+ jsonObject.put(OPTION_KEY, FWVideoPlayerLogoOption.serialize(model.option))
15
+ jsonObject.put(ENCODED_ID_KEY, model.encodedId)
16
+ return jsonObject
17
+ }
18
+ }
@@ -17,6 +17,7 @@ enum class FWSDKInitSubEventName(val rawValue: String) {
17
17
  enum class FWFeedViewEventName(val rawValue: String) {
18
18
  VideoFeedLoadFinished("onVideoFeedLoadFinished"),
19
19
  VideoFeedEmpty("onVideoFeedEmpty"),
20
+ VideoFeedGetFeedId("onVideoFeedGetFeedId"),
20
21
  }
21
22
 
22
23
  enum class FWVideoPlaybackSubEventName(val rawValue: String) {
@@ -54,4 +55,5 @@ enum class FWStoryBlockEventName(val rawValue: String) {
54
55
  StoryBlockLoadFinished("onStoryBlockLoadFinished"),
55
56
  StoryBlockEmpty("onStoryBlockEmpty"),
56
57
  StoryBlockFullScreenStateChanged("onStoryBlockFullScreenStateChanged"),
58
+ StoryBlockGetFeedId("onStoryBlockGetFeedId"),
57
59
  }
@@ -0,0 +1,19 @@
1
+ package com.fireworksdk.bridge.models.enums
2
+
3
+ enum class FWVideoPlayerLogoOption(val rawValue: String) {
4
+ Disabled("disabled"),
5
+ Creator("creator"),
6
+ ChannelAggregator("channelAggregator");
7
+
8
+ companion object {
9
+ fun deserialize(rawValue: String?): FWVideoPlayerLogoOption? {
10
+ rawValue ?: return null
11
+ return FWVideoPlayerLogoOption.values().first { it.rawValue == rawValue }
12
+ }
13
+
14
+ fun serialize(model: FWVideoPlayerLogoOption?): String? {
15
+ model ?: return null
16
+ return model.rawValue
17
+ }
18
+ }
19
+ }
@@ -1,15 +1,49 @@
1
1
  package com.fireworksdk.bridge.reactnative
2
2
 
3
+ import android.annotation.SuppressLint
3
4
  import android.app.Activity
4
5
  import android.content.Context
6
+ import android.content.pm.PackageManager
7
+ import android.provider.Settings
8
+ import android.util.Base64
5
9
  import com.firework.imageloading.ImageLoader
6
10
  import com.firework.livestream.LivestreamPlayerInitializer
11
+ import com.firework.sdk.FireworkSdk
12
+ import com.firework.sdk.FireworkSdkConfig
13
+ import com.fireworksdk.bridge.models.FWSDKInitOptionsModel
14
+ import com.fireworksdk.bridge.models.FWSdkInitResultModel
15
+ import com.fireworksdk.bridge.models.enums.FWPlayerLaunchBehavior
16
+ import com.fireworksdk.bridge.utils.FWGlobalDataUtil
7
17
  import com.fireworksdk.bridge.utils.FWImageLoaderUtil
8
18
  import com.fireworksdk.bridge.utils.FWLanguageUtil
9
19
  import com.fireworksdk.bridge.utils.FWLiveStreamUtil
20
+ import com.fireworksdk.bridge.utils.FWLogUtils
21
+ import java.nio.charset.StandardCharsets
22
+ import java.security.MessageDigest
10
23
 
11
24
  object FWReactNativeSDK {
12
25
 
26
+ fun closePip() {
27
+ FireworkSdk.closePip()
28
+ }
29
+
30
+ fun init(
31
+ context: Context,
32
+ sdkInitOptions: FWSDKInitOptionsModel? = null,
33
+ ) {
34
+ initSdkInternal(context, sdkInitOptions, onError = {
35
+ FWGlobalDataUtil.sdkInitResultModel = FWSdkInitResultModel(
36
+ success = false,
37
+ reason = it
38
+ )
39
+ }, onSuccess = {
40
+ FWGlobalDataUtil.sdkInitResultModel = FWSdkInitResultModel(
41
+ success = true,
42
+ reason = null
43
+ )
44
+ })
45
+ }
46
+
13
47
  fun addLivestreamPlayerInitializer(initializer: LivestreamPlayerInitializer?) {
14
48
  FWLiveStreamUtil.addLivestreamPlayerInitializer(initializer)
15
49
  }
@@ -25,4 +59,73 @@ object FWReactNativeSDK {
25
59
  fun changeLanguage(localeString: String, activity: Activity) {
26
60
  FWLanguageUtil.getInstance(activity).changeLanguage(localeString, activity)
27
61
  }
62
+
63
+ fun initSdkInternal(
64
+ context: Context,
65
+ sdkInitOptions: FWSDKInitOptionsModel?,
66
+ onSuccess: (() -> Unit)? = null,
67
+ onError: ((String) -> Unit)? = null
68
+ ) {
69
+ val clientId = getAppid(context)
70
+ if (clientId.isNullOrBlank()) {
71
+ val errorMsg = "The appid is invalid"
72
+ FWLogUtils.d { errorMsg }
73
+ onError?.invoke(errorMsg)
74
+ return
75
+ }
76
+
77
+
78
+ val configBuilder = FireworkSdkConfig.Builder(context)
79
+ .checksumRequired(false)
80
+ .clientId(clientId)
81
+ .enableCache(true)
82
+
83
+ val userId = sdkInitOptions?.userId
84
+ if (!userId.isNullOrBlank()) {
85
+ configBuilder.userId(userId)
86
+ }
87
+
88
+ val livestreamPlayerInitializerList = FWLiveStreamUtil.livestreamPlayerInitializers()
89
+ for (livestreamPlayerInitializer in livestreamPlayerInitializerList) {
90
+ configBuilder.addLivestreamPlayerInitializer(livestreamPlayerInitializer)
91
+ }
92
+
93
+ when (sdkInitOptions?.videoLaunchBehavior) {
94
+ FWPlayerLaunchBehavior.Default -> {}
95
+ FWPlayerLaunchBehavior.MuteOnFirstLaunch -> {
96
+ configBuilder.muteOnLaunch(true)
97
+ }
98
+ else -> {}
99
+ }
100
+
101
+ val imageLoader = FWImageLoaderUtil.getImageLoader()
102
+ if (imageLoader != null) {
103
+ configBuilder.imageLoader(imageLoader)
104
+ }
105
+
106
+ val config = configBuilder.build()
107
+
108
+ FireworkSdk.init(
109
+ config,
110
+ onSuccess = {
111
+ onSuccess?.invoke()
112
+ },
113
+ onError = { error ->
114
+ onError?.invoke("$error")
115
+ },
116
+ )
117
+ }
118
+
119
+ private fun getAppid(context: Context): String? {
120
+ val ai = context.packageManager.getApplicationInfo(
121
+ context.packageName,
122
+ PackageManager.GET_META_DATA
123
+ )
124
+ val value = ai.metaData.get("Firework:Appid")
125
+ return value?.let {
126
+ it as String
127
+ } ?: run {
128
+ null
129
+ }
130
+ }
28
131
  }
@@ -189,6 +189,17 @@ class FWStoryBlockManager : ViewGroupManager<StoryBlockFrameLayout>() {
189
189
  }
190
190
 
191
191
  private fun addStoryBlockListener(fragment: StoryBlockFragment, reactNativeViewId: Int) {
192
+ fragment.setCreateViewCallback(object : StoryBlockFragment.OnCreateViewCallback {
193
+ override fun onCreateView() {
194
+
195
+ FWEventUtils.receiveStoryBlockGetFeedIdEvent(
196
+ reactContext,
197
+ reactNativeViewId,
198
+ fragment.getFeedId()
199
+ )
200
+ }
201
+
202
+ })
192
203
  fragment.setFeedLoadListener { feedLoadState ->
193
204
  when (feedLoadState) {
194
205
  FeedLoadState.Loading -> {
@@ -283,6 +294,7 @@ class FWStoryBlockManager : ViewGroupManager<StoryBlockFrameLayout>() {
283
294
  .put(FWStoryBlockEventName.StoryBlockLoadFinished.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWStoryBlockEventName.StoryBlockLoadFinished.rawValue)))
284
295
  .put(FWStoryBlockEventName.StoryBlockFullScreenStateChanged.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWStoryBlockEventName.StoryBlockFullScreenStateChanged.rawValue)))
285
296
  .put(FWStoryBlockEventName.StoryBlockEmpty.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWStoryBlockEventName.StoryBlockEmpty.rawValue)))
297
+ .put(FWStoryBlockEventName.StoryBlockGetFeedId.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWStoryBlockEventName.StoryBlockGetFeedId.rawValue)))
286
298
  .build()
287
299
  }
288
300
 
@@ -49,6 +49,12 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
49
49
  override fun onAfterUpdateTransaction(view: FWVideoFeed) {
50
50
  super.onAfterUpdateTransaction(view)
51
51
  view.initVideoFeedView()
52
+
53
+ FWEventUtils.receiveVideoFeedGetFeedIdEvent(
54
+ reactContext,
55
+ videoFeed.id,
56
+ view.getFeedId()
57
+ )
52
58
  }
53
59
 
54
60
  @ReactProp(name = "source")
@@ -163,6 +169,7 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
163
169
  val title = feedItem.title
164
170
 
165
171
  val fwVideoFeedItemDetailsModel = FWVideoFeedItemDetailsModel(
172
+ videoFeedView.feedId,
166
173
  index,
167
174
  id,
168
175
  duration.toInt(),
@@ -252,6 +259,7 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
252
259
  return MapBuilder.builder<String, Any>()
253
260
  .put(FWFeedViewEventName.VideoFeedLoadFinished.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWFeedViewEventName.VideoFeedLoadFinished.rawValue)))
254
261
  .put(FWFeedViewEventName.VideoFeedEmpty.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWFeedViewEventName.VideoFeedEmpty.rawValue)))
262
+ .put(FWFeedViewEventName.VideoFeedGetFeedId.rawValue, MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", FWFeedViewEventName.VideoFeedGetFeedId.rawValue)))
255
263
  .build()
256
264
  }
257
265
 
@@ -6,6 +6,7 @@ import com.facebook.react.bridge.ReadableMap
6
6
  interface FireworkSDKInterface {
7
7
 
8
8
  fun init(config: ReadableMap?, promise: Promise)
9
+ fun markInitCalled(promise: Promise)
9
10
  fun openVideoPlayer(url: String, config: ReadableMap?)
10
11
  fun setShareBaseURL(url: String?, promise: Promise)
11
12
  fun setAdBadgeConfiguration(config: ReadableMap?, promise: Promise)
@@ -13,4 +14,5 @@ interface FireworkSDKInterface {
13
14
  fun setVideoPlaybackEventEnabled(value: Boolean?)
14
15
  fun changeAppLanguage(language: String?, promise: Promise)
15
16
  fun restart(promise: Promise)
17
+ fun trackPurchase(config: ReadableMap?, promise: Promise)
16
18
  }
@@ -1,5 +1,6 @@
1
1
  package com.fireworksdk.bridge.reactnative.module
2
2
 
3
+ import androidx.annotation.Keep
3
4
  import com.facebook.react.bridge.ReactApplicationContext
4
5
  import com.facebook.react.bridge.ReactContextBaseJavaModule
5
6
  import com.facebook.react.bridge.ReactMethod
@@ -23,6 +24,7 @@ class FWLiveStreamModule(
23
24
  FireworkSdk.analytics.register(this)
24
25
  }
25
26
 
27
+ @Keep
26
28
  @FwAnalyticCallable
27
29
  fun onLivestreamEvent(event: LivestreamAnalyticEvent) {
28
30
  when (event) {