react-native-firework-sdk 1.2.0 → 1.2.3
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.
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +6 -1
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +18 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FWNavigatorInterface.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt +19 -2
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWDataUtils.kt +6 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +1 -6
- package/ios/Models/NativeToRN/FireworkSDK+Json.swift +24 -9
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.m +1 -0
- package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +40 -3
- package/ios/Modules/FWNavigatorModule/FWNavigatorProtocol.swift +2 -1
- package/lib/commonjs/FWNavigator.js +10 -1
- package/lib/commonjs/FWNavigator.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/modules/FWNavigatorModule.js.map +1 -1
- package/lib/module/FWNavigator.js +10 -1
- package/lib/module/FWNavigator.js.map +1 -1
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/modules/FWNavigatorModule.js.map +1 -1
- package/lib/typescript/FWNavigator.d.ts +6 -1
- package/lib/typescript/components/VideoFeed.d.ts +5 -5
- package/lib/typescript/models/FeedItemDetails.d.ts +25 -3
- package/lib/typescript/modules/FWNavigatorModule.d.ts +1 -0
- package/package.json +1 -1
- package/src/FWNavigator.tsx +9 -1
- package/src/components/VideoFeed.tsx +5 -8
- package/src/models/FeedItemDetails.ts +23 -3
- package/src/modules/FWNavigatorModule.ts +1 -0
|
@@ -7,6 +7,11 @@ import kotlinx.android.parcel.Parcelize
|
|
|
7
7
|
data class FWVideoFeedItemDetailsModel(
|
|
8
8
|
val index: Int?,
|
|
9
9
|
val id: String?,
|
|
10
|
-
val
|
|
10
|
+
val duration: Int?,
|
|
11
11
|
val source: String?,
|
|
12
|
+
val title: String?,
|
|
13
|
+
val playlistGroup: String?,
|
|
14
|
+
val playlist: String?,
|
|
15
|
+
val channel: String?,
|
|
16
|
+
val dynamicContentParameters: HashMap<String, List<String>>?,
|
|
12
17
|
) : Parcelable
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt
CHANGED
|
@@ -43,7 +43,15 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
|
|
|
43
43
|
videoFeedView?.addOnItemClickedListener(object: OnItemClickedListener {
|
|
44
44
|
override fun onItemClicked(index: Int, title: String, id: String, videoDuration: Long) {
|
|
45
45
|
val fwVideoFeedItemDetailsModel = FWVideoFeedItemDetailsModel(
|
|
46
|
-
index,
|
|
46
|
+
index,
|
|
47
|
+
id,
|
|
48
|
+
videoDuration.toInt(),
|
|
49
|
+
videoFeed.videoFeedPropsModel.source,
|
|
50
|
+
title,
|
|
51
|
+
videoFeed.videoFeedPropsModel.playlistGroup,
|
|
52
|
+
videoFeed.videoFeedPropsModel.playlist,
|
|
53
|
+
videoFeed.videoFeedPropsModel.channel,
|
|
54
|
+
videoFeed.videoFeedPropsModel.dynamicContentParameters
|
|
47
55
|
)
|
|
48
56
|
FWEventUtils.sendVideoFeedClickEvent(reactContext, fwVideoFeedItemDetailsModel)
|
|
49
57
|
}
|
|
@@ -80,7 +88,15 @@ class FWVideoFeedManager : SimpleViewManager<FWVideoFeed>() {
|
|
|
80
88
|
playlistGroupFeedView?.itemClickHandler = object : OnPlaylistGroupItemClickedListener {
|
|
81
89
|
override fun onItemClicked(index: Int, id: String?): Boolean {
|
|
82
90
|
val fwVideoFeedItemDetailsModel = FWVideoFeedItemDetailsModel(
|
|
83
|
-
index,
|
|
91
|
+
index,
|
|
92
|
+
id,
|
|
93
|
+
0,
|
|
94
|
+
videoFeed?.videoFeedPropsModel?.source,
|
|
95
|
+
"",
|
|
96
|
+
videoFeed?.videoFeedPropsModel?.playlistGroup,
|
|
97
|
+
videoFeed?.videoFeedPropsModel?.playlist,
|
|
98
|
+
videoFeed?.videoFeedPropsModel?.channel,
|
|
99
|
+
videoFeed?.videoFeedPropsModel?.dynamicContentParameters
|
|
84
100
|
)
|
|
85
101
|
FWEventUtils.sendVideoFeedClickEvent(reactContext, fwVideoFeedItemDetailsModel)
|
|
86
102
|
return false
|
package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWNavigatorModule.kt
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
package com.fireworksdk.bridge.reactnative.module
|
|
2
2
|
|
|
3
|
+
import android.app.Activity
|
|
3
4
|
import com.facebook.react.bridge.*
|
|
4
5
|
import com.fireworksdk.bridge.reactnative.FWInitializationProvider
|
|
5
6
|
import com.fireworksdk.bridge.reactnative.models.FWNavigatorInterface
|
|
6
|
-
import com.fireworksdk.bridge.reactnative.pages.FWContainerActivity
|
|
7
7
|
import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
|
|
8
8
|
import com.fireworksdk.bridge.utils.FWLogUtils
|
|
9
9
|
|
|
@@ -27,7 +27,7 @@ class FWNavigatorModule(
|
|
|
27
27
|
return
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
if (activity
|
|
30
|
+
if (isTaskRoot(activity)) {
|
|
31
31
|
promise.resolve(false)
|
|
32
32
|
return
|
|
33
33
|
}
|
|
@@ -38,6 +38,16 @@ class FWNavigatorModule(
|
|
|
38
38
|
promise.resolve(true)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
@ReactMethod
|
|
42
|
+
override fun canPopNativeContainer(promise: Promise) {
|
|
43
|
+
val activity = FWInitializationProvider.INSTANCE.resumedActivity
|
|
44
|
+
if (activity == null) {
|
|
45
|
+
promise.resolve(false)
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
promise.resolve(!isTaskRoot(activity))
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
@ReactMethod
|
|
42
52
|
fun addListener(eventName: String?, promise: Promise) {
|
|
43
53
|
// Set up any upstream listeners or background tasks as necessary
|
|
@@ -52,6 +62,13 @@ class FWNavigatorModule(
|
|
|
52
62
|
promise.resolve(Arguments.createMap())
|
|
53
63
|
}
|
|
54
64
|
|
|
65
|
+
private fun isTaskRoot(activity: Activity):Boolean {
|
|
66
|
+
if (activity.isTaskRoot) {
|
|
67
|
+
return true
|
|
68
|
+
}
|
|
69
|
+
return false
|
|
70
|
+
}
|
|
71
|
+
|
|
55
72
|
override fun getName(): String {
|
|
56
73
|
return "FWNavigatorModule"
|
|
57
74
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
package com.fireworksdk.bridge.reactnative.utils
|
|
2
2
|
import com.facebook.react.bridge.*
|
|
3
|
+
import com.fireworksdk.bridge.utils.FWJsonUtils
|
|
3
4
|
import org.json.JSONArray
|
|
4
5
|
import org.json.JSONException
|
|
5
6
|
import org.json.JSONObject
|
|
6
7
|
|
|
8
|
+
inline fun <reified T : Any> T.asMap(): WritableMap {
|
|
9
|
+
val jsonString = FWJsonUtils.toJson(this)
|
|
10
|
+
val jsonObject = JSONObject(jsonString)
|
|
11
|
+
return FWDataUtils.convertJsonObjectToWritableMap(jsonObject)?: Arguments.createMap()
|
|
12
|
+
}
|
|
7
13
|
|
|
8
14
|
object FWDataUtils {
|
|
9
15
|
|
|
@@ -61,12 +61,7 @@ object FWEventUtils {
|
|
|
61
61
|
|
|
62
62
|
fun sendVideoFeedClickEvent(reactContext: ReactContext, info: FWVideoFeedItemDetailsModel) {
|
|
63
63
|
val eventMap = Arguments.createMap()
|
|
64
|
-
|
|
65
|
-
contentMap.putInt("index", info.index?:0)
|
|
66
|
-
contentMap.putString("id", info.id)
|
|
67
|
-
contentMap.putInt("duration", info.videoDuration?:0)
|
|
68
|
-
contentMap.putString("source", info.source)
|
|
69
|
-
eventMap.putMap("info", contentMap)
|
|
64
|
+
eventMap.putMap("info", info.asMap())
|
|
70
65
|
sendEvent(reactContext, FWEventName.VideoFeedClick.rawValue, eventMap)
|
|
71
66
|
}
|
|
72
67
|
|
|
@@ -55,25 +55,40 @@ extension VideoFeedError {
|
|
|
55
55
|
|
|
56
56
|
extension FeedEventDetails {
|
|
57
57
|
var jsObject: [String: Any] {
|
|
58
|
+
var result: [String: Any] = [
|
|
59
|
+
"index": index,
|
|
60
|
+
"id": id,
|
|
61
|
+
"duration": duration,
|
|
62
|
+
]
|
|
63
|
+
if let title = caption {
|
|
64
|
+
result["title"] = title
|
|
65
|
+
}
|
|
66
|
+
|
|
58
67
|
var sourceStr: String = ""
|
|
59
68
|
switch(source) {
|
|
60
69
|
case .discover:
|
|
61
70
|
sourceStr = "discover"
|
|
62
|
-
case .channel(channelID:
|
|
71
|
+
case .channel(channelID: let channelID):
|
|
63
72
|
sourceStr = "channel"
|
|
64
|
-
|
|
73
|
+
result["channel"] = channelID
|
|
74
|
+
case .channelPlaylist(channelID: let channelID, playlistID: let playlistID):
|
|
65
75
|
sourceStr = "playlist"
|
|
66
|
-
|
|
76
|
+
result["channel"] = channelID
|
|
77
|
+
result["playlist"] = playlistID
|
|
78
|
+
case .playlistGroup(groupID: let playlistGroupID):
|
|
67
79
|
sourceStr = "playlistGroup"
|
|
80
|
+
result["playlistGroup"] = playlistGroupID
|
|
81
|
+
case .dynamicContent(channelID: let channelID, parameters: let parameters):
|
|
82
|
+
sourceStr = "dynamicContent"
|
|
83
|
+
result["channel"] = channelID
|
|
84
|
+
result["dynamicContentParameters"] = parameters
|
|
68
85
|
default:
|
|
69
86
|
break
|
|
70
87
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"source": sourceStr
|
|
76
|
-
]
|
|
88
|
+
|
|
89
|
+
result["source"] = sourceStr;
|
|
90
|
+
|
|
91
|
+
return result
|
|
77
92
|
}
|
|
78
93
|
}
|
|
79
94
|
|
|
@@ -13,5 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
RCT_EXTERN_METHOD(pushNativeContainer:(NSDictionary *)props resolver:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
15
15
|
RCT_EXTERN_METHOD(popNativeContainer:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
16
|
+
RCT_EXTERN_METHOD(canPopNativeContainer:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
|
|
16
17
|
|
|
17
18
|
@end
|
|
@@ -54,6 +54,11 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
54
54
|
containerViewController.moduleName = appComponentName
|
|
55
55
|
containerViewController.properties = props
|
|
56
56
|
containerViewController.modalPresentationStyle = .fullScreen
|
|
57
|
+
if presentedVC.modalPresentationStyle == .custom,
|
|
58
|
+
let presentingVC = presentedVC.presentingViewController,
|
|
59
|
+
presentingVC is FireworkVideo.PlayerViewController {
|
|
60
|
+
containerViewController.modalPresentationStyle = .overFullScreen
|
|
61
|
+
}
|
|
57
62
|
|
|
58
63
|
#if DEBUG
|
|
59
64
|
self.sendEvent(withName: FWEventName.LogMessage.rawValue, body: ["message": "[iOS] Present containerViewController \(formatter.string(from: Date()))"])
|
|
@@ -70,16 +75,48 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
|
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
@objc(popNativeContainer:rejecter:)
|
|
73
|
-
func popNativeContainer(resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
|
|
78
|
+
func popNativeContainer(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
|
|
74
79
|
DispatchQueue.main.async {
|
|
75
|
-
if let
|
|
76
|
-
|
|
80
|
+
if let navigatorContainerVC = RCTPresentedViewController() as? FWNavigatorContainerViewController,
|
|
81
|
+
navigatorContainerVC.presentingViewController != nil {
|
|
82
|
+
navigatorContainerVC.dismiss(animated: true) {
|
|
77
83
|
resolver(true)
|
|
78
84
|
}
|
|
79
85
|
} else if let cartViewController = gCartViewController {
|
|
80
86
|
cartViewController.navigationController?.popViewController(animated: true)
|
|
81
87
|
gCartViewController = nil
|
|
82
88
|
resolver(true)
|
|
89
|
+
} else if let presentedVC = RCTPresentedViewController(),
|
|
90
|
+
let presentingVC = presentedVC.presentingViewController {
|
|
91
|
+
if presentedVC.modalPresentationStyle == .custom,
|
|
92
|
+
presentingVC is FireworkVideo.PlayerViewController {
|
|
93
|
+
// For consistency with Android SDK behavior
|
|
94
|
+
presentedVC.dismiss(animated: false) {
|
|
95
|
+
DispatchQueue.main.async {
|
|
96
|
+
presentingVC.dismiss(animated: true) {
|
|
97
|
+
resolver(true)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
presentedVC.dismiss(animated: true) {
|
|
103
|
+
resolver(true)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
resolver(false)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@objc(canPopNativeContainer:rejecter:)
|
|
113
|
+
func canPopNativeContainer(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
|
|
114
|
+
DispatchQueue.main.async {
|
|
115
|
+
if let presentedVC = RCTPresentedViewController(),
|
|
116
|
+
presentedVC.presentingViewController != nil {
|
|
117
|
+
resolver(true)
|
|
118
|
+
} else if let _ = gCartViewController {
|
|
119
|
+
resolver(true)
|
|
83
120
|
} else {
|
|
84
121
|
resolver(false)
|
|
85
122
|
}
|
|
@@ -9,5 +9,6 @@ import Foundation
|
|
|
9
9
|
|
|
10
10
|
protocol FWNavigator {
|
|
11
11
|
func pushNativeContainer(_ props: NSDictionary?, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
|
|
12
|
-
func popNativeContainer(resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
|
|
12
|
+
func popNativeContainer(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
|
|
13
|
+
func canPopNativeContainer(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
|
|
13
14
|
}
|
|
@@ -48,7 +48,7 @@ class FWNavigator {
|
|
|
48
48
|
return _FWNavigatorModule.default.pushNativeContainer(props);
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* Pop top-most native container.
|
|
51
|
+
* Pop top-most native container.
|
|
52
52
|
* @returns {Promise<boolean>} The result of poping top-most native container.
|
|
53
53
|
*/
|
|
54
54
|
|
|
@@ -56,6 +56,15 @@ class FWNavigator {
|
|
|
56
56
|
popNativeContainer() {
|
|
57
57
|
return _FWNavigatorModule.default.popNativeContainer();
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Indicate if we can pop top-most native container.
|
|
61
|
+
* @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
canPopNativeContainer() {
|
|
66
|
+
return _FWNavigatorModule.default.canPopNativeContainer();
|
|
67
|
+
}
|
|
59
68
|
|
|
60
69
|
}
|
|
61
70
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWNavigator.tsx"],"names":["FWNavigator","getInstance","_instance","constructor","FWNavigatorModuleEventEmitter","addListener","FWEventName","LogMessage","pushNativeContainer","props","FWLoggerUtil","log","FWNavigatorModule","popNativeContainer"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;;;;;;;;;AAMA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBC,qDAA8BC,WAA9B,CAA0CC,yBAAYC,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1EC,0BAAaC,GAAb,CAAkB,8BAAlB;;AAEA,WAAOC,2BAAkBJ,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSI,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOD,2BAAkBC,kBAAlB,EAAP;AACD;;
|
|
1
|
+
{"version":3,"sources":["FWNavigator.tsx"],"names":["FWNavigator","getInstance","_instance","constructor","FWNavigatorModuleEventEmitter","addListener","FWEventName","LogMessage","pushNativeContainer","props","FWLoggerUtil","log","FWNavigatorModule","popNativeContainer","canPopNativeContainer"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;;;;;;;;;AAMA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBC,qDAA8BC,WAA9B,CAA0CC,yBAAYC,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1EC,0BAAaC,GAAb,CAAkB,8BAAlB;;AAEA,WAAOC,2BAAkBJ,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSI,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOD,2BAAkBC,kBAAlB,EAAP;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,qBAAqB,GAAqB;AAC/C,WAAOF,2BAAkBE,qBAAlB,EAAP;AACD;;AAxCe;;gBAAZd,W;;eA2CSA,W","sourcesContent":["import { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, {\n FWNavigatorModuleEventEmitter,\n} from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\ntype FWNativeContainerProps = {\n [key: string]: any;\n};\n\n/**\n * You can use this class for pushing RN page from the native page.\n */\nclass FWNavigator {\n private static _instance?: FWNavigator;\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n private constructor() {\n FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n * Push a new native container. We will render your app component in new native container.\n * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method\n * @param {FWNativeContainerProps} props We will pass the props to your app component.\n * @returns {Promise<boolean>} The result of pushing RN page from native page.\n */\n public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNewNativeContainer`);\n\n return FWNavigatorModule.pushNativeContainer(props);\n }\n\n /**\n * Pop top-most native container.\n * @returns {Promise<boolean>} The result of poping top-most native container.\n */\n public popNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.popNativeContainer();\n }\n\n /**\n * Indicate if we can pop top-most native container.\n * @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.\n */\n public canPopNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.canPopNativeContainer();\n }\n}\n\nexport default FWNavigator;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","nativeNodeHandle","nativeComponentRef","current","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","componentDidMount","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","FireworkSDK","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;;;;AAAA;;AAGA;;AAQA;;AAEA;;AAIA;;AACA;;;;;;;;AAuDA,MAAMA,mBAAmB,GAAG,aAA5B;;AAEe,MAAMC,SAAN,SAAwBC,eAAMC,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDD,eAAME,SAAN,EALiD;;AAAA,2CAO/B,EAP+B;;AAAA,qCAYrD,MAAM;AACrB,YAAMC,gBAAgB,GAAG,iCAAe,KAAKC,kBAAL,CAAwBC,OAAvC,CAAzB;;AAEAC,6BAAUC,0BAAV,CACE,iCAAeJ,gBAAf,CADF,EAEEG,uBAAUE,oBAAV,CAA+BV,mBAA/B,EAAoDW,QAApD,CAA6DC,OAF/D,EAGE,EAHF;AAKD,KApBqE;;AAAA,sDAuBpEC,KADiC,IAE9B;AACH,YAAM;AAAEC,QAAAA,IAAF;AAAQC,QAAAA;AAAR,UAAmBF,KAAK,CAACG,WAA/B;;AACA,UAAI,KAAKC,KAAL,CAAWC,uBAAf,EAAwC;AACtC,YAAIJ,IAAJ,EAAU;AACR,eAAKG,KAAL,CAAWC,uBAAX,CAAmC;AAAEJ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MAAA,KAAK,EAAEqB,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,KAAK5C,KAAL,CAAW6C,KAA7B,EAAoC;AAAEC,QAAAA,MAAM,EAAE,CAAC;AAAX,OAApC;AANT,OADF;AAUD;;AAEON,EAAAA,uCAAuC,GAAW;AACxD,UAAM;AAAEO,MAAAA;AAAF,QAA+B,KAAK/C,KAA1C;;AACA,QAAI,CAAC+C,wBAAL,EAA+B;AAC7B,aAAO,EAAP;AACD;;AAED,QAAIC,YAAY,GAAG,EAAnB;AACA,UAAMC,aAAa,GAAGN,MAAM,CAACO,IAAP,CAAYH,wBAAZ,EAAsCI,IAAtC,EAAtB;;AACA,SAAK,MAAMV,GAAX,IAAkBQ,aAAlB,EAAiC;AAC/B,YAAMlC,KAAK,GAAGgC,wBAAwB,CAACN,GAAD,CAAtC;AACA,YAAMW,WAAW,GAAGrC,KAAK,CAACsC,IAAN,CAAW,GAAX,CAApB;;AACA,UAAIL,YAAY,CAACM,MAAb,GAAsB,CAA1B,EAA6B;AAC3BN,QAAAA,YAAY,IAAI,GAAhB;AACD;;AAEDA,MAAAA,YAAY,IAAK,GAAEP,GAAI,IAAGW,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AAjIqE;;;;gBAAnDhE,S,kBACG;AACpBsC,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\n\nimport type { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport {\n EmitterSubscription,\n findNodeHandle,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of three available video feed sources.\n */\n source: VideoFeedSource;\n /**\n * Channel name from which content should be displayed. Videos are ordered as a channel timeline. The prop is required when the source is set as channel or playlist.\n */\n channel?: string;\n /**\n * Playlist Id for selected content. Please note channel name is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n\n /**\n * PlaylistGroup Id for selected content. Required when the source is set as playlistGroup.\n */\n playlistGroup?: string;\n\n /**\n * The parameters to be passed to a dynamic content feed. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of Video Feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of Video Player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Video feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\ninterface VideoFeedLoadFinishedEvent extends TargetedEvent {\n name: string;\n reason?: string | null;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class VideoFeed extends React.Component<IVideoFeedProps> {\n static defaultProps = {\n mode: 'row',\n };\n\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n\n /**\n * Force refreshing the video feed.\n */\n public refresh = () => {\n const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (\n event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>\n ) => {\n const { name, reason } = event.nativeEvent;\n if (this.props.onVideoFeedLoadFinished) {\n if (name) {\n this.props.onVideoFeedLoadFinished({ name, reason });\n } else {\n this.props.onVideoFeedLoadFinished();\n }\n }\n };\n\n componentDidMount() {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n }\n\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n videoFeedConfiguration,\n } = this.props;\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_customLayoutName:${customLayoutName}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["VideoFeed.tsx"],"names":["NativeComponentName","VideoFeed","React","Component","createRef","nativeNodeHandle","nativeComponentRef","current","UIManager","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","componentDidMount","subscriptionOfShareBaseURLUpdated","FireworkSDKModuleEventEmitter","addListener","FWEventName","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","FireworkSDK","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;;;;AAAA;;AAGA;;AAQA;;AAEA;;AAIA;;AACA;;;;;;;;AAoDA,MAAMA,mBAAmB,GAAG,aAA5B;;AAEe,MAAMC,SAAN,SAAwBC,eAAMC,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6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GAAI,IAAGW,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AAjIqE;;;;gBAAnDhE,S,kBACG;AACpBsC,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\n\nimport type { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport {\n EmitterSubscription,\n findNodeHandle,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of five available video feed sources.\n */\n source: VideoFeedSource;\n /**\n * Channel id of the feed. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the feed. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * PlaylistGroup id of the feed. Required when the source is set as playlistGroup.\n */\n playlistGroup?: string;\n /**\n * The dynamic content parameters of the feed. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of Video Feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of Video Player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Video feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\ninterface VideoFeedLoadFinishedEvent extends TargetedEvent {\n name: string;\n reason?: string | null;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class VideoFeed extends React.Component<IVideoFeedProps> {\n static defaultProps = {\n mode: 'row',\n };\n\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n\n /**\n * Force refreshing the video feed.\n */\n public refresh = () => {\n const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (\n event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>\n ) => {\n const { name, reason } = event.nativeEvent;\n if (this.props.onVideoFeedLoadFinished) {\n if (name) {\n this.props.onVideoFeedLoadFinished({ name, reason });\n } else {\n this.props.onVideoFeedLoadFinished();\n }\n }\n };\n\n componentDidMount() {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n }\n\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n videoFeedConfiguration,\n } = this.props;\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_customLayoutName:${customLayoutName}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWNavigatorModule.ts"],"names":["FWNavigatorModule","NativeModules","Proxy","get","Error","LINKING_ERROR","FWNavigatorModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,iBAAiB,GAAGC,2BAAcD,iBAAd,GACtBC,2BAAcD,iBADQ,GAEtB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;
|
|
1
|
+
{"version":3,"sources":["FWNavigatorModule.ts"],"names":["FWNavigatorModule","NativeModules","Proxy","get","Error","LINKING_ERROR","FWNavigatorModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,iBAAiB,GAAGC,2BAAcD,iBAAd,GACtBC,2BAAcD,iBADQ,GAEtB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAgBA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBP,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n canPopNativeContainer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
|
|
@@ -32,7 +32,7 @@ class FWNavigator {
|
|
|
32
32
|
return FWNavigatorModule.pushNativeContainer(props);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* Pop top-most native container.
|
|
35
|
+
* Pop top-most native container.
|
|
36
36
|
* @returns {Promise<boolean>} The result of poping top-most native container.
|
|
37
37
|
*/
|
|
38
38
|
|
|
@@ -40,6 +40,15 @@ class FWNavigator {
|
|
|
40
40
|
popNativeContainer() {
|
|
41
41
|
return FWNavigatorModule.popNativeContainer();
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Indicate if we can pop top-most native container.
|
|
45
|
+
* @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
canPopNativeContainer() {
|
|
50
|
+
return FWNavigatorModule.canPopNativeContainer();
|
|
51
|
+
}
|
|
43
52
|
|
|
44
53
|
}
|
|
45
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWNavigator.tsx"],"names":["FWEventName","FWNavigatorModule","FWNavigatorModuleEventEmitter","FWLoggerUtil","FWNavigator","getInstance","_instance","constructor","addListener","LogMessage","pushNativeContainer","props","log","popNativeContainer"],"mappings":";;AAAA,SAASA,WAAT,QAA4B,sBAA5B;AACA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,YAAP,MAAyB,sBAAzB;;AAMA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBL,IAAAA,6BAA6B,CAACM,WAA9B,CAA0CR,WAAW,CAACS,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1ER,IAAAA,YAAY,CAACS,GAAb,CAAkB,8BAAlB;AAEA,WAAOX,iBAAiB,CAACS,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSE,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOZ,iBAAiB,CAACY,kBAAlB,EAAP;AACD;;
|
|
1
|
+
{"version":3,"sources":["FWNavigator.tsx"],"names":["FWEventName","FWNavigatorModule","FWNavigatorModuleEventEmitter","FWLoggerUtil","FWNavigator","getInstance","_instance","constructor","addListener","LogMessage","pushNativeContainer","props","log","popNativeContainer","canPopNativeContainer"],"mappings":";;AAAA,SAASA,WAAT,QAA4B,sBAA5B;AACA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,YAAP,MAAyB,sBAAzB;;AAMA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBL,IAAAA,6BAA6B,CAACM,WAA9B,CAA0CR,WAAW,CAACS,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1ER,IAAAA,YAAY,CAACS,GAAb,CAAkB,8BAAlB;AAEA,WAAOX,iBAAiB,CAACS,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSE,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOZ,iBAAiB,CAACY,kBAAlB,EAAP;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,qBAAqB,GAAqB;AAC/C,WAAOb,iBAAiB,CAACa,qBAAlB,EAAP;AACD;;AAxCe;;gBAAZV,W;;AA2CN,eAAeA,WAAf","sourcesContent":["import { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, {\n FWNavigatorModuleEventEmitter,\n} from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\ntype FWNativeContainerProps = {\n [key: string]: any;\n};\n\n/**\n * You can use this class for pushing RN page from the native page.\n */\nclass FWNavigator {\n private static _instance?: FWNavigator;\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n private constructor() {\n FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n * Push a new native container. We will render your app component in new native container.\n * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method\n * @param {FWNativeContainerProps} props We will pass the props to your app component.\n * @returns {Promise<boolean>} The result of pushing RN page from native page.\n */\n public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNewNativeContainer`);\n\n return FWNavigatorModule.pushNativeContainer(props);\n }\n\n /**\n * Pop top-most native container.\n * @returns {Promise<boolean>} The result of poping top-most native container.\n */\n public popNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.popNativeContainer();\n }\n\n /**\n * Indicate if we can pop top-most native container.\n * @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.\n */\n public canPopNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.canPopNativeContainer();\n }\n}\n\nexport default FWNavigator;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["VideoFeed.tsx"],"names":["React","findNodeHandle","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWVideoFeed","NativeComponentName","VideoFeed","Component","createRef","nativeNodeHandle","nativeComponentRef","current","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","componentDidMount","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAEEC,cAFF,EAIEC,SAJF,QAMO,cANP;AAQA,OAAOC,WAAP,MAAwB,gBAAxB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAIA,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAuDA,MAAMC,mBAAmB,GAAG,aAA5B;AAEA,eAAe,MAAMC,SAAN,SAAwBR,KAAK,CAACS,SAA9B,CAAyD;AAAA;AAAA;;AAAA,6DAKjDT,KAAK,CAACU,SAAN,EALiD;;AAAA,2CAO/B,EAP+B;;AAAA,qCAYrD,MAAM;AACrB,YAAMC,gBAAgB,GAAGV,cAAc,CAAC,KAAKW,kBAAL,CAAwBC,OAAzB,CAAvC;AAEAX,MAAAA,SAAS,CAACY,0BAAV,CACEb,cAAc,CAACU,gBAAD,CADhB,EAEET,SAAS,CAACa,oBAAV,CAA+BR,mBAA/B,EAAoDS,QAApD,CAA6DC,OAF/D,EAGE,EAHF;AAKD,KApBqE;;AAAA,sDAuBpEC,KADiC,IAE9B;AACH,YAAM;AAAEC,QAAAA,IAAF;AAAQC,QAAAA;AAAR,UAAmBF,KAAK,CAACG,WAA/B;;AACA,UAAI,KAAKC,KAAL,CAAWC,uBAAf,EAAwC;AACtC,YAAIJ,IAAJ,EAAU;AACR,eAAKG,KAAL,CAAWC,uBAAX,CAAmC;AAAEJ,YAAAA,IAAF;AAAQC,YAAAA;AAAR,WAAnC;AACD,SAFD,MAEO;AACL,eAAKE,KAAL,CAAWC,uBAAX;AACD;AACF;AACF,KAjCqE;AAAA;;AA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AAoC;AAAEC,QAAAA,MAAM,EAAE,CAAC;AAAX,OAApC;AANT,OADF;AAUD;;AAEON,EAAAA,uCAAuC,GAAW;AACxD,UAAM;AAAEO,MAAAA;AAAF,QAA+B,KAAK5C,KAA1C;;AACA,QAAI,CAAC4C,wBAAL,EAA+B;AAC7B,aAAO,EAAP;AACD;;AAED,QAAIC,YAAY,GAAG,EAAnB;AACA,UAAMC,aAAa,GAAGN,MAAM,CAACO,IAAP,CAAYH,wBAAZ,EAAsCI,IAAtC,EAAtB;;AACA,SAAK,MAAMV,GAAX,IAAkBQ,aAAlB,EAAiC;AAC/B,YAAMjC,KAAK,GAAG+B,wBAAwB,CAACN,GAAD,CAAtC;AACA,YAAMW,WAAW,GAAGpC,KAAK,CAACqC,IAAN,CAAW,GAAX,CAApB;;AACA,UAAIL,YAAY,CAACM,MAAb,GAAsB,CAA1B,EAA6B;AAC3BN,QAAAA,YAAY,IAAI,GAAhB;AACD;;AAEDA,MAAAA,YAAY,IAAK,GAAEP,GAAI,IAAGW,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AAjIqE;;gBAAnD3D,S,kBACG;AACpBkC,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\n\nimport type { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport {\n EmitterSubscription,\n findNodeHandle,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of three available video feed sources.\n */\n source: VideoFeedSource;\n /**\n * Channel name from which content should be displayed. Videos are ordered as a channel timeline. The prop is required when the source is set as channel or playlist.\n */\n channel?: string;\n /**\n * Playlist Id for selected content. Please note channel name is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n\n /**\n * PlaylistGroup Id for selected content. Required when the source is set as playlistGroup.\n */\n playlistGroup?: string;\n\n /**\n * The parameters to be passed to a dynamic content feed. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of Video Feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of Video Player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Video feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\ninterface VideoFeedLoadFinishedEvent extends TargetedEvent {\n name: string;\n reason?: string | null;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class VideoFeed extends React.Component<IVideoFeedProps> {\n static defaultProps = {\n mode: 'row',\n };\n\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n\n /**\n * Force refreshing the video feed.\n */\n public refresh = () => {\n const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (\n event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>\n ) => {\n const { name, reason } = event.nativeEvent;\n if (this.props.onVideoFeedLoadFinished) {\n if (name) {\n this.props.onVideoFeedLoadFinished({ name, reason });\n } else {\n this.props.onVideoFeedLoadFinished();\n }\n }\n };\n\n componentDidMount() {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n }\n\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n videoFeedConfiguration,\n } = this.props;\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_customLayoutName:${customLayoutName}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["VideoFeed.tsx"],"names":["React","findNodeHandle","UIManager","FireworkSDK","FWEventName","FireworkSDKModuleEventEmitter","FWVideoFeed","NativeComponentName","VideoFeed","Component","createRef","nativeNodeHandle","nativeComponentRef","current","dispatchViewManagerCommand","getViewManagerConfig","Commands","refresh","event","name","reason","nativeEvent","props","onVideoFeedLoadFinished","componentDidMount","subscriptionOfShareBaseURLUpdated","addListener","ShareBaseURLUpdated","setState","subscriptions","push","subscriptionOfAdBadgeConfigurationUpdated","AdBadgeConfigurationUpdated","componentWillUnmount","forEach","value","remove","render","source","channel","playlist","playlistGroup","mode","videoFeedConfiguration","titleHidden","title","hidden","titlePosition","customLayoutName","shareBaseURL","getInstance","adBadgeConfiguration","adBadgeTextType","badgeTextType","backgroundColorOfAdBadge","backgroundColor","textColorOfAdBadge","textColor","dynamicContentParametersString","_generateDynamicContentParametersString","key","_onVideoFeedLoadFinished","Object","assign","style","zIndex","dynamicContentParameters","resultString","sortedKeyList","keys","sort","valueString","join","length"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAEEC,cAFF,EAIEC,SAJF,QAMO,cANP;AAQA,OAAOC,WAAP,MAAwB,gBAAxB;AAEA,SAASC,WAAT,QAA4B,uBAA5B;AAIA,SAASC,6BAAT,QAA8C,8BAA9C;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAoDA,MAAMC,mBA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AK,CAACqC,IAAN,CAAW,GAAX,CAApB;;AACA,UAAIL,YAAY,CAACM,MAAb,GAAsB,CAA1B,EAA6B;AAC3BN,QAAAA,YAAY,IAAI,GAAhB;AACD;;AAEDA,MAAAA,YAAY,IAAK,GAAEP,GAAI,IAAGW,WAAY,EAAtC;AACD;;AAED,WAAOJ,YAAP;AACD;;AAjIqE;;gBAAnD3D,S,kBACG;AACpBkC,EAAAA,IAAI,EAAE;AADc,C","sourcesContent":["import React from 'react';\n\nimport type { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport {\n EmitterSubscription,\n findNodeHandle,\n StyleProp,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport FireworkSDK from '../FireworkSDK';\nimport type FWError from '../models/FWError';\nimport { FWEventName } from '../models/FWEventName';\nimport type VideoFeedConfiguration from '../models/VideoFeedConfiguration';\nimport type { VideoFeedSource } from '../models/VideoFeedSource';\nimport type VideoPlayerConfiguration from '../models/VideoPlayerConfiguration';\nimport { FireworkSDKModuleEventEmitter } from '../modules/FireworkSDKModule';\nimport FWVideoFeed from './FWVideoFeed';\n\nexport type VideoFeedMode = 'row' | 'column' | 'grid';\n\nexport interface IVideoFeedProps {\n /**\n * Standard React Native View Style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * One of five available video feed sources.\n */\n source: VideoFeedSource;\n /**\n * Channel id of the feed. Required when the source is set as channel or playlist or dynamicContent.\n */\n channel?: string;\n /**\n * Playlist id of the feed. Please note channel id is necessary. Required when the source is set as playlist.\n */\n playlist?: string;\n /**\n * PlaylistGroup id of the feed. Required when the source is set as playlistGroup.\n */\n playlistGroup?: string;\n /**\n * The dynamic content parameters of the feed. Required when the source is set as dynamicContent.\n */\n dynamicContentParameters?: { [key: string]: string[] };\n /**\n * One of three available display modes. Defaults to row.\n */\n mode?: VideoFeedMode;\n /**\n * Configuration of Video Feed.\n */\n videoFeedConfiguration?: VideoFeedConfiguration;\n /**\n * Configuration of Video Player.\n */\n videoPlayerConfiguration?: VideoPlayerConfiguration;\n /**\n * Video feed loading result callback. It means loading successfully when error equals to undefined.\n */\n onVideoFeedLoadFinished?: (error?: FWError) => void;\n}\n\ninterface VideoFeedLoadFinishedEvent extends TargetedEvent {\n name: string;\n reason?: string | null;\n}\n\nconst NativeComponentName = 'FWVideoFeed';\n\nexport default class VideoFeed extends React.Component<IVideoFeedProps> {\n static defaultProps = {\n mode: 'row',\n };\n\n nativeComponentRef = React.createRef<any>();\n\n subscriptions: EmitterSubscription[] = [];\n\n /**\n * Force refreshing the video feed.\n */\n public refresh = () => {\n const nativeNodeHandle = findNodeHandle(this.nativeComponentRef.current);\n\n UIManager.dispatchViewManagerCommand(\n findNodeHandle(nativeNodeHandle),\n UIManager.getViewManagerConfig(NativeComponentName).Commands.refresh,\n []\n );\n };\n\n private _onVideoFeedLoadFinished = (\n event: NativeSyntheticEvent<VideoFeedLoadFinishedEvent>\n ) => {\n const { name, reason } = event.nativeEvent;\n if (this.props.onVideoFeedLoadFinished) {\n if (name) {\n this.props.onVideoFeedLoadFinished({ name, reason });\n } else {\n this.props.onVideoFeedLoadFinished();\n }\n }\n };\n\n componentDidMount() {\n const subscriptionOfShareBaseURLUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.ShareBaseURLUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfShareBaseURLUpdated);\n\n const subscriptionOfAdBadgeConfigurationUpdated =\n FireworkSDKModuleEventEmitter.addListener(\n FWEventName.AdBadgeConfigurationUpdated,\n () => {\n this.setState({});\n }\n );\n this.subscriptions.push(subscriptionOfAdBadgeConfigurationUpdated);\n }\n\n componentWillUnmount() {\n this.subscriptions.forEach((value) => {\n value.remove();\n });\n\n this.subscriptions = [];\n }\n\n render() {\n const {\n source,\n channel = '',\n playlist = '',\n playlistGroup = '',\n mode = 'row',\n videoFeedConfiguration,\n } = this.props;\n const titleHidden = videoFeedConfiguration?.title?.hidden ?? false;\n const titlePosition = videoFeedConfiguration?.titlePosition ?? 'nested';\n const customLayoutName = videoFeedConfiguration?.customLayoutName ?? '';\n const shareBaseURL = FireworkSDK.getInstance().shareBaseURL ?? '';\n const adBadgeConfiguration =\n FireworkSDK.getInstance().adBadgeConfiguration ?? {};\n const adBadgeTextType = adBadgeConfiguration.badgeTextType ?? '';\n const backgroundColorOfAdBadge = adBadgeConfiguration.backgroundColor ?? '';\n const textColorOfAdBadge = adBadgeConfiguration.textColor ?? '';\n const dynamicContentParametersString =\n this._generateDynamicContentParametersString();\n\n let key = `source:${source}`;\n key += `_channel:${channel}`;\n key += `_playlist:${playlist}`;\n key += `_playlistGroup:${playlistGroup}`;\n key += `_mode:${mode}`;\n key += `_titleHidden:${titleHidden}`;\n key += `_titlePosition:${titlePosition}`;\n key += `_customLayoutName:${customLayoutName}`;\n key += `_shareBaseURL:${shareBaseURL}`;\n key += `_adBadgeTextType:${adBadgeTextType}`;\n key += `_backgroundColorOfAdBadge:${backgroundColorOfAdBadge}`;\n key += `_textColorOfAdBadge:${textColorOfAdBadge}`;\n key += `_dynamicContentParameters:${dynamicContentParametersString}`;\n\n return (\n <FWVideoFeed\n key={key}\n {...this.props}\n ref={this.nativeComponentRef}\n onVideoFeedLoadFinished={this._onVideoFeedLoadFinished}\n mode={mode}\n style={Object.assign({}, this.props.style, { zIndex: -1 })}\n />\n );\n }\n\n private _generateDynamicContentParametersString(): string {\n const { dynamicContentParameters } = this.props;\n if (!dynamicContentParameters) {\n return '';\n }\n\n let resultString = '';\n const sortedKeyList = Object.keys(dynamicContentParameters).sort();\n for (const key of sortedKeyList) {\n const value = dynamicContentParameters[key];\n const valueString = value.join(',');\n if (resultString.length > 0) {\n resultString += '_';\n }\n\n resultString += `${key}:${valueString}`;\n }\n\n return resultString;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["FWNavigatorModule.ts"],"names":["NativeEventEmitter","NativeModules","LINKING_ERROR","FWNavigatorModule","Proxy","get","Error","FWNavigatorModuleEventEmitter"],"mappings":"AAAA,SAASA,kBAAT,QAAiD,cAAjD;AACA,SAASC,aAAT,QAA8B,cAA9B;AACA,SAASC,aAAT,QAA8B,6BAA9B;AAEA,MAAMC,iBAAiB,GAAGF,aAAa,CAACE,iBAAd,GACtBF,aAAa,CAACE,iBADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUJ,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;
|
|
1
|
+
{"version":3,"sources":["FWNavigatorModule.ts"],"names":["NativeEventEmitter","NativeModules","LINKING_ERROR","FWNavigatorModule","Proxy","get","Error","FWNavigatorModuleEventEmitter"],"mappings":"AAAA,SAASA,kBAAT,QAAiD,cAAjD;AACA,SAASC,aAAT,QAA8B,cAA9B;AACA,SAASC,aAAT,QAA8B,6BAA9B;AAEA,MAAMC,iBAAiB,GAAGF,aAAa,CAACE,iBAAd,GACtBF,aAAa,CAACE,iBADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUJ,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAgBA,MAAMK,6BAA6B,GAAG,IAAIP,kBAAJ,CAAuBG,iBAAvB,CAAtC;AACA,SAASI,6BAAT;AACA,eAAeJ,iBAAf","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n canPopNativeContainer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
|
|
@@ -16,9 +16,14 @@ declare class FWNavigator {
|
|
|
16
16
|
*/
|
|
17
17
|
pushNativeContainer(props: FWNativeContainerProps): Promise<boolean>;
|
|
18
18
|
/**
|
|
19
|
-
* Pop top-most native container.
|
|
19
|
+
* Pop top-most native container.
|
|
20
20
|
* @returns {Promise<boolean>} The result of poping top-most native container.
|
|
21
21
|
*/
|
|
22
22
|
popNativeContainer(): Promise<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* Indicate if we can pop top-most native container.
|
|
25
|
+
* @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.
|
|
26
|
+
*/
|
|
27
|
+
canPopNativeContainer(): Promise<boolean>;
|
|
23
28
|
}
|
|
24
29
|
export default FWNavigator;
|
|
@@ -11,23 +11,23 @@ export interface IVideoFeedProps {
|
|
|
11
11
|
*/
|
|
12
12
|
style?: StyleProp<ViewStyle>;
|
|
13
13
|
/**
|
|
14
|
-
* One of
|
|
14
|
+
* One of five available video feed sources.
|
|
15
15
|
*/
|
|
16
16
|
source: VideoFeedSource;
|
|
17
17
|
/**
|
|
18
|
-
* Channel
|
|
18
|
+
* Channel id of the feed. Required when the source is set as channel or playlist or dynamicContent.
|
|
19
19
|
*/
|
|
20
20
|
channel?: string;
|
|
21
21
|
/**
|
|
22
|
-
* Playlist
|
|
22
|
+
* Playlist id of the feed. Please note channel id is necessary. Required when the source is set as playlist.
|
|
23
23
|
*/
|
|
24
24
|
playlist?: string;
|
|
25
25
|
/**
|
|
26
|
-
* PlaylistGroup
|
|
26
|
+
* PlaylistGroup id of the feed. Required when the source is set as playlistGroup.
|
|
27
27
|
*/
|
|
28
28
|
playlistGroup?: string;
|
|
29
29
|
/**
|
|
30
|
-
* The
|
|
30
|
+
* The dynamic content parameters of the feed. Required when the source is set as dynamicContent.
|
|
31
31
|
*/
|
|
32
32
|
dynamicContentParameters?: {
|
|
33
33
|
[key: string]: string[];
|
|
@@ -6,16 +6,38 @@ export default interface FeedItemDetails {
|
|
|
6
6
|
index: number;
|
|
7
7
|
/**
|
|
8
8
|
* The unique id of the thumbnail.
|
|
9
|
-
* If the source is
|
|
9
|
+
* If the source is playlistGroup this value will represent the playlist's id; otherwise this value is the id of the selected video.
|
|
10
10
|
*/
|
|
11
11
|
id: string;
|
|
12
12
|
/**
|
|
13
13
|
* The total duration of the video.
|
|
14
|
-
* If the source is
|
|
14
|
+
* If the source is playlistGroup this value will always be 0; otherwise this value is the duration of the selected video.
|
|
15
15
|
*/
|
|
16
16
|
duration: number;
|
|
17
17
|
/**
|
|
18
|
-
* The
|
|
18
|
+
* The title of the feed item. Currently, the title doesn't have value on the Android side when the source is playlistGroup.
|
|
19
|
+
*/
|
|
20
|
+
title?: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* The source of the feed.
|
|
19
23
|
*/
|
|
20
24
|
source: VideoFeedSource;
|
|
25
|
+
/**
|
|
26
|
+
* The channel id of the feed. The property has value when the source is channel or playlist or dynamicContent.
|
|
27
|
+
*/
|
|
28
|
+
channel?: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Playlist id of the feed. The property has value when the source is playlist.
|
|
31
|
+
*/
|
|
32
|
+
playlist?: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Playlist group id of the feed. The property has value when the source is playlistGroup.
|
|
35
|
+
*/
|
|
36
|
+
playlistGroup?: string | null;
|
|
37
|
+
/**
|
|
38
|
+
* The dynamic content parameters of the feed. The property has value when the source is dynamicContent.
|
|
39
|
+
*/
|
|
40
|
+
dynamicContentParameters?: {
|
|
41
|
+
[key: string]: string[];
|
|
42
|
+
} | null;
|
|
21
43
|
}
|
|
@@ -4,6 +4,7 @@ interface IFWNavigatorModule extends NativeModule {
|
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
}): Promise<boolean>;
|
|
6
6
|
popNativeContainer(): Promise<boolean>;
|
|
7
|
+
canPopNativeContainer(): Promise<boolean>;
|
|
7
8
|
}
|
|
8
9
|
declare const FWNavigatorModuleEventEmitter: NativeEventEmitter;
|
|
9
10
|
export { FWNavigatorModuleEventEmitter };
|
package/package.json
CHANGED
package/src/FWNavigator.tsx
CHANGED
|
@@ -38,12 +38,20 @@ class FWNavigator {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* Pop top-most native container.
|
|
41
|
+
* Pop top-most native container.
|
|
42
42
|
* @returns {Promise<boolean>} The result of poping top-most native container.
|
|
43
43
|
*/
|
|
44
44
|
public popNativeContainer(): Promise<boolean> {
|
|
45
45
|
return FWNavigatorModule.popNativeContainer();
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Indicate if we can pop top-most native container.
|
|
50
|
+
* @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.
|
|
51
|
+
*/
|
|
52
|
+
public canPopNativeContainer(): Promise<boolean> {
|
|
53
|
+
return FWNavigatorModule.canPopNativeContainer();
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
export default FWNavigator;
|
|
@@ -26,28 +26,25 @@ export interface IVideoFeedProps {
|
|
|
26
26
|
*/
|
|
27
27
|
style?: StyleProp<ViewStyle>;
|
|
28
28
|
/**
|
|
29
|
-
* One of
|
|
29
|
+
* One of five available video feed sources.
|
|
30
30
|
*/
|
|
31
31
|
source: VideoFeedSource;
|
|
32
32
|
/**
|
|
33
|
-
* Channel
|
|
33
|
+
* Channel id of the feed. Required when the source is set as channel or playlist or dynamicContent.
|
|
34
34
|
*/
|
|
35
35
|
channel?: string;
|
|
36
36
|
/**
|
|
37
|
-
* Playlist
|
|
37
|
+
* Playlist id of the feed. Please note channel id is necessary. Required when the source is set as playlist.
|
|
38
38
|
*/
|
|
39
39
|
playlist?: string;
|
|
40
|
-
|
|
41
40
|
/**
|
|
42
|
-
* PlaylistGroup
|
|
41
|
+
* PlaylistGroup id of the feed. Required when the source is set as playlistGroup.
|
|
43
42
|
*/
|
|
44
43
|
playlistGroup?: string;
|
|
45
|
-
|
|
46
44
|
/**
|
|
47
|
-
* The
|
|
45
|
+
* The dynamic content parameters of the feed. Required when the source is set as dynamicContent.
|
|
48
46
|
*/
|
|
49
47
|
dynamicContentParameters?: { [key: string]: string[] };
|
|
50
|
-
|
|
51
48
|
/**
|
|
52
49
|
* One of three available display modes. Defaults to row.
|
|
53
50
|
*/
|
|
@@ -7,16 +7,36 @@ export default interface FeedItemDetails {
|
|
|
7
7
|
index: number;
|
|
8
8
|
/**
|
|
9
9
|
* The unique id of the thumbnail.
|
|
10
|
-
* If the source is
|
|
10
|
+
* If the source is playlistGroup this value will represent the playlist's id; otherwise this value is the id of the selected video.
|
|
11
11
|
*/
|
|
12
12
|
id: string;
|
|
13
13
|
/**
|
|
14
14
|
* The total duration of the video.
|
|
15
|
-
* If the source is
|
|
15
|
+
* If the source is playlistGroup this value will always be 0; otherwise this value is the duration of the selected video.
|
|
16
16
|
*/
|
|
17
17
|
duration: number;
|
|
18
18
|
/**
|
|
19
|
-
* The
|
|
19
|
+
* The title of the feed item. Currently, the title doesn't have value on the Android side when the source is playlistGroup.
|
|
20
|
+
*/
|
|
21
|
+
title?: string | null;
|
|
22
|
+
/**
|
|
23
|
+
* The source of the feed.
|
|
20
24
|
*/
|
|
21
25
|
source: VideoFeedSource;
|
|
26
|
+
/**
|
|
27
|
+
* The channel id of the feed. The property has value when the source is channel or playlist or dynamicContent.
|
|
28
|
+
*/
|
|
29
|
+
channel?: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Playlist id of the feed. The property has value when the source is playlist.
|
|
32
|
+
*/
|
|
33
|
+
playlist?: string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Playlist group id of the feed. The property has value when the source is playlistGroup.
|
|
36
|
+
*/
|
|
37
|
+
playlistGroup?: string | null;
|
|
38
|
+
/**
|
|
39
|
+
* The dynamic content parameters of the feed. The property has value when the source is dynamicContent.
|
|
40
|
+
*/
|
|
41
|
+
dynamicContentParameters?: { [key: string]: string[] } | null;
|
|
22
42
|
}
|
|
@@ -15,6 +15,7 @@ const FWNavigatorModule = NativeModules.FWNavigatorModule
|
|
|
15
15
|
interface IFWNavigatorModule extends NativeModule {
|
|
16
16
|
pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;
|
|
17
17
|
popNativeContainer(): Promise<boolean>;
|
|
18
|
+
canPopNativeContainer(): Promise<boolean>;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
const FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);
|