@shortkitsdk/react-native 0.2.24 → 0.2.25
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/README.md +151 -0
- package/android/libs/shortkit-release.aar +0 -0
- package/android/src/main/java/com/shortkit/reactnative/ReactOverlayHost.kt +19 -1
- package/android/src/main/java/com/shortkit/reactnative/ShortKitModule.kt +43 -0
- package/ios/ReactCarouselOverlayHost.swift +51 -3
- package/ios/ReactOverlayHost.swift +67 -7
- package/ios/ReactVideoCarouselOverlayHost.swift +181 -19
- package/ios/SKFabricSurfaceWrapper.mm +7 -1
- package/ios/ShortKitBridge.swift +43 -1
- package/ios/ShortKitFeedView.swift +20 -0
- package/ios/ShortKitFeedViewManager.mm +1 -0
- package/ios/ShortKitModule.mm +33 -0
- 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 +3590 -382
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +104 -5
- 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 +104 -5
- 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 +3590 -382
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +104 -5
- 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 +104 -5
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +3590 -382
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +104 -5
- 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 +104 -5
- 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/package.json +1 -1
- package/src/ShortKitCarouselOverlaySurface.tsx +38 -10
- package/src/ShortKitCommands.ts +4 -0
- package/src/ShortKitFeed.tsx +23 -7
- package/src/ShortKitOverlaySurface.tsx +59 -23
- package/src/ShortKitVideoCarouselOverlaySurface.tsx +51 -5
- package/src/index.ts +2 -0
- package/src/serialization.ts +37 -1
- package/src/specs/NativeShortKitModule.ts +51 -2
- package/src/specs/ShortKitFeedViewNativeComponent.ts +8 -0
- package/src/types.ts +27 -1
- package/src/useShortKitCarousel.ts +80 -0
|
@@ -162,6 +162,43 @@ final public class SegmentPrefetcher : ShortKitSDK.SegmentPrefetcherProtocol {
|
|
|
162
162
|
final public func resume()
|
|
163
163
|
@objc deinit
|
|
164
164
|
}
|
|
165
|
+
public struct CarouselCompletionEvent : Swift.Equatable, Swift.Sendable {
|
|
166
|
+
public let contentItem: ShortKitSDK.ContentItem
|
|
167
|
+
public let indexInCarousel: Swift.Int
|
|
168
|
+
public let carouselItem: ShortKitSDK.VideoCarouselItem
|
|
169
|
+
public let wasLast: Swift.Bool
|
|
170
|
+
public let willAutoAdvance: Swift.Bool
|
|
171
|
+
public init(contentItem: ShortKitSDK.ContentItem, indexInCarousel: Swift.Int, carouselItem: ShortKitSDK.VideoCarouselItem, wasLast: Swift.Bool, willAutoAdvance: Swift.Bool)
|
|
172
|
+
public static func == (a: ShortKitSDK.CarouselCompletionEvent, b: ShortKitSDK.CarouselCompletionEvent) -> Swift.Bool
|
|
173
|
+
}
|
|
174
|
+
final public class ShortKitCarousel {
|
|
175
|
+
public init()
|
|
176
|
+
@discardableResult
|
|
177
|
+
final public func next() -> Swift.Bool
|
|
178
|
+
@discardableResult
|
|
179
|
+
final public func previous() -> Swift.Bool
|
|
180
|
+
@discardableResult
|
|
181
|
+
final public func setActiveIndex(_ index: Swift.Int) -> Swift.Bool
|
|
182
|
+
final public var activeIndexValue: Swift.Int? {
|
|
183
|
+
get
|
|
184
|
+
}
|
|
185
|
+
final public var videoCountValue: Swift.Int? {
|
|
186
|
+
get
|
|
187
|
+
}
|
|
188
|
+
final public var activeCarouselItemValue: ShortKitSDK.VideoCarouselItem? {
|
|
189
|
+
get
|
|
190
|
+
}
|
|
191
|
+
final public var activeIndex: Combine.AnyPublisher<Swift.Int?, Swift.Never> {
|
|
192
|
+
get
|
|
193
|
+
}
|
|
194
|
+
final public var activeCarouselChanged: Combine.AnyPublisher<ShortKitSDK.VideoCarouselItem?, Swift.Never> {
|
|
195
|
+
get
|
|
196
|
+
}
|
|
197
|
+
final public var activeVideoCompleted: Combine.AnyPublisher<ShortKitSDK.CarouselCompletionEvent, Swift.Never> {
|
|
198
|
+
get
|
|
199
|
+
}
|
|
200
|
+
@objc deinit
|
|
201
|
+
}
|
|
165
202
|
public enum FeedHeight : Swift.Codable, Swift.Equatable, Swift.Sendable {
|
|
166
203
|
case fullscreen
|
|
167
204
|
case percentage(CoreFoundation.CGFloat)
|
|
@@ -206,6 +243,7 @@ public struct FeedConfig : Swift.Codable {
|
|
|
206
243
|
public var videoCarouselOverlay: ShortKitSDK.VideoCarouselOverlayMode
|
|
207
244
|
public var surveyOverlay: ShortKitSDK.SurveyOverlayMode
|
|
208
245
|
public var adOverlay: ShortKitSDK.AdOverlayMode
|
|
246
|
+
public var liveOverlay: ShortKitSDK.LiveOverlayMode
|
|
209
247
|
public var muteOnStart: Swift.Bool
|
|
210
248
|
public var autoplay: Swift.Bool
|
|
211
249
|
public var feedSource: ShortKitSDK.FeedSource
|
|
@@ -213,7 +251,7 @@ public struct FeedConfig : Swift.Codable {
|
|
|
213
251
|
public var pullToRefreshEnabled: Swift.Bool
|
|
214
252
|
public var filter: ShortKitSDK.FeedFilter?
|
|
215
253
|
public var preload: ShortKitSDK.FeedPreload?
|
|
216
|
-
public init(feedHeight: ShortKitSDK.FeedHeight = .fullscreen, scrollAxis: ShortKitSDK.ScrollAxis = .vertical, videoOverlay: ShortKitSDK.VideoOverlayMode = .none, carouselOverlay: ShortKitSDK.CarouselOverlayMode = .none, videoCarouselOverlay: ShortKitSDK.VideoCarouselOverlayMode = .none, surveyOverlay: ShortKitSDK.SurveyOverlayMode = .none, adOverlay: ShortKitSDK.AdOverlayMode = .none, muteOnStart: Swift.Bool = true, autoplay: Swift.Bool = true, feedSource: ShortKitSDK.FeedSource = .algorithmic, coldStartEnabled: Swift.Bool = false, pullToRefreshEnabled: Swift.Bool = true, filter: ShortKitSDK.FeedFilter? = nil, preload: ShortKitSDK.FeedPreload? = nil)
|
|
254
|
+
public init(feedHeight: ShortKitSDK.FeedHeight = .fullscreen, scrollAxis: ShortKitSDK.ScrollAxis = .vertical, videoOverlay: ShortKitSDK.VideoOverlayMode = .none, carouselOverlay: ShortKitSDK.CarouselOverlayMode = .none, videoCarouselOverlay: ShortKitSDK.VideoCarouselOverlayMode = .none, surveyOverlay: ShortKitSDK.SurveyOverlayMode = .none, adOverlay: ShortKitSDK.AdOverlayMode = .none, liveOverlay: ShortKitSDK.LiveOverlayMode = .default, muteOnStart: Swift.Bool = true, autoplay: Swift.Bool = true, feedSource: ShortKitSDK.FeedSource = .algorithmic, coldStartEnabled: Swift.Bool = false, pullToRefreshEnabled: Swift.Bool = true, filter: ShortKitSDK.FeedFilter? = nil, preload: ShortKitSDK.FeedPreload? = nil)
|
|
217
255
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
218
256
|
public init(from decoder: any Swift.Decoder) throws
|
|
219
257
|
}
|
|
@@ -282,6 +320,21 @@ extension ShortKitSDK.AdOverlayMode : Swift.Codable {
|
|
|
282
320
|
public init(from decoder: any Swift.Decoder) throws
|
|
283
321
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
284
322
|
}
|
|
323
|
+
public enum LiveOverlayMode {
|
|
324
|
+
case none
|
|
325
|
+
case `default`
|
|
326
|
+
case custom(@Sendable () -> any UIKit.UIView & ShortKitSDK.LiveOverlay)
|
|
327
|
+
}
|
|
328
|
+
extension ShortKitSDK.LiveOverlayMode {
|
|
329
|
+
public static func swiftUI<Content>(@SwiftUICore.ViewBuilder content: @escaping @Sendable (ShortKitSDK.ShortKitPlayer) -> Content) -> ShortKitSDK.LiveOverlayMode where Content : SwiftUICore.View
|
|
330
|
+
}
|
|
331
|
+
extension ShortKitSDK.LiveOverlayMode : Swift.Equatable {
|
|
332
|
+
public static func == (lhs: ShortKitSDK.LiveOverlayMode, rhs: ShortKitSDK.LiveOverlayMode) -> Swift.Bool
|
|
333
|
+
}
|
|
334
|
+
extension ShortKitSDK.LiveOverlayMode : Swift.Codable {
|
|
335
|
+
public init(from decoder: any Swift.Decoder) throws
|
|
336
|
+
public func encode(to encoder: any Swift.Encoder) throws
|
|
337
|
+
}
|
|
285
338
|
public struct DebugMetrics {
|
|
286
339
|
public var contentId: Swift.String?
|
|
287
340
|
public var feedIndex: Swift.Int
|
|
@@ -385,6 +438,7 @@ public enum ShortKitDownloadError : Swift.Error {
|
|
|
385
438
|
@_Concurrency.MainActor @preconcurrency public var onDismiss: (() -> Swift.Void)?
|
|
386
439
|
@_Concurrency.MainActor @preconcurrency public var onRemainingContentCountChange: ((Swift.Int) -> Swift.Void)?
|
|
387
440
|
@_Concurrency.MainActor @preconcurrency public var onFeedReady: (() -> Swift.Void)?
|
|
441
|
+
@_Concurrency.MainActor @preconcurrency public var seedThumbnail: UIKit.UIImage?
|
|
388
442
|
@_Concurrency.MainActor @preconcurrency public init(shortKit: ShortKitSDK.ShortKit, config: ShortKitSDK.FeedConfig, startAtItemId: Swift.String? = nil)
|
|
389
443
|
@_Concurrency.MainActor public func setFeedItems(_ items: [ShortKitSDK.FeedInput])
|
|
390
444
|
@_Concurrency.MainActor public func appendFeedItems(_ items: [ShortKitSDK.FeedInput])
|
|
@@ -427,6 +481,9 @@ extension ShortKitSDK.ShortKitFeedViewController : ShortKitSDK.ShortKitAdDelegat
|
|
|
427
481
|
@_Concurrency.MainActor @preconcurrency public func adDidFail(_ ad: ShortKitSDK.PreparedAd, error: ShortKitSDK.AdError)
|
|
428
482
|
@_Concurrency.MainActor @preconcurrency public func adDidReceiveClick(_ ad: ShortKitSDK.PreparedAd)
|
|
429
483
|
}
|
|
484
|
+
public enum SeedThumbnailResolver {
|
|
485
|
+
public static func resolveFromMemory(url: Swift.String) -> UIKit.UIImage?
|
|
486
|
+
}
|
|
430
487
|
public enum ShortKitRefreshState : Swift.Sendable {
|
|
431
488
|
case idle
|
|
432
489
|
case pulling(progress: CoreFoundation.CGFloat)
|
|
@@ -491,6 +548,16 @@ public struct CaptionTrack : Swift.Codable, Swift.Equatable, Swift.Sendable {
|
|
|
491
548
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
492
549
|
public init(from decoder: any Swift.Decoder) throws
|
|
493
550
|
}
|
|
551
|
+
public enum LiveStreamStatus : Swift.String, Swift.Codable, Swift.Equatable, Swift.Sendable {
|
|
552
|
+
case idle
|
|
553
|
+
case active
|
|
554
|
+
case ended
|
|
555
|
+
public init?(rawValue: Swift.String)
|
|
556
|
+
public typealias RawValue = Swift.String
|
|
557
|
+
public var rawValue: Swift.String {
|
|
558
|
+
get
|
|
559
|
+
}
|
|
560
|
+
}
|
|
494
561
|
public struct ContentItem : Swift.Codable, Swift.Equatable, @unchecked Swift.Sendable {
|
|
495
562
|
public let id: Swift.String
|
|
496
563
|
public var playbackId: Swift.String?
|
|
@@ -508,20 +575,35 @@ public struct ContentItem : Swift.Codable, Swift.Equatable, @unchecked Swift.Sen
|
|
|
508
575
|
public let commentCount: Swift.Int?
|
|
509
576
|
public var fallbackUrl: Swift.String?
|
|
510
577
|
public var downloadUrl: Swift.String?
|
|
511
|
-
public
|
|
578
|
+
public var isLive: Swift.Bool
|
|
579
|
+
public var liveStreamId: Swift.String?
|
|
580
|
+
public var liveStreamStatus: ShortKitSDK.LiveStreamStatus?
|
|
581
|
+
public var startedAt: Swift.String?
|
|
582
|
+
public init(id: Swift.String, playbackId: Swift.String? = nil, title: Swift.String, description: Swift.String? = nil, duration: Swift.Double, streamingUrl: Swift.String, thumbnailUrl: Swift.String, captionTracks: [ShortKitSDK.CaptionTrack] = [], customMetadata: [Swift.String : ShortKitSDK.JSONValue]? = nil, author: Swift.String? = nil, articleUrl: Swift.String? = nil, commentCount: Swift.Int? = nil, fallbackUrl: Swift.String? = nil, downloadUrl: Swift.String? = nil, isLive: Swift.Bool = false, liveStreamId: Swift.String? = nil, liveStreamStatus: ShortKitSDK.LiveStreamStatus? = nil, startedAt: Swift.String? = nil)
|
|
583
|
+
public init(from decoder: any Swift.Decoder) throws
|
|
512
584
|
public static func == (a: ShortKitSDK.ContentItem, b: ShortKitSDK.ContentItem) -> Swift.Bool
|
|
513
585
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
514
|
-
public init(from decoder: any Swift.Decoder) throws
|
|
515
586
|
}
|
|
516
587
|
extension ShortKitSDK.ContentItem {
|
|
517
588
|
public var isDownloadable: Swift.Bool {
|
|
518
589
|
get
|
|
519
590
|
}
|
|
520
591
|
}
|
|
592
|
+
public enum ContentOrigin : Swift.String, Swift.Codable, Swift.Sendable {
|
|
593
|
+
case iosUpload
|
|
594
|
+
case other
|
|
595
|
+
public init?(rawValue: Swift.String)
|
|
596
|
+
public typealias RawValue = Swift.String
|
|
597
|
+
public var rawValue: Swift.String {
|
|
598
|
+
get
|
|
599
|
+
}
|
|
600
|
+
}
|
|
521
601
|
public enum FeedInput : Swift.Sendable {
|
|
522
|
-
case video(playbackId: Swift.String, fallbackUrl: Swift.String? = nil)
|
|
602
|
+
case video(playbackId: Swift.String, origin: ShortKitSDK.ContentOrigin = .other, fallbackUrl: Swift.String? = nil)
|
|
603
|
+
case liveStream(playbackId: Swift.String)
|
|
523
604
|
case imageCarousel(ShortKitSDK.ImageCarouselItem)
|
|
524
605
|
case videoCarousel(ShortKitSDK.VideoCarouselInput)
|
|
606
|
+
case videoCarouselItem(ShortKitSDK.VideoCarouselItem)
|
|
525
607
|
}
|
|
526
608
|
public enum FeedItem : Swift.Sendable {
|
|
527
609
|
case content(ShortKitSDK.ContentItem)
|
|
@@ -693,8 +775,9 @@ public struct VideoCarouselItem : Swift.Codable, Swift.Equatable, Swift.Sendable
|
|
|
693
775
|
}
|
|
694
776
|
public struct VideoCarouselVideoInput : Swift.Codable, Swift.Equatable, Swift.Sendable {
|
|
695
777
|
public let playbackId: Swift.String
|
|
778
|
+
public let origin: ShortKitSDK.ContentOrigin
|
|
696
779
|
public let fallbackUrl: Swift.String?
|
|
697
|
-
public init(playbackId: Swift.String, fallbackUrl: Swift.String? = nil)
|
|
780
|
+
public init(playbackId: Swift.String, origin: ShortKitSDK.ContentOrigin = .other, fallbackUrl: Swift.String? = nil)
|
|
698
781
|
public static func == (a: ShortKitSDK.VideoCarouselVideoInput, b: ShortKitSDK.VideoCarouselVideoInput) -> Swift.Bool
|
|
699
782
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
700
783
|
public init(from decoder: any Swift.Decoder) throws
|
|
@@ -752,6 +835,16 @@ public protocol FeedOverlay : AnyObject {
|
|
|
752
835
|
func configure(with item: ShortKitSDK.ContentItem)
|
|
753
836
|
func activatePlayback()
|
|
754
837
|
}
|
|
838
|
+
public protocol LiveOverlay : AnyObject {
|
|
839
|
+
func attach(player: ShortKitSDK.ShortKitPlayer)
|
|
840
|
+
func configure(with item: ShortKitSDK.ContentItem)
|
|
841
|
+
func activate()
|
|
842
|
+
func deactivate()
|
|
843
|
+
func showEnded()
|
|
844
|
+
}
|
|
845
|
+
extension ShortKitSDK.LiveOverlay {
|
|
846
|
+
public func showEnded()
|
|
847
|
+
}
|
|
755
848
|
public protocol SurveyOverlay : AnyObject {
|
|
756
849
|
var onSurveyResponse: ((Swift.String, ShortKitSDK.SurveyOption) -> Swift.Void)? { get set }
|
|
757
850
|
var onAutoAdvance: (() -> Swift.Void)? { get set }
|
|
@@ -940,6 +1033,7 @@ public enum ShortKitVersion {
|
|
|
940
1033
|
}
|
|
941
1034
|
final public class ShortKit {
|
|
942
1035
|
final public let player: ShortKitSDK.ShortKitPlayer
|
|
1036
|
+
final public let carousel: ShortKitSDK.ShortKitCarousel
|
|
943
1037
|
final public let debugPanelEnabled: Swift.Bool
|
|
944
1038
|
weak final public var delegate: (any ShortKitSDK.ShortKitDelegate)?
|
|
945
1039
|
weak final public var downloadDelegate: (any ShortKitSDK.ShortKitDownloadDelegate)?
|
|
@@ -1051,6 +1145,11 @@ extension ShortKitSDK.ShortKitFeedView : Swift.Sendable {}
|
|
|
1051
1145
|
extension ShortKitSDK.CaptionSource : Swift.Equatable {}
|
|
1052
1146
|
extension ShortKitSDK.CaptionSource : Swift.Hashable {}
|
|
1053
1147
|
extension ShortKitSDK.CaptionSource : Swift.RawRepresentable {}
|
|
1148
|
+
extension ShortKitSDK.LiveStreamStatus : Swift.Hashable {}
|
|
1149
|
+
extension ShortKitSDK.LiveStreamStatus : Swift.RawRepresentable {}
|
|
1150
|
+
extension ShortKitSDK.ContentOrigin : Swift.Equatable {}
|
|
1151
|
+
extension ShortKitSDK.ContentOrigin : Swift.Hashable {}
|
|
1152
|
+
extension ShortKitSDK.ContentOrigin : Swift.RawRepresentable {}
|
|
1054
1153
|
extension ShortKitSDK.FeedTransitionEvent.Phase : Swift.Equatable {}
|
|
1055
1154
|
extension ShortKitSDK.FeedTransitionEvent.Phase : Swift.Hashable {}
|
|
1056
1155
|
extension ShortKitSDK.FeedTransitionEvent.Direction : Swift.Equatable {}
|
|
Binary file
|
|
@@ -162,6 +162,43 @@ final public class SegmentPrefetcher : ShortKitSDK.SegmentPrefetcherProtocol {
|
|
|
162
162
|
final public func resume()
|
|
163
163
|
@objc deinit
|
|
164
164
|
}
|
|
165
|
+
public struct CarouselCompletionEvent : Swift.Equatable, Swift.Sendable {
|
|
166
|
+
public let contentItem: ShortKitSDK.ContentItem
|
|
167
|
+
public let indexInCarousel: Swift.Int
|
|
168
|
+
public let carouselItem: ShortKitSDK.VideoCarouselItem
|
|
169
|
+
public let wasLast: Swift.Bool
|
|
170
|
+
public let willAutoAdvance: Swift.Bool
|
|
171
|
+
public init(contentItem: ShortKitSDK.ContentItem, indexInCarousel: Swift.Int, carouselItem: ShortKitSDK.VideoCarouselItem, wasLast: Swift.Bool, willAutoAdvance: Swift.Bool)
|
|
172
|
+
public static func == (a: ShortKitSDK.CarouselCompletionEvent, b: ShortKitSDK.CarouselCompletionEvent) -> Swift.Bool
|
|
173
|
+
}
|
|
174
|
+
final public class ShortKitCarousel {
|
|
175
|
+
public init()
|
|
176
|
+
@discardableResult
|
|
177
|
+
final public func next() -> Swift.Bool
|
|
178
|
+
@discardableResult
|
|
179
|
+
final public func previous() -> Swift.Bool
|
|
180
|
+
@discardableResult
|
|
181
|
+
final public func setActiveIndex(_ index: Swift.Int) -> Swift.Bool
|
|
182
|
+
final public var activeIndexValue: Swift.Int? {
|
|
183
|
+
get
|
|
184
|
+
}
|
|
185
|
+
final public var videoCountValue: Swift.Int? {
|
|
186
|
+
get
|
|
187
|
+
}
|
|
188
|
+
final public var activeCarouselItemValue: ShortKitSDK.VideoCarouselItem? {
|
|
189
|
+
get
|
|
190
|
+
}
|
|
191
|
+
final public var activeIndex: Combine.AnyPublisher<Swift.Int?, Swift.Never> {
|
|
192
|
+
get
|
|
193
|
+
}
|
|
194
|
+
final public var activeCarouselChanged: Combine.AnyPublisher<ShortKitSDK.VideoCarouselItem?, Swift.Never> {
|
|
195
|
+
get
|
|
196
|
+
}
|
|
197
|
+
final public var activeVideoCompleted: Combine.AnyPublisher<ShortKitSDK.CarouselCompletionEvent, Swift.Never> {
|
|
198
|
+
get
|
|
199
|
+
}
|
|
200
|
+
@objc deinit
|
|
201
|
+
}
|
|
165
202
|
public enum FeedHeight : Swift.Codable, Swift.Equatable, Swift.Sendable {
|
|
166
203
|
case fullscreen
|
|
167
204
|
case percentage(CoreFoundation.CGFloat)
|
|
@@ -206,6 +243,7 @@ public struct FeedConfig : Swift.Codable {
|
|
|
206
243
|
public var videoCarouselOverlay: ShortKitSDK.VideoCarouselOverlayMode
|
|
207
244
|
public var surveyOverlay: ShortKitSDK.SurveyOverlayMode
|
|
208
245
|
public var adOverlay: ShortKitSDK.AdOverlayMode
|
|
246
|
+
public var liveOverlay: ShortKitSDK.LiveOverlayMode
|
|
209
247
|
public var muteOnStart: Swift.Bool
|
|
210
248
|
public var autoplay: Swift.Bool
|
|
211
249
|
public var feedSource: ShortKitSDK.FeedSource
|
|
@@ -213,7 +251,7 @@ public struct FeedConfig : Swift.Codable {
|
|
|
213
251
|
public var pullToRefreshEnabled: Swift.Bool
|
|
214
252
|
public var filter: ShortKitSDK.FeedFilter?
|
|
215
253
|
public var preload: ShortKitSDK.FeedPreload?
|
|
216
|
-
public init(feedHeight: ShortKitSDK.FeedHeight = .fullscreen, scrollAxis: ShortKitSDK.ScrollAxis = .vertical, videoOverlay: ShortKitSDK.VideoOverlayMode = .none, carouselOverlay: ShortKitSDK.CarouselOverlayMode = .none, videoCarouselOverlay: ShortKitSDK.VideoCarouselOverlayMode = .none, surveyOverlay: ShortKitSDK.SurveyOverlayMode = .none, adOverlay: ShortKitSDK.AdOverlayMode = .none, muteOnStart: Swift.Bool = true, autoplay: Swift.Bool = true, feedSource: ShortKitSDK.FeedSource = .algorithmic, coldStartEnabled: Swift.Bool = false, pullToRefreshEnabled: Swift.Bool = true, filter: ShortKitSDK.FeedFilter? = nil, preload: ShortKitSDK.FeedPreload? = nil)
|
|
254
|
+
public init(feedHeight: ShortKitSDK.FeedHeight = .fullscreen, scrollAxis: ShortKitSDK.ScrollAxis = .vertical, videoOverlay: ShortKitSDK.VideoOverlayMode = .none, carouselOverlay: ShortKitSDK.CarouselOverlayMode = .none, videoCarouselOverlay: ShortKitSDK.VideoCarouselOverlayMode = .none, surveyOverlay: ShortKitSDK.SurveyOverlayMode = .none, adOverlay: ShortKitSDK.AdOverlayMode = .none, liveOverlay: ShortKitSDK.LiveOverlayMode = .default, muteOnStart: Swift.Bool = true, autoplay: Swift.Bool = true, feedSource: ShortKitSDK.FeedSource = .algorithmic, coldStartEnabled: Swift.Bool = false, pullToRefreshEnabled: Swift.Bool = true, filter: ShortKitSDK.FeedFilter? = nil, preload: ShortKitSDK.FeedPreload? = nil)
|
|
217
255
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
218
256
|
public init(from decoder: any Swift.Decoder) throws
|
|
219
257
|
}
|
|
@@ -282,6 +320,21 @@ extension ShortKitSDK.AdOverlayMode : Swift.Codable {
|
|
|
282
320
|
public init(from decoder: any Swift.Decoder) throws
|
|
283
321
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
284
322
|
}
|
|
323
|
+
public enum LiveOverlayMode {
|
|
324
|
+
case none
|
|
325
|
+
case `default`
|
|
326
|
+
case custom(@Sendable () -> any UIKit.UIView & ShortKitSDK.LiveOverlay)
|
|
327
|
+
}
|
|
328
|
+
extension ShortKitSDK.LiveOverlayMode {
|
|
329
|
+
public static func swiftUI<Content>(@SwiftUICore.ViewBuilder content: @escaping @Sendable (ShortKitSDK.ShortKitPlayer) -> Content) -> ShortKitSDK.LiveOverlayMode where Content : SwiftUICore.View
|
|
330
|
+
}
|
|
331
|
+
extension ShortKitSDK.LiveOverlayMode : Swift.Equatable {
|
|
332
|
+
public static func == (lhs: ShortKitSDK.LiveOverlayMode, rhs: ShortKitSDK.LiveOverlayMode) -> Swift.Bool
|
|
333
|
+
}
|
|
334
|
+
extension ShortKitSDK.LiveOverlayMode : Swift.Codable {
|
|
335
|
+
public init(from decoder: any Swift.Decoder) throws
|
|
336
|
+
public func encode(to encoder: any Swift.Encoder) throws
|
|
337
|
+
}
|
|
285
338
|
public struct DebugMetrics {
|
|
286
339
|
public var contentId: Swift.String?
|
|
287
340
|
public var feedIndex: Swift.Int
|
|
@@ -385,6 +438,7 @@ public enum ShortKitDownloadError : Swift.Error {
|
|
|
385
438
|
@_Concurrency.MainActor @preconcurrency public var onDismiss: (() -> Swift.Void)?
|
|
386
439
|
@_Concurrency.MainActor @preconcurrency public var onRemainingContentCountChange: ((Swift.Int) -> Swift.Void)?
|
|
387
440
|
@_Concurrency.MainActor @preconcurrency public var onFeedReady: (() -> Swift.Void)?
|
|
441
|
+
@_Concurrency.MainActor @preconcurrency public var seedThumbnail: UIKit.UIImage?
|
|
388
442
|
@_Concurrency.MainActor @preconcurrency public init(shortKit: ShortKitSDK.ShortKit, config: ShortKitSDK.FeedConfig, startAtItemId: Swift.String? = nil)
|
|
389
443
|
@_Concurrency.MainActor public func setFeedItems(_ items: [ShortKitSDK.FeedInput])
|
|
390
444
|
@_Concurrency.MainActor public func appendFeedItems(_ items: [ShortKitSDK.FeedInput])
|
|
@@ -427,6 +481,9 @@ extension ShortKitSDK.ShortKitFeedViewController : ShortKitSDK.ShortKitAdDelegat
|
|
|
427
481
|
@_Concurrency.MainActor @preconcurrency public func adDidFail(_ ad: ShortKitSDK.PreparedAd, error: ShortKitSDK.AdError)
|
|
428
482
|
@_Concurrency.MainActor @preconcurrency public func adDidReceiveClick(_ ad: ShortKitSDK.PreparedAd)
|
|
429
483
|
}
|
|
484
|
+
public enum SeedThumbnailResolver {
|
|
485
|
+
public static func resolveFromMemory(url: Swift.String) -> UIKit.UIImage?
|
|
486
|
+
}
|
|
430
487
|
public enum ShortKitRefreshState : Swift.Sendable {
|
|
431
488
|
case idle
|
|
432
489
|
case pulling(progress: CoreFoundation.CGFloat)
|
|
@@ -491,6 +548,16 @@ public struct CaptionTrack : Swift.Codable, Swift.Equatable, Swift.Sendable {
|
|
|
491
548
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
492
549
|
public init(from decoder: any Swift.Decoder) throws
|
|
493
550
|
}
|
|
551
|
+
public enum LiveStreamStatus : Swift.String, Swift.Codable, Swift.Equatable, Swift.Sendable {
|
|
552
|
+
case idle
|
|
553
|
+
case active
|
|
554
|
+
case ended
|
|
555
|
+
public init?(rawValue: Swift.String)
|
|
556
|
+
public typealias RawValue = Swift.String
|
|
557
|
+
public var rawValue: Swift.String {
|
|
558
|
+
get
|
|
559
|
+
}
|
|
560
|
+
}
|
|
494
561
|
public struct ContentItem : Swift.Codable, Swift.Equatable, @unchecked Swift.Sendable {
|
|
495
562
|
public let id: Swift.String
|
|
496
563
|
public var playbackId: Swift.String?
|
|
@@ -508,20 +575,35 @@ public struct ContentItem : Swift.Codable, Swift.Equatable, @unchecked Swift.Sen
|
|
|
508
575
|
public let commentCount: Swift.Int?
|
|
509
576
|
public var fallbackUrl: Swift.String?
|
|
510
577
|
public var downloadUrl: Swift.String?
|
|
511
|
-
public
|
|
578
|
+
public var isLive: Swift.Bool
|
|
579
|
+
public var liveStreamId: Swift.String?
|
|
580
|
+
public var liveStreamStatus: ShortKitSDK.LiveStreamStatus?
|
|
581
|
+
public var startedAt: Swift.String?
|
|
582
|
+
public init(id: Swift.String, playbackId: Swift.String? = nil, title: Swift.String, description: Swift.String? = nil, duration: Swift.Double, streamingUrl: Swift.String, thumbnailUrl: Swift.String, captionTracks: [ShortKitSDK.CaptionTrack] = [], customMetadata: [Swift.String : ShortKitSDK.JSONValue]? = nil, author: Swift.String? = nil, articleUrl: Swift.String? = nil, commentCount: Swift.Int? = nil, fallbackUrl: Swift.String? = nil, downloadUrl: Swift.String? = nil, isLive: Swift.Bool = false, liveStreamId: Swift.String? = nil, liveStreamStatus: ShortKitSDK.LiveStreamStatus? = nil, startedAt: Swift.String? = nil)
|
|
583
|
+
public init(from decoder: any Swift.Decoder) throws
|
|
512
584
|
public static func == (a: ShortKitSDK.ContentItem, b: ShortKitSDK.ContentItem) -> Swift.Bool
|
|
513
585
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
514
|
-
public init(from decoder: any Swift.Decoder) throws
|
|
515
586
|
}
|
|
516
587
|
extension ShortKitSDK.ContentItem {
|
|
517
588
|
public var isDownloadable: Swift.Bool {
|
|
518
589
|
get
|
|
519
590
|
}
|
|
520
591
|
}
|
|
592
|
+
public enum ContentOrigin : Swift.String, Swift.Codable, Swift.Sendable {
|
|
593
|
+
case iosUpload
|
|
594
|
+
case other
|
|
595
|
+
public init?(rawValue: Swift.String)
|
|
596
|
+
public typealias RawValue = Swift.String
|
|
597
|
+
public var rawValue: Swift.String {
|
|
598
|
+
get
|
|
599
|
+
}
|
|
600
|
+
}
|
|
521
601
|
public enum FeedInput : Swift.Sendable {
|
|
522
|
-
case video(playbackId: Swift.String, fallbackUrl: Swift.String? = nil)
|
|
602
|
+
case video(playbackId: Swift.String, origin: ShortKitSDK.ContentOrigin = .other, fallbackUrl: Swift.String? = nil)
|
|
603
|
+
case liveStream(playbackId: Swift.String)
|
|
523
604
|
case imageCarousel(ShortKitSDK.ImageCarouselItem)
|
|
524
605
|
case videoCarousel(ShortKitSDK.VideoCarouselInput)
|
|
606
|
+
case videoCarouselItem(ShortKitSDK.VideoCarouselItem)
|
|
525
607
|
}
|
|
526
608
|
public enum FeedItem : Swift.Sendable {
|
|
527
609
|
case content(ShortKitSDK.ContentItem)
|
|
@@ -693,8 +775,9 @@ public struct VideoCarouselItem : Swift.Codable, Swift.Equatable, Swift.Sendable
|
|
|
693
775
|
}
|
|
694
776
|
public struct VideoCarouselVideoInput : Swift.Codable, Swift.Equatable, Swift.Sendable {
|
|
695
777
|
public let playbackId: Swift.String
|
|
778
|
+
public let origin: ShortKitSDK.ContentOrigin
|
|
696
779
|
public let fallbackUrl: Swift.String?
|
|
697
|
-
public init(playbackId: Swift.String, fallbackUrl: Swift.String? = nil)
|
|
780
|
+
public init(playbackId: Swift.String, origin: ShortKitSDK.ContentOrigin = .other, fallbackUrl: Swift.String? = nil)
|
|
698
781
|
public static func == (a: ShortKitSDK.VideoCarouselVideoInput, b: ShortKitSDK.VideoCarouselVideoInput) -> Swift.Bool
|
|
699
782
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
700
783
|
public init(from decoder: any Swift.Decoder) throws
|
|
@@ -752,6 +835,16 @@ public protocol FeedOverlay : AnyObject {
|
|
|
752
835
|
func configure(with item: ShortKitSDK.ContentItem)
|
|
753
836
|
func activatePlayback()
|
|
754
837
|
}
|
|
838
|
+
public protocol LiveOverlay : AnyObject {
|
|
839
|
+
func attach(player: ShortKitSDK.ShortKitPlayer)
|
|
840
|
+
func configure(with item: ShortKitSDK.ContentItem)
|
|
841
|
+
func activate()
|
|
842
|
+
func deactivate()
|
|
843
|
+
func showEnded()
|
|
844
|
+
}
|
|
845
|
+
extension ShortKitSDK.LiveOverlay {
|
|
846
|
+
public func showEnded()
|
|
847
|
+
}
|
|
755
848
|
public protocol SurveyOverlay : AnyObject {
|
|
756
849
|
var onSurveyResponse: ((Swift.String, ShortKitSDK.SurveyOption) -> Swift.Void)? { get set }
|
|
757
850
|
var onAutoAdvance: (() -> Swift.Void)? { get set }
|
|
@@ -940,6 +1033,7 @@ public enum ShortKitVersion {
|
|
|
940
1033
|
}
|
|
941
1034
|
final public class ShortKit {
|
|
942
1035
|
final public let player: ShortKitSDK.ShortKitPlayer
|
|
1036
|
+
final public let carousel: ShortKitSDK.ShortKitCarousel
|
|
943
1037
|
final public let debugPanelEnabled: Swift.Bool
|
|
944
1038
|
weak final public var delegate: (any ShortKitSDK.ShortKitDelegate)?
|
|
945
1039
|
weak final public var downloadDelegate: (any ShortKitSDK.ShortKitDownloadDelegate)?
|
|
@@ -1051,6 +1145,11 @@ extension ShortKitSDK.ShortKitFeedView : Swift.Sendable {}
|
|
|
1051
1145
|
extension ShortKitSDK.CaptionSource : Swift.Equatable {}
|
|
1052
1146
|
extension ShortKitSDK.CaptionSource : Swift.Hashable {}
|
|
1053
1147
|
extension ShortKitSDK.CaptionSource : Swift.RawRepresentable {}
|
|
1148
|
+
extension ShortKitSDK.LiveStreamStatus : Swift.Hashable {}
|
|
1149
|
+
extension ShortKitSDK.LiveStreamStatus : Swift.RawRepresentable {}
|
|
1150
|
+
extension ShortKitSDK.ContentOrigin : Swift.Equatable {}
|
|
1151
|
+
extension ShortKitSDK.ContentOrigin : Swift.Hashable {}
|
|
1152
|
+
extension ShortKitSDK.ContentOrigin : Swift.RawRepresentable {}
|
|
1054
1153
|
extension ShortKitSDK.FeedTransitionEvent.Phase : Swift.Equatable {}
|
|
1055
1154
|
extension ShortKitSDK.FeedTransitionEvent.Phase : Swift.Hashable {}
|
|
1056
1155
|
extension ShortKitSDK.FeedTransitionEvent.Direction : Swift.Equatable {}
|
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
|
+
NAKyhlTTEY4YXUZuGyytsdRxGSg=
|
|
14
14
|
</data>
|
|
15
15
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
16
16
|
<data>
|
|
17
|
-
|
|
17
|
+
ifUM9z61Iw1RiA5J7659FTtDCKc=
|
|
18
18
|
</data>
|
|
19
19
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
20
20
|
<data>
|
|
21
|
-
|
|
21
|
+
f61RkcZQhQVbB9c3YG2/uXyr9Vk=
|
|
22
22
|
</data>
|
|
23
23
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
24
24
|
<data>
|
|
25
|
-
|
|
25
|
+
hQZUD603NNnHmxk/pR3vIvMPh+8=
|
|
26
26
|
</data>
|
|
27
27
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
28
28
|
<data>
|
|
29
|
-
|
|
29
|
+
f61RkcZQhQVbB9c3YG2/uXyr9Vk=
|
|
30
30
|
</data>
|
|
31
31
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
32
32
|
<data>
|
|
33
|
-
|
|
33
|
+
ifUM9z61Iw1RiA5J7659FTtDCKc=
|
|
34
34
|
</data>
|
|
35
35
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
36
36
|
<data>
|
|
37
|
-
|
|
37
|
+
NSQpAqQDH38RmWvww0H2ROSdwnk=
|
|
38
38
|
</data>
|
|
39
39
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
40
40
|
<data>
|
|
41
|
-
|
|
41
|
+
4Pig6UkNdzTPX/Sb3gfWgpH50J0=
|
|
42
42
|
</data>
|
|
43
43
|
<key>Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
44
44
|
<data>
|
|
45
|
-
|
|
45
|
+
NSQpAqQDH38RmWvww0H2ROSdwnk=
|
|
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
|
+
a4iFwmhnmmqc60/FRwAHMEku0KIVZPJKipRO7Uz9HM0=
|
|
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
|
+
FPJv0aIEtCT5vyHTtMLImsc7s/GZErqSjenZjaZU/3A=
|
|
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
|
+
/exQewvICJ/AVntoKI+3mu/vYGd4AKEuKZgifZTenwU=
|
|
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
|
+
FPJv0aIEtCT5vyHTtMLImsc7s/GZErqSjenZjaZU/3A=
|
|
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
|
+
a4iFwmhnmmqc60/FRwAHMEku0KIVZPJKipRO7Uz9HM0=
|
|
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
|
+
TT38Nw2hcxmwTv7fTT4NPL8L7gHyMPUOAUlPNzRyDEI=
|
|
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
|
+
QJLSlAAkSGUtORv0i2vGIPi1GlnZYYb8cjgOkj3DLw4=
|
|
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
|
+
TT38Nw2hcxmwTv7fTT4NPL8L7gHyMPUOAUlPNzRyDEI=
|
|
119
119
|
</data>
|
|
120
120
|
</dict>
|
|
121
121
|
<key>Modules/module.modulemap</key>
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, useMemo } from 'react';
|
|
1
|
+
import React, { useRef, useState, useEffect, useMemo } from 'react';
|
|
2
2
|
import { AppRegistry } from 'react-native';
|
|
3
3
|
import type { CarouselOverlayProps, ImageCarouselItem } from './types';
|
|
4
4
|
import NativeShortKitModule from './specs/NativeShortKitModule';
|
|
@@ -31,6 +31,12 @@ function useOverlayEvent<T extends { surfaceId: string }>(
|
|
|
31
31
|
surfaceId: string | undefined,
|
|
32
32
|
handler: (event: T) => void,
|
|
33
33
|
) {
|
|
34
|
+
// Ref-based handler capture so the subscription always calls the latest
|
|
35
|
+
// closure. Effect depends on [eventName, surfaceId] only — re-subscribing
|
|
36
|
+
// on every render would churn native subscriptions.
|
|
37
|
+
const handlerRef = useRef(handler);
|
|
38
|
+
handlerRef.current = handler;
|
|
39
|
+
|
|
34
40
|
useEffect(() => {
|
|
35
41
|
if (!surfaceId) return;
|
|
36
42
|
|
|
@@ -39,12 +45,12 @@ function useOverlayEvent<T extends { surfaceId: string }>(
|
|
|
39
45
|
if (typeof emitter === 'function') {
|
|
40
46
|
sub = (emitter as (cb: (e: T) => void) => { remove: () => void })((e: T) => {
|
|
41
47
|
if (e.surfaceId !== surfaceId) return;
|
|
42
|
-
|
|
48
|
+
handlerRef.current(e);
|
|
43
49
|
});
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
return () => sub?.remove();
|
|
47
|
-
}, [surfaceId]);
|
|
53
|
+
}, [eventName, surfaceId]);
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
interface RawCarouselSurfaceProps {
|
|
@@ -87,21 +93,43 @@ function CarouselSurfaceInner(props: InnerProps) {
|
|
|
87
93
|
(e) => setActiveImageIndex(e.activeImageIndex),
|
|
88
94
|
);
|
|
89
95
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
96
|
+
// Initial item — from surface props (set once on first mount).
|
|
97
|
+
const initialItem: ImageCarouselItem | null = useMemo(() => {
|
|
98
|
+
if (!props.item) return null;
|
|
99
|
+
try { return JSON.parse(props.item); } catch { return null; }
|
|
100
|
+
}, [props.item]);
|
|
101
|
+
|
|
102
|
+
// Subsequent item changes arrive via event — React diff instead of a full
|
|
103
|
+
// Fabric remount on cell reuse. Payload also resets isActive/activeImageIndex.
|
|
104
|
+
const [eventItem, setEventItem] = useState<ImageCarouselItem | null>(null);
|
|
105
|
+
useOverlayEvent<{
|
|
106
|
+
surfaceId: string;
|
|
107
|
+
item: string;
|
|
108
|
+
isActive: boolean;
|
|
109
|
+
activeImageIndex: number;
|
|
110
|
+
}>('onCarouselItemChanged', sid, (e) => {
|
|
94
111
|
try {
|
|
95
|
-
|
|
112
|
+
setEventItem(JSON.parse(e.item));
|
|
96
113
|
} catch {
|
|
97
|
-
|
|
114
|
+
setEventItem(null);
|
|
98
115
|
}
|
|
99
|
-
|
|
116
|
+
setIsActive(e.isActive);
|
|
117
|
+
setActiveImageIndex(e.activeImageIndex);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Prefer event-sourced item (set after first item change) over the initial
|
|
121
|
+
// props-sourced value. Initial mount still uses props; all subsequent
|
|
122
|
+
// transitions are event-driven.
|
|
123
|
+
const item = eventItem ?? initialItem;
|
|
100
124
|
|
|
101
125
|
if (!item) return null;
|
|
102
126
|
|
|
103
127
|
return (
|
|
128
|
+
// key={item.id} preserves "fresh mount per item" for the user's component
|
|
129
|
+
// — their local state resets cleanly across items — while the SDK wrapper
|
|
130
|
+
// above stays mounted and keeps its bridge event subscriptions alive.
|
|
104
131
|
<Component
|
|
132
|
+
key={item.id}
|
|
105
133
|
item={item}
|
|
106
134
|
isActive={isActive}
|
|
107
135
|
activeImageIndex={activeImageIndex}
|
package/src/ShortKitCommands.ts
CHANGED
|
@@ -14,6 +14,10 @@ export const ShortKitCommands = {
|
|
|
14
14
|
seekAndPlay: (seconds: number) => NativeShortKitModule?.seekAndPlay(seconds),
|
|
15
15
|
skipToNext: () => NativeShortKitModule?.skipToNext(),
|
|
16
16
|
skipToPrevious: () => NativeShortKitModule?.skipToPrevious(),
|
|
17
|
+
carouselNext: (): boolean => NativeShortKitModule?.carouselNext() ?? false,
|
|
18
|
+
carouselPrevious: (): boolean => NativeShortKitModule?.carouselPrevious() ?? false,
|
|
19
|
+
carouselSetActiveIndex: (index: number): boolean =>
|
|
20
|
+
NativeShortKitModule?.carouselSetActiveIndex(index) ?? false,
|
|
17
21
|
setMuted: (muted: boolean) => NativeShortKitModule?.setMuted(muted),
|
|
18
22
|
setPlaybackRate: (rate: number) => NativeShortKitModule?.setPlaybackRate(rate),
|
|
19
23
|
setCaptionsEnabled: (enabled: boolean) =>
|