@shortkitsdk/react-native 0.2.29 → 0.2.31
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/libs/shortkit-release.aar +0 -0
- package/android/src/main/java/com/shortkit/reactnative/ShortKitFeedView.kt +8 -1
- package/android/src/main/java/com/shortkit/reactnative/ShortKitFeedViewManager.kt +6 -0
- package/ios/ShortKitBridge.swift +5 -1
- package/ios/ShortKitFeedView.swift +9 -13
- package/ios/ShortKitFeedViewManager.mm +1 -0
- package/ios/ShortKitModule.mm +5 -1
- package/ios/ShortKitSDK.xcframework/Info.plist +5 -5
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Info.plist +2 -2
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.abi.json +4732 -872
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +77 -8
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftinterface +77 -8
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/_CodeSignature/CodeResources +9 -9
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Info.plist +2 -2
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +4732 -872
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +77 -8
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +77 -8
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +4732 -872
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +77 -8
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +77 -8
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/_CodeSignature/CodeResources +17 -17
- package/ios/ShortKitWidgetNativeView.swift +23 -0
- package/ios/ShortKitWidgetNativeViewManager.mm +1 -0
- package/package.json +1 -1
- package/src/ShortKitFeed.tsx +2 -0
- package/src/ShortKitProvider.tsx +4 -0
- package/src/ShortKitWidget.tsx +47 -2
- package/src/specs/NativeShortKitModule.ts +9 -0
- package/src/specs/ShortKitFeedViewNativeComponent.ts +5 -0
- package/src/specs/ShortKitWidgetViewNativeComponent.ts +6 -0
- package/src/types.ts +21 -0
- package/ios/DebugPanelView.swift +0 -302
|
@@ -59,6 +59,7 @@ final public class BandwidthMonitor : ShortKitSDK.BandwidthMonitorProtocol {
|
|
|
59
59
|
final public let segmentCache: any ShortKitSDK.SegmentCacheProtocol
|
|
60
60
|
final public var segmentServer: ShortKitSDK.SegmentHTTPServer?
|
|
61
61
|
public init(segmentCache: any ShortKitSDK.SegmentCacheProtocol, session: Foundation.URLSession = .shared)
|
|
62
|
+
@objc deinit
|
|
62
63
|
final public var urlMapping: [Foundation.URL : Foundation.URL] {
|
|
63
64
|
get
|
|
64
65
|
}
|
|
@@ -73,7 +74,6 @@ final public class BandwidthMonitor : ShortKitSDK.BandwidthMonitorProtocol {
|
|
|
73
74
|
final public func cachedRendition(for videoID: Swift.String) -> Swift.String?
|
|
74
75
|
@objc final public func resourceLoader(_ resourceLoader: AVFoundation.AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVFoundation.AVAssetResourceLoadingRequest) -> Swift.Bool
|
|
75
76
|
@objc final public func resourceLoader(_ resourceLoader: AVFoundation.AVAssetResourceLoader, didCancel loadingRequest: AVFoundation.AVAssetResourceLoadingRequest)
|
|
76
|
-
@objc deinit
|
|
77
77
|
}
|
|
78
78
|
public protocol ColdStartManagerProtocol : Swift.Sendable {
|
|
79
79
|
func cachedFeedItems() -> [ShortKitSDK.FeedItem]
|
|
@@ -152,15 +152,11 @@ final public class SegmentHTTPServer {
|
|
|
152
152
|
}
|
|
153
153
|
public protocol SegmentPrefetcherProtocol : AnyObject {
|
|
154
154
|
func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
|
|
155
|
-
func pause()
|
|
156
|
-
func resume()
|
|
157
155
|
}
|
|
158
|
-
final public class SegmentPrefetcher : ShortKitSDK.SegmentPrefetcherProtocol {
|
|
156
|
+
@_hasMissingDesignatedInitializers final public class SegmentPrefetcher : ShortKitSDK.SegmentPrefetcherProtocol {
|
|
159
157
|
public init(cache: any ShortKitSDK.SegmentCacheProtocol, monitor: any ShortKitSDK.BandwidthMonitorProtocol, session: Foundation.URLSession? = nil, targetRenditionHeight: Swift.Int = 720, maxCachedVideos: Swift.Int = 7)
|
|
160
|
-
final public func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
|
|
161
|
-
final public func pause()
|
|
162
|
-
final public func resume()
|
|
163
158
|
@objc deinit
|
|
159
|
+
final public func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
|
|
164
160
|
}
|
|
165
161
|
public struct CarouselCompletionEvent : Swift.Equatable, Swift.Sendable {
|
|
166
162
|
public let contentItem: ShortKitSDK.ContentItem
|
|
@@ -343,8 +339,46 @@ extension ShortKitSDK.LiveOverlayMode : Swift.Codable {
|
|
|
343
339
|
public init(from decoder: any Swift.Decoder) throws
|
|
344
340
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
345
341
|
}
|
|
342
|
+
public struct DebugAlert {
|
|
343
|
+
public enum Level {
|
|
344
|
+
case warning
|
|
345
|
+
public static func == (a: ShortKitSDK.DebugAlert.Level, b: ShortKitSDK.DebugAlert.Level) -> Swift.Bool
|
|
346
|
+
public func hash(into hasher: inout Swift.Hasher)
|
|
347
|
+
public var hashValue: Swift.Int {
|
|
348
|
+
get
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
public let level: ShortKitSDK.DebugAlert.Level
|
|
352
|
+
public let compactLabel: Swift.String
|
|
353
|
+
public let priority: Swift.Int
|
|
354
|
+
public init(level: ShortKitSDK.DebugAlert.Level, compactLabel: Swift.String, priority: Swift.Int)
|
|
355
|
+
}
|
|
356
|
+
public enum DebugAlerts {
|
|
357
|
+
public static func compute(_ m: ShortKitSDK.DebugMetrics) -> [ShortKitSDK.DebugAlert]
|
|
358
|
+
}
|
|
359
|
+
public enum DebugItemStatus {
|
|
360
|
+
case unknown
|
|
361
|
+
case readyToPlay
|
|
362
|
+
case failed
|
|
363
|
+
public static func == (a: ShortKitSDK.DebugItemStatus, b: ShortKitSDK.DebugItemStatus) -> Swift.Bool
|
|
364
|
+
public func hash(into hasher: inout Swift.Hasher)
|
|
365
|
+
public var hashValue: Swift.Int {
|
|
366
|
+
get
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
public enum DebugTimeControl {
|
|
370
|
+
case paused
|
|
371
|
+
case waitingToPlayAtSpecifiedRate
|
|
372
|
+
case playing
|
|
373
|
+
public static func == (a: ShortKitSDK.DebugTimeControl, b: ShortKitSDK.DebugTimeControl) -> Swift.Bool
|
|
374
|
+
public func hash(into hasher: inout Swift.Hasher)
|
|
375
|
+
public var hashValue: Swift.Int {
|
|
376
|
+
get
|
|
377
|
+
}
|
|
378
|
+
}
|
|
346
379
|
public struct DebugMetrics {
|
|
347
380
|
public var contentId: Swift.String?
|
|
381
|
+
public var playbackId: Swift.String?
|
|
348
382
|
public var feedIndex: Swift.Int
|
|
349
383
|
public var playerState: ShortKitSDK.PlayerState
|
|
350
384
|
public var intentToFrameMs: Swift.Int?
|
|
@@ -366,8 +400,35 @@ public struct DebugMetrics {
|
|
|
366
400
|
public var thumbnailVisible: Swift.Bool
|
|
367
401
|
public var thumbsCachedAhead: Swift.Int
|
|
368
402
|
public var metadataAhead: Swift.Int
|
|
403
|
+
public var itemStatus: ShortKitSDK.DebugItemStatus
|
|
404
|
+
public var playerErrorDescription: Swift.String?
|
|
405
|
+
public var failedItemUrl: Swift.String?
|
|
406
|
+
public var timeControlStatus: ShortKitSDK.DebugTimeControl
|
|
407
|
+
public var waitingReason: Swift.String?
|
|
408
|
+
public var hasCurrentItem: Swift.Bool
|
|
409
|
+
public var hasPlayerLayer: Swift.Bool?
|
|
410
|
+
public var isPlaybackBufferEmpty: Swift.Bool
|
|
411
|
+
public var isPlaybackLikelyToKeepUp: Swift.Bool
|
|
412
|
+
public var isPlaybackBufferFull: Swift.Bool
|
|
413
|
+
public var loadedTimeRangesCount: Swift.Int
|
|
414
|
+
public var loadedTimeRangesEnd: Swift.Double
|
|
415
|
+
public var poolSlotName: Swift.String?
|
|
416
|
+
public var poolReservedIndex: Swift.Int?
|
|
417
|
+
public var segmentServerPort: Swift.UInt16?
|
|
369
418
|
public init(contentId: Swift.String? = nil)
|
|
370
419
|
}
|
|
420
|
+
@objc @_inheritsConvenienceInitializers @_Concurrency.MainActor @preconcurrency final public class DebugPanelView : UIKit.UIView {
|
|
421
|
+
@_Concurrency.MainActor @preconcurrency public static let panelWidth: CoreFoundation.CGFloat
|
|
422
|
+
@_Concurrency.MainActor @preconcurrency public static let panelHeight: CoreFoundation.CGFloat
|
|
423
|
+
@_Concurrency.MainActor @preconcurrency public static let adjacentExpandedHeight: CoreFoundation.CGFloat
|
|
424
|
+
@_Concurrency.MainActor @preconcurrency public static let diagnosticsExpandedHeight: CoreFoundation.CGFloat
|
|
425
|
+
@_Concurrency.MainActor @preconcurrency public static let expandedExtraHeight: CoreFoundation.CGFloat
|
|
426
|
+
@_Concurrency.MainActor @preconcurrency @objc override dynamic public init(frame: CoreFoundation.CGRect)
|
|
427
|
+
@_Concurrency.MainActor @preconcurrency @objc required dynamic public init?(coder: Foundation.NSCoder)
|
|
428
|
+
@_Concurrency.MainActor @preconcurrency final public func subscribe(to subject: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>)
|
|
429
|
+
@_Concurrency.MainActor @preconcurrency final public func subscribeAdjacent(prev: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, next: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>)
|
|
430
|
+
@objc deinit
|
|
431
|
+
}
|
|
371
432
|
public enum SwipeCurve : Swift.Int, Swift.CaseIterable {
|
|
372
433
|
case quarticOut
|
|
373
434
|
case quinticOut
|
|
@@ -1098,10 +1159,11 @@ final public class ShortKit {
|
|
|
1098
1159
|
final public let player: ShortKitSDK.ShortKitPlayer
|
|
1099
1160
|
final public let carousel: ShortKitSDK.ShortKitCarousel
|
|
1100
1161
|
final public let debugPanelEnabled: Swift.Bool
|
|
1162
|
+
public static let defaultDebugPanelFactory: (_ active: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, _ prev: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, _ next: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>) -> UIKit.UIView
|
|
1101
1163
|
weak final public var delegate: (any ShortKitSDK.ShortKitDelegate)?
|
|
1102
1164
|
weak final public var downloadDelegate: (any ShortKitSDK.ShortKitDownloadDelegate)?
|
|
1103
1165
|
final public var loadingViewProvider: (() -> UIKit.UIView)?
|
|
1104
|
-
public init(apiKey: Swift.String, userId: Swift.String? = nil, adProvider: (any ShortKitSDK.ShortKitAdProvider)? = nil, clientAppName: Swift.String? = nil, clientAppVersion: Swift.String? = nil, customDimensions: [Swift.String : Swift.String]? = nil, loadingViewProvider: (() -> UIKit.UIView)? = nil, debugPanelEnabled: Swift.Bool = false)
|
|
1166
|
+
public init(apiKey: Swift.String, userId: Swift.String? = nil, adProvider: (any ShortKitSDK.ShortKitAdProvider)? = nil, clientAppName: Swift.String? = nil, clientAppVersion: Swift.String? = nil, customDimensions: [Swift.String : Swift.String]? = nil, loadingViewProvider: (() -> UIKit.UIView)? = nil, debugPanelEnabled: Swift.Bool = false, serverTracingEnabled: Swift.Bool = false, consoleTracingEnabled: Swift.Bool = false)
|
|
1105
1167
|
final public func preloadFeed(filter: ShortKitSDK.FeedFilter? = nil, limit: Swift.Int = 10) -> ShortKitSDK.FeedPreload
|
|
1106
1168
|
final public func preloadFeed(items: [ShortKitSDK.FeedInput]) -> ShortKitSDK.FeedPreload
|
|
1107
1169
|
final public func fetchContent(limit: Swift.Int = 10, filter: ShortKitSDK.FeedFilter? = nil) async throws -> [ShortKitSDK.ContentItem]
|
|
@@ -1159,6 +1221,7 @@ extension ShortKitSDK.ShortKitPlayerViewController : UIKit.UIViewControllerTrans
|
|
|
1159
1221
|
}
|
|
1160
1222
|
@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor @preconcurrency final public class ShortKitWidgetViewController : UIKit.UIViewController {
|
|
1161
1223
|
@_Concurrency.MainActor @preconcurrency final public var feedMask: ShortKitSDK.FeedMaskMode
|
|
1224
|
+
@_Concurrency.MainActor @preconcurrency final public var onCardTap: ((Swift.String, Swift.Int) -> Swift.Void)?
|
|
1162
1225
|
@_Concurrency.MainActor @preconcurrency public init(shortKit: ShortKitSDK.ShortKit, config: ShortKitSDK.WidgetConfig, items: [ShortKitSDK.WidgetInput] = [])
|
|
1163
1226
|
@_Concurrency.MainActor @preconcurrency final public func configure(with inputs: [ShortKitSDK.WidgetInput])
|
|
1164
1227
|
@_Concurrency.MainActor @preconcurrency @objc override final public func viewDidLoad()
|
|
@@ -1202,6 +1265,12 @@ extension ShortKitSDK.ScrollAxis : Swift.Hashable {}
|
|
|
1202
1265
|
extension ShortKitSDK.ScrollAxis : Swift.RawRepresentable {}
|
|
1203
1266
|
extension ShortKitSDK.FeedSource : Swift.Hashable {}
|
|
1204
1267
|
extension ShortKitSDK.FeedSource : Swift.RawRepresentable {}
|
|
1268
|
+
extension ShortKitSDK.DebugAlert.Level : Swift.Equatable {}
|
|
1269
|
+
extension ShortKitSDK.DebugAlert.Level : Swift.Hashable {}
|
|
1270
|
+
extension ShortKitSDK.DebugItemStatus : Swift.Equatable {}
|
|
1271
|
+
extension ShortKitSDK.DebugItemStatus : Swift.Hashable {}
|
|
1272
|
+
extension ShortKitSDK.DebugTimeControl : Swift.Equatable {}
|
|
1273
|
+
extension ShortKitSDK.DebugTimeControl : Swift.Hashable {}
|
|
1205
1274
|
extension ShortKitSDK.SwipeCurve : Swift.Equatable {}
|
|
1206
1275
|
extension ShortKitSDK.SwipeCurve : Swift.Hashable {}
|
|
1207
1276
|
extension ShortKitSDK.SwipeCurve : Swift.RawRepresentable {}
|
|
Binary file
|
|
@@ -59,6 +59,7 @@ final public class BandwidthMonitor : ShortKitSDK.BandwidthMonitorProtocol {
|
|
|
59
59
|
final public let segmentCache: any ShortKitSDK.SegmentCacheProtocol
|
|
60
60
|
final public var segmentServer: ShortKitSDK.SegmentHTTPServer?
|
|
61
61
|
public init(segmentCache: any ShortKitSDK.SegmentCacheProtocol, session: Foundation.URLSession = .shared)
|
|
62
|
+
@objc deinit
|
|
62
63
|
final public var urlMapping: [Foundation.URL : Foundation.URL] {
|
|
63
64
|
get
|
|
64
65
|
}
|
|
@@ -73,7 +74,6 @@ final public class BandwidthMonitor : ShortKitSDK.BandwidthMonitorProtocol {
|
|
|
73
74
|
final public func cachedRendition(for videoID: Swift.String) -> Swift.String?
|
|
74
75
|
@objc final public func resourceLoader(_ resourceLoader: AVFoundation.AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVFoundation.AVAssetResourceLoadingRequest) -> Swift.Bool
|
|
75
76
|
@objc final public func resourceLoader(_ resourceLoader: AVFoundation.AVAssetResourceLoader, didCancel loadingRequest: AVFoundation.AVAssetResourceLoadingRequest)
|
|
76
|
-
@objc deinit
|
|
77
77
|
}
|
|
78
78
|
public protocol ColdStartManagerProtocol : Swift.Sendable {
|
|
79
79
|
func cachedFeedItems() -> [ShortKitSDK.FeedItem]
|
|
@@ -152,15 +152,11 @@ final public class SegmentHTTPServer {
|
|
|
152
152
|
}
|
|
153
153
|
public protocol SegmentPrefetcherProtocol : AnyObject {
|
|
154
154
|
func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
|
|
155
|
-
func pause()
|
|
156
|
-
func resume()
|
|
157
155
|
}
|
|
158
|
-
final public class SegmentPrefetcher : ShortKitSDK.SegmentPrefetcherProtocol {
|
|
156
|
+
@_hasMissingDesignatedInitializers final public class SegmentPrefetcher : ShortKitSDK.SegmentPrefetcherProtocol {
|
|
159
157
|
public init(cache: any ShortKitSDK.SegmentCacheProtocol, monitor: any ShortKitSDK.BandwidthMonitorProtocol, session: Foundation.URLSession? = nil, targetRenditionHeight: Swift.Int = 720, maxCachedVideos: Swift.Int = 7)
|
|
160
|
-
final public func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
|
|
161
|
-
final public func pause()
|
|
162
|
-
final public func resume()
|
|
163
158
|
@objc deinit
|
|
159
|
+
final public func updateCurrentIndex(_ index: Swift.Int, feedItems: [ShortKitSDK.FeedItem])
|
|
164
160
|
}
|
|
165
161
|
public struct CarouselCompletionEvent : Swift.Equatable, Swift.Sendable {
|
|
166
162
|
public let contentItem: ShortKitSDK.ContentItem
|
|
@@ -343,8 +339,46 @@ extension ShortKitSDK.LiveOverlayMode : Swift.Codable {
|
|
|
343
339
|
public init(from decoder: any Swift.Decoder) throws
|
|
344
340
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
345
341
|
}
|
|
342
|
+
public struct DebugAlert {
|
|
343
|
+
public enum Level {
|
|
344
|
+
case warning
|
|
345
|
+
public static func == (a: ShortKitSDK.DebugAlert.Level, b: ShortKitSDK.DebugAlert.Level) -> Swift.Bool
|
|
346
|
+
public func hash(into hasher: inout Swift.Hasher)
|
|
347
|
+
public var hashValue: Swift.Int {
|
|
348
|
+
get
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
public let level: ShortKitSDK.DebugAlert.Level
|
|
352
|
+
public let compactLabel: Swift.String
|
|
353
|
+
public let priority: Swift.Int
|
|
354
|
+
public init(level: ShortKitSDK.DebugAlert.Level, compactLabel: Swift.String, priority: Swift.Int)
|
|
355
|
+
}
|
|
356
|
+
public enum DebugAlerts {
|
|
357
|
+
public static func compute(_ m: ShortKitSDK.DebugMetrics) -> [ShortKitSDK.DebugAlert]
|
|
358
|
+
}
|
|
359
|
+
public enum DebugItemStatus {
|
|
360
|
+
case unknown
|
|
361
|
+
case readyToPlay
|
|
362
|
+
case failed
|
|
363
|
+
public static func == (a: ShortKitSDK.DebugItemStatus, b: ShortKitSDK.DebugItemStatus) -> Swift.Bool
|
|
364
|
+
public func hash(into hasher: inout Swift.Hasher)
|
|
365
|
+
public var hashValue: Swift.Int {
|
|
366
|
+
get
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
public enum DebugTimeControl {
|
|
370
|
+
case paused
|
|
371
|
+
case waitingToPlayAtSpecifiedRate
|
|
372
|
+
case playing
|
|
373
|
+
public static func == (a: ShortKitSDK.DebugTimeControl, b: ShortKitSDK.DebugTimeControl) -> Swift.Bool
|
|
374
|
+
public func hash(into hasher: inout Swift.Hasher)
|
|
375
|
+
public var hashValue: Swift.Int {
|
|
376
|
+
get
|
|
377
|
+
}
|
|
378
|
+
}
|
|
346
379
|
public struct DebugMetrics {
|
|
347
380
|
public var contentId: Swift.String?
|
|
381
|
+
public var playbackId: Swift.String?
|
|
348
382
|
public var feedIndex: Swift.Int
|
|
349
383
|
public var playerState: ShortKitSDK.PlayerState
|
|
350
384
|
public var intentToFrameMs: Swift.Int?
|
|
@@ -366,8 +400,35 @@ public struct DebugMetrics {
|
|
|
366
400
|
public var thumbnailVisible: Swift.Bool
|
|
367
401
|
public var thumbsCachedAhead: Swift.Int
|
|
368
402
|
public var metadataAhead: Swift.Int
|
|
403
|
+
public var itemStatus: ShortKitSDK.DebugItemStatus
|
|
404
|
+
public var playerErrorDescription: Swift.String?
|
|
405
|
+
public var failedItemUrl: Swift.String?
|
|
406
|
+
public var timeControlStatus: ShortKitSDK.DebugTimeControl
|
|
407
|
+
public var waitingReason: Swift.String?
|
|
408
|
+
public var hasCurrentItem: Swift.Bool
|
|
409
|
+
public var hasPlayerLayer: Swift.Bool?
|
|
410
|
+
public var isPlaybackBufferEmpty: Swift.Bool
|
|
411
|
+
public var isPlaybackLikelyToKeepUp: Swift.Bool
|
|
412
|
+
public var isPlaybackBufferFull: Swift.Bool
|
|
413
|
+
public var loadedTimeRangesCount: Swift.Int
|
|
414
|
+
public var loadedTimeRangesEnd: Swift.Double
|
|
415
|
+
public var poolSlotName: Swift.String?
|
|
416
|
+
public var poolReservedIndex: Swift.Int?
|
|
417
|
+
public var segmentServerPort: Swift.UInt16?
|
|
369
418
|
public init(contentId: Swift.String? = nil)
|
|
370
419
|
}
|
|
420
|
+
@objc @_inheritsConvenienceInitializers @_Concurrency.MainActor @preconcurrency final public class DebugPanelView : UIKit.UIView {
|
|
421
|
+
@_Concurrency.MainActor @preconcurrency public static let panelWidth: CoreFoundation.CGFloat
|
|
422
|
+
@_Concurrency.MainActor @preconcurrency public static let panelHeight: CoreFoundation.CGFloat
|
|
423
|
+
@_Concurrency.MainActor @preconcurrency public static let adjacentExpandedHeight: CoreFoundation.CGFloat
|
|
424
|
+
@_Concurrency.MainActor @preconcurrency public static let diagnosticsExpandedHeight: CoreFoundation.CGFloat
|
|
425
|
+
@_Concurrency.MainActor @preconcurrency public static let expandedExtraHeight: CoreFoundation.CGFloat
|
|
426
|
+
@_Concurrency.MainActor @preconcurrency @objc override dynamic public init(frame: CoreFoundation.CGRect)
|
|
427
|
+
@_Concurrency.MainActor @preconcurrency @objc required dynamic public init?(coder: Foundation.NSCoder)
|
|
428
|
+
@_Concurrency.MainActor @preconcurrency final public func subscribe(to subject: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>)
|
|
429
|
+
@_Concurrency.MainActor @preconcurrency final public func subscribeAdjacent(prev: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, next: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>)
|
|
430
|
+
@objc deinit
|
|
431
|
+
}
|
|
371
432
|
public enum SwipeCurve : Swift.Int, Swift.CaseIterable {
|
|
372
433
|
case quarticOut
|
|
373
434
|
case quinticOut
|
|
@@ -1098,10 +1159,11 @@ final public class ShortKit {
|
|
|
1098
1159
|
final public let player: ShortKitSDK.ShortKitPlayer
|
|
1099
1160
|
final public let carousel: ShortKitSDK.ShortKitCarousel
|
|
1100
1161
|
final public let debugPanelEnabled: Swift.Bool
|
|
1162
|
+
public static let defaultDebugPanelFactory: (_ active: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, _ prev: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>, _ next: Combine.CurrentValueSubject<ShortKitSDK.DebugMetrics, Swift.Never>) -> UIKit.UIView
|
|
1101
1163
|
weak final public var delegate: (any ShortKitSDK.ShortKitDelegate)?
|
|
1102
1164
|
weak final public var downloadDelegate: (any ShortKitSDK.ShortKitDownloadDelegate)?
|
|
1103
1165
|
final public var loadingViewProvider: (() -> UIKit.UIView)?
|
|
1104
|
-
public init(apiKey: Swift.String, userId: Swift.String? = nil, adProvider: (any ShortKitSDK.ShortKitAdProvider)? = nil, clientAppName: Swift.String? = nil, clientAppVersion: Swift.String? = nil, customDimensions: [Swift.String : Swift.String]? = nil, loadingViewProvider: (() -> UIKit.UIView)? = nil, debugPanelEnabled: Swift.Bool = false)
|
|
1166
|
+
public init(apiKey: Swift.String, userId: Swift.String? = nil, adProvider: (any ShortKitSDK.ShortKitAdProvider)? = nil, clientAppName: Swift.String? = nil, clientAppVersion: Swift.String? = nil, customDimensions: [Swift.String : Swift.String]? = nil, loadingViewProvider: (() -> UIKit.UIView)? = nil, debugPanelEnabled: Swift.Bool = false, serverTracingEnabled: Swift.Bool = false, consoleTracingEnabled: Swift.Bool = false)
|
|
1105
1167
|
final public func preloadFeed(filter: ShortKitSDK.FeedFilter? = nil, limit: Swift.Int = 10) -> ShortKitSDK.FeedPreload
|
|
1106
1168
|
final public func preloadFeed(items: [ShortKitSDK.FeedInput]) -> ShortKitSDK.FeedPreload
|
|
1107
1169
|
final public func fetchContent(limit: Swift.Int = 10, filter: ShortKitSDK.FeedFilter? = nil) async throws -> [ShortKitSDK.ContentItem]
|
|
@@ -1159,6 +1221,7 @@ extension ShortKitSDK.ShortKitPlayerViewController : UIKit.UIViewControllerTrans
|
|
|
1159
1221
|
}
|
|
1160
1222
|
@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor @preconcurrency final public class ShortKitWidgetViewController : UIKit.UIViewController {
|
|
1161
1223
|
@_Concurrency.MainActor @preconcurrency final public var feedMask: ShortKitSDK.FeedMaskMode
|
|
1224
|
+
@_Concurrency.MainActor @preconcurrency final public var onCardTap: ((Swift.String, Swift.Int) -> Swift.Void)?
|
|
1162
1225
|
@_Concurrency.MainActor @preconcurrency public init(shortKit: ShortKitSDK.ShortKit, config: ShortKitSDK.WidgetConfig, items: [ShortKitSDK.WidgetInput] = [])
|
|
1163
1226
|
@_Concurrency.MainActor @preconcurrency final public func configure(with inputs: [ShortKitSDK.WidgetInput])
|
|
1164
1227
|
@_Concurrency.MainActor @preconcurrency @objc override final public func viewDidLoad()
|
|
@@ -1202,6 +1265,12 @@ extension ShortKitSDK.ScrollAxis : Swift.Hashable {}
|
|
|
1202
1265
|
extension ShortKitSDK.ScrollAxis : Swift.RawRepresentable {}
|
|
1203
1266
|
extension ShortKitSDK.FeedSource : Swift.Hashable {}
|
|
1204
1267
|
extension ShortKitSDK.FeedSource : Swift.RawRepresentable {}
|
|
1268
|
+
extension ShortKitSDK.DebugAlert.Level : Swift.Equatable {}
|
|
1269
|
+
extension ShortKitSDK.DebugAlert.Level : Swift.Hashable {}
|
|
1270
|
+
extension ShortKitSDK.DebugItemStatus : Swift.Equatable {}
|
|
1271
|
+
extension ShortKitSDK.DebugItemStatus : Swift.Hashable {}
|
|
1272
|
+
extension ShortKitSDK.DebugTimeControl : Swift.Equatable {}
|
|
1273
|
+
extension ShortKitSDK.DebugTimeControl : Swift.Hashable {}
|
|
1205
1274
|
extension ShortKitSDK.SwipeCurve : Swift.Equatable {}
|
|
1206
1275
|
extension ShortKitSDK.SwipeCurve : Swift.Hashable {}
|
|
1207
1276
|
extension ShortKitSDK.SwipeCurve : Swift.RawRepresentable {}
|
package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/ShortKitSDK
CHANGED
|
Binary file
|
|
@@ -10,39 +10,39 @@
|
|
|
10
10
|
</data>
|
|
11
11
|
<key>Info.plist</key>
|
|
12
12
|
<data>
|
|
13
|
-
|
|
13
|
+
PYkIcNDUEgyhTyEpFbDaCBPo+UE=
|
|
14
14
|
</data>
|
|
15
15
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
16
16
|
<data>
|
|
17
|
-
|
|
17
|
+
UaBdqrMhIeApH2d1RUSHIj0Zhu8=
|
|
18
18
|
</data>
|
|
19
19
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
20
20
|
<data>
|
|
21
|
-
|
|
21
|
+
8YGTcgWDbl8y4dDSIpll5eJ4obE=
|
|
22
22
|
</data>
|
|
23
23
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
24
24
|
<data>
|
|
25
|
-
|
|
25
|
+
lzX6ESVjVhhWPe6DxnX73NDmZxw=
|
|
26
26
|
</data>
|
|
27
27
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
28
28
|
<data>
|
|
29
|
-
|
|
29
|
+
8YGTcgWDbl8y4dDSIpll5eJ4obE=
|
|
30
30
|
</data>
|
|
31
31
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
32
32
|
<data>
|
|
33
|
-
|
|
33
|
+
UaBdqrMhIeApH2d1RUSHIj0Zhu8=
|
|
34
34
|
</data>
|
|
35
35
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
36
36
|
<data>
|
|
37
|
-
|
|
37
|
+
H7HRD+aObjI7xoUhzCeaCSiqjmk=
|
|
38
38
|
</data>
|
|
39
39
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
40
40
|
<data>
|
|
41
|
-
|
|
41
|
+
ggGgO2zWeWv56r6SC+RCZNJLMTE=
|
|
42
42
|
</data>
|
|
43
43
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
44
44
|
<data>
|
|
45
|
-
|
|
45
|
+
H7HRD+aObjI7xoUhzCeaCSiqjmk=
|
|
46
46
|
</data>
|
|
47
47
|
<key>Modules/module.modulemap</key>
|
|
48
48
|
<data>
|
|
@@ -66,56 +66,56 @@
|
|
|
66
66
|
<dict>
|
|
67
67
|
<key>hash2</key>
|
|
68
68
|
<data>
|
|
69
|
-
|
|
69
|
+
1d0XBLVpugO7SBVSLPAAz9em40Jjg3uSJDz2K7kZLt4=
|
|
70
70
|
</data>
|
|
71
71
|
</dict>
|
|
72
72
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
73
73
|
<dict>
|
|
74
74
|
<key>hash2</key>
|
|
75
75
|
<data>
|
|
76
|
-
|
|
76
|
+
3D6bnZQIYaJD/ZJLQcVC4KUbwNgvDl/iiBHyIFmY1u8=
|
|
77
77
|
</data>
|
|
78
78
|
</dict>
|
|
79
79
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
80
80
|
<dict>
|
|
81
81
|
<key>hash2</key>
|
|
82
82
|
<data>
|
|
83
|
-
|
|
83
|
+
CFHa4/rm1ZPInefpRBxbmuzlobIbnb847Q0i2xy1q9A=
|
|
84
84
|
</data>
|
|
85
85
|
</dict>
|
|
86
86
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
87
87
|
<dict>
|
|
88
88
|
<key>hash2</key>
|
|
89
89
|
<data>
|
|
90
|
-
|
|
90
|
+
3D6bnZQIYaJD/ZJLQcVC4KUbwNgvDl/iiBHyIFmY1u8=
|
|
91
91
|
</data>
|
|
92
92
|
</dict>
|
|
93
93
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
94
94
|
<dict>
|
|
95
95
|
<key>hash2</key>
|
|
96
96
|
<data>
|
|
97
|
-
|
|
97
|
+
1d0XBLVpugO7SBVSLPAAz9em40Jjg3uSJDz2K7kZLt4=
|
|
98
98
|
</data>
|
|
99
99
|
</dict>
|
|
100
100
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
101
101
|
<dict>
|
|
102
102
|
<key>hash2</key>
|
|
103
103
|
<data>
|
|
104
|
-
|
|
104
|
+
+RR1yKVxk7eM89sQaZV/Ks3KftiCvYiEXqvAWayvf/s=
|
|
105
105
|
</data>
|
|
106
106
|
</dict>
|
|
107
107
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
108
108
|
<dict>
|
|
109
109
|
<key>hash2</key>
|
|
110
110
|
<data>
|
|
111
|
-
|
|
111
|
+
ppdE9CD5J+SnQP9npRDKhbCFuonZyTCN1TcUzRTdPfg=
|
|
112
112
|
</data>
|
|
113
113
|
</dict>
|
|
114
114
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
115
115
|
<dict>
|
|
116
116
|
<key>hash2</key>
|
|
117
117
|
<data>
|
|
118
|
-
|
|
118
|
+
+RR1yKVxk7eM89sQaZV/Ks3KftiCvYiEXqvAWayvf/s=
|
|
119
119
|
</data>
|
|
120
120
|
</dict>
|
|
121
121
|
<key>Modules/module.modulemap</key>
|
|
@@ -25,6 +25,12 @@ import ShortKitSDK
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/// Stable per-instance widget identifier set by the JS wrapper. Echoed
|
|
29
|
+
/// back on `onWidgetCardTap` events so the JS wrapper can route the
|
|
30
|
+
/// global emit to the correct `<ShortKitWidget>` instance when more than
|
|
31
|
+
/// one is mounted simultaneously.
|
|
32
|
+
@objc public var widgetId: String?
|
|
33
|
+
|
|
28
34
|
// MARK: - Child VC
|
|
29
35
|
|
|
30
36
|
private var widgetVC: ShortKitWidgetViewController?
|
|
@@ -66,6 +72,23 @@ import ShortKitSDK
|
|
|
66
72
|
let vc = ShortKitWidgetViewController(shortKit: sdk, config: widgetConfig, items: parsedItems)
|
|
67
73
|
self.widgetVC = vc
|
|
68
74
|
|
|
75
|
+
// Wire host-handleable card-tap callback. When the JS wrapper has
|
|
76
|
+
// an `onCardTap` prop set, it'll have given us a widgetId; we forward
|
|
77
|
+
// each tap through the bridge with that widgetId so the JS wrapper
|
|
78
|
+
// can filter to its own instance. The SDK's widget VC, when it sees
|
|
79
|
+
// a non-nil onCardTap, automatically skips the built-in
|
|
80
|
+
// `clickAction: .feed` modal-presentation path (see
|
|
81
|
+
// ShortKitWidgetViewController docs) — host code is fully in charge.
|
|
82
|
+
if let id = widgetId {
|
|
83
|
+
vc.onCardTap = { playbackId, index in
|
|
84
|
+
ShortKitBridge.shared?.emitOnMain("onWidgetCardTap", body: [
|
|
85
|
+
"widgetId": id,
|
|
86
|
+
"playbackId": playbackId,
|
|
87
|
+
"index": index,
|
|
88
|
+
])
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
69
92
|
parentVC.addChild(vc)
|
|
70
93
|
vc.view.frame = bounds
|
|
71
94
|
vc.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
package/package.json
CHANGED
package/src/ShortKitFeed.tsx
CHANGED
|
@@ -47,6 +47,7 @@ export const ShortKitFeed = forwardRef<ShortKitFeedHandle, ShortKitFeedProps>(
|
|
|
47
47
|
onFeedReady,
|
|
48
48
|
onCarouselActiveVideoCompleted,
|
|
49
49
|
onVideoCarouselCellTap,
|
|
50
|
+
debugPanel,
|
|
50
51
|
} = props;
|
|
51
52
|
|
|
52
53
|
const isInitialized = useContext(ShortKitInitContext);
|
|
@@ -319,6 +320,7 @@ export const ShortKitFeed = forwardRef<ShortKitFeedHandle, ShortKitFeedProps>(
|
|
|
319
320
|
seedThumbnailUrl={seedThumbnailUrl}
|
|
320
321
|
feedItemsJSON={feedItemsJSON}
|
|
321
322
|
active={active}
|
|
323
|
+
debugPanel={debugPanel}
|
|
322
324
|
/>
|
|
323
325
|
</View>
|
|
324
326
|
);
|
package/src/ShortKitProvider.tsx
CHANGED
|
@@ -135,6 +135,8 @@ export function ShortKitProvider({
|
|
|
135
135
|
customDimensions,
|
|
136
136
|
loadingViewComponent,
|
|
137
137
|
debugPanel,
|
|
138
|
+
serverTracingEnabled,
|
|
139
|
+
consoleTracingEnabled,
|
|
138
140
|
children,
|
|
139
141
|
}: ShortKitProviderProps): React.JSX.Element {
|
|
140
142
|
const [state, dispatch] = useReducer(reducer, initialState);
|
|
@@ -161,6 +163,8 @@ export function ShortKitProvider({
|
|
|
161
163
|
clientAppVersion,
|
|
162
164
|
serializedDimensions,
|
|
163
165
|
debugPanel ?? false,
|
|
166
|
+
serverTracingEnabled ?? false,
|
|
167
|
+
consoleTracingEnabled ?? false,
|
|
164
168
|
);
|
|
165
169
|
|
|
166
170
|
return () => {
|
package/src/ShortKitWidget.tsx
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import React, { useContext, useLayoutEffect, useMemo } from 'react';
|
|
1
|
+
import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
3
|
import type { ShortKitWidgetProps } from './types';
|
|
4
4
|
import ShortKitWidgetView from './specs/ShortKitWidgetViewNativeComponent';
|
|
5
|
+
import NativeShortKitModule from './specs/NativeShortKitModule';
|
|
5
6
|
import { ShortKitInitContext } from './ShortKitContext';
|
|
6
7
|
import { serializeWidgetConfig } from './serialization';
|
|
7
8
|
import { registerOverlayComponent } from './ShortKitOverlaySurface';
|
|
8
9
|
import { registerCarouselOverlayComponent } from './ShortKitCarouselOverlaySurface';
|
|
9
10
|
import { registerVideoCarouselOverlayComponent } from './ShortKitVideoCarouselOverlaySurface';
|
|
10
11
|
|
|
12
|
+
// Local UUID generator. We don't pull in a runtime dep just for this; a
|
|
13
|
+
// timestamp + random suffix is more than unique enough to disambiguate
|
|
14
|
+
// concurrently-mounted widgets within a single app session.
|
|
15
|
+
function generateWidgetId(): string {
|
|
16
|
+
return `widget-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
/**
|
|
12
20
|
* Horizontal carousel widget component. Displays a row of video cards
|
|
13
21
|
* with automatic rotation. Wraps a native Fabric view.
|
|
@@ -15,13 +23,36 @@ import { registerVideoCarouselOverlayComponent } from './ShortKitVideoCarouselOv
|
|
|
15
23
|
* Must be rendered inside a `<ShortKitProvider>`.
|
|
16
24
|
*/
|
|
17
25
|
export function ShortKitWidget(props: ShortKitWidgetProps) {
|
|
18
|
-
const { config, items, style } = props;
|
|
26
|
+
const { config, items, onCardTap, style } = props;
|
|
19
27
|
|
|
20
28
|
const isInitialized = useContext(ShortKitInitContext);
|
|
21
29
|
if (!isInitialized) {
|
|
22
30
|
throw new Error('ShortKitWidget must be used within a ShortKitProvider');
|
|
23
31
|
}
|
|
24
32
|
|
|
33
|
+
// Stable widget ID for the lifetime of this component, ONLY when the host
|
|
34
|
+
// wires `onCardTap`. Skipping it when unset means the native side leaves
|
|
35
|
+
// `widgetVC.onCardTap` nil, which means the SDK's existing
|
|
36
|
+
// `clickAction: 'feed'` modal-presentation path stays intact for hosts
|
|
37
|
+
// that don't opt in. Backwards compatible.
|
|
38
|
+
const widgetId = useMemo(
|
|
39
|
+
() => (onCardTap ? generateWidgetId() : undefined),
|
|
40
|
+
// We deliberately compute this once per "host wired callback" lifetime,
|
|
41
|
+
// not per render. The boolean test on first render is what matters; if
|
|
42
|
+
// the host swaps onCardTap from set → unset later we keep the same
|
|
43
|
+
// widgetId (harmless — no events will fire because the JS subscription
|
|
44
|
+
// below tears down). Going the other way (unset → set), we generate a
|
|
45
|
+
// fresh id then.
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
[Boolean(onCardTap)],
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// Keep a stable ref to the latest onCardTap so the subscription doesn't
|
|
51
|
+
// need to tear down + rebuild every time the host re-renders with a new
|
|
52
|
+
// closure identity.
|
|
53
|
+
const onCardTapRef = useRef(onCardTap);
|
|
54
|
+
onCardTapRef.current = onCardTap;
|
|
55
|
+
|
|
25
56
|
useLayoutEffect(() => {
|
|
26
57
|
if (config?.overlay && config.overlay !== 'none') {
|
|
27
58
|
registerOverlayComponent(config.overlay.name, config.overlay.component);
|
|
@@ -40,6 +71,19 @@ export function ShortKitWidget(props: ShortKitWidgetProps) {
|
|
|
40
71
|
}
|
|
41
72
|
}, [config?.overlay, config?.feedConfig]);
|
|
42
73
|
|
|
74
|
+
// Subscribe to the global widget-card-tap event, filtered to this
|
|
75
|
+
// instance's widgetId.
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!NativeShortKitModule || !onCardTap) return;
|
|
78
|
+
|
|
79
|
+
const subscription = NativeShortKitModule.onWidgetCardTap((event) => {
|
|
80
|
+
if (event.widgetId !== widgetId) return;
|
|
81
|
+
onCardTapRef.current?.(event.playbackId, event.index);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return () => subscription.remove();
|
|
85
|
+
}, [widgetId, onCardTap]);
|
|
86
|
+
|
|
43
87
|
const serializedConfig = useMemo(() => {
|
|
44
88
|
return serializeWidgetConfig(config ?? {});
|
|
45
89
|
}, [config]);
|
|
@@ -55,6 +99,7 @@ export function ShortKitWidget(props: ShortKitWidgetProps) {
|
|
|
55
99
|
style={styles.widget}
|
|
56
100
|
config={serializedConfig}
|
|
57
101
|
items={serializedItems}
|
|
102
|
+
widgetId={widgetId}
|
|
58
103
|
/>
|
|
59
104
|
</View>
|
|
60
105
|
);
|
|
@@ -127,6 +127,12 @@ type VideoCarouselCellTapEvent = Readonly<{
|
|
|
127
127
|
pageIndex: Int32;
|
|
128
128
|
}>;
|
|
129
129
|
|
|
130
|
+
type WidgetCardTapEvent = Readonly<{
|
|
131
|
+
widgetId: string;
|
|
132
|
+
playbackId: string;
|
|
133
|
+
index: Int32;
|
|
134
|
+
}>;
|
|
135
|
+
|
|
130
136
|
type DownloadStartedEvent = Readonly<{
|
|
131
137
|
itemId: string;
|
|
132
138
|
}>;
|
|
@@ -260,6 +266,8 @@ export interface Spec extends TurboModule {
|
|
|
260
266
|
clientAppVersion?: string,
|
|
261
267
|
customDimensions?: string, // JSON-serialized Record<string, string>
|
|
262
268
|
debugPanel?: boolean,
|
|
269
|
+
serverTracingEnabled?: boolean,
|
|
270
|
+
consoleTracingEnabled?: boolean,
|
|
263
271
|
): void;
|
|
264
272
|
setUserId(userId: string): void;
|
|
265
273
|
clearUserId(): void;
|
|
@@ -327,6 +335,7 @@ export interface Spec extends TurboModule {
|
|
|
327
335
|
readonly onDidFetchContentItems: EventEmitter<DidFetchContentItemsEvent>;
|
|
328
336
|
readonly onFeedReady: EventEmitter<FeedReadyEvent>;
|
|
329
337
|
readonly onVideoCarouselCellTap: EventEmitter<VideoCarouselCellTapEvent>;
|
|
338
|
+
readonly onWidgetCardTap: EventEmitter<WidgetCardTapEvent>;
|
|
330
339
|
|
|
331
340
|
// --- Overlay per-surface events ---
|
|
332
341
|
readonly onOverlayActiveChanged: EventEmitter<OverlayActiveEvent>;
|
|
@@ -17,6 +17,11 @@ export interface NativeProps extends ViewProps {
|
|
|
17
17
|
/** JSON-serialized FeedInput[] for initial custom-feed items at mount time. */
|
|
18
18
|
feedItemsJSON?: string;
|
|
19
19
|
active?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Per-surface debug panel override. When unset, the provider-level
|
|
22
|
+
* `debugPanel` flag governs. When set, overrides for this feed instance.
|
|
23
|
+
*/
|
|
24
|
+
debugPanel?: boolean;
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
export default codegenNativeComponent<NativeProps>(
|
|
@@ -4,6 +4,12 @@ import { codegenNativeComponent } from 'react-native';
|
|
|
4
4
|
export interface NativeProps extends ViewProps {
|
|
5
5
|
config: string;
|
|
6
6
|
items?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Stable per-instance widget identifier. Used to route the global
|
|
9
|
+
* `NativeShortKitModule.onWidgetCardTap` event back to the originating
|
|
10
|
+
* `<ShortKitWidget>` when multiple widgets are mounted.
|
|
11
|
+
*/
|
|
12
|
+
widgetId?: string;
|
|
7
13
|
}
|
|
8
14
|
|
|
9
15
|
export default codegenNativeComponent<NativeProps>(
|