@shortkitsdk/react-native 0.2.14 → 0.2.15
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/shortkit/reactnative/ShortKitBridge.kt +34 -2
- package/android/src/main/java/com/shortkit/reactnative/ShortKitModule.kt +5 -5
- package/ios/ReactCarouselOverlayHost.swift +30 -18
- package/ios/ReactOverlayHost.swift +65 -67
- package/ios/ShortKitBridge.swift +80 -20
- package/ios/ShortKitModule.mm +13 -4
- package/ios/ShortKitSDK.xcframework/Info.plist +2 -1
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Headers/ShortKitSDK-Swift.h +1 -0
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Info.plist +5 -1
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.abi.json +672 -97
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +15 -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 +15 -5
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/_CodeSignature/CodeResources +11 -11
- package/ios/ShortKitSDK.xcframework/{ios-arm64-simulator → ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Headers/ShortKitSDK-Swift.h +1 -0
- package/ios/{ShortKitSDK.xcframework.bak2/ios-arm64-simulator → ShortKitSDK.xcframework/ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Info.plist +5 -1
- package/ios/{ShortKitSDK.xcframework.bak2/ios-arm64-simulator → ShortKitSDK.xcframework/ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +2488 -281
- package/ios/{ShortKitSDK.xcframework.bak2/ios-arm64-simulator → ShortKitSDK.xcframework/ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +65 -5
- package/ios/{ShortKitSDK.xcframework.bak2/ios-arm64-simulator → ShortKitSDK.xcframework/ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/{ShortKitSDK.xcframework.bak2/ios-arm64-simulator → ShortKitSDK.xcframework/ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +65 -5
- package/ios/{ShortKitSDK.xcframework.bak/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json → ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json} +8233 -3592
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +925 -0
- package/ios/{ShortKitSDK.xcframework.bak/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc → 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 +925 -0
- 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 +212 -0
- package/ios/{ShortKitSDK.xcframework.bak2 → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.abi.json +1838 -206
- package/ios/{ShortKitSDK.xcframework.bak2 → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +51 -1
- package/ios/{ShortKitSDK.xcframework.bak2 → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/{ShortKitSDK.xcframework.bak2 → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftinterface +51 -1
- package/ios/ShortKitSDK.xcframework.dev-backup/ios-arm64/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework.dev-backup/ios-arm64/ShortKitSDK.framework/_CodeSignature/CodeResources +168 -0
- package/ios/{ShortKitSDK.xcframework → ShortKitSDK.xcframework.dev-backup}/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +6 -6
- package/ios/ShortKitSDK.xcframework.dev-backup/ios-arm64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/{ShortKitSDK.xcframework → ShortKitSDK.xcframework.dev-backup}/ios-arm64-simulator/ShortKitSDK.framework/_CodeSignature/CodeResources +2 -2
- package/package.json +1 -1
- package/src/ShortKitContext.ts +11 -0
- package/src/ShortKitFeed.tsx +20 -9
- package/src/ShortKitOverlaySurface.tsx +20 -6
- package/src/ShortKitProvider.tsx +4 -2
- package/src/ShortKitWidget.tsx +3 -3
- package/src/index.ts +1 -0
- package/src/specs/NativeShortKitModule.ts +5 -2
- package/src/types.ts +9 -2
- package/ios/ShortKitSDK.xcframework/ios-arm64-simulator/ShortKitSDK.framework/Info.plist +0 -16
- package/ios/ShortKitSDK.xcframework/ios-arm64-simulator/ShortKitSDK.framework/Modules/module.modulemap +0 -4
- package/ios/ShortKitSDK.xcframework/ios-arm64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64/ShortKitSDK.framework/Headers/ShortKitSDK-Swift.h +0 -418
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.abi.json +0 -28917
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -824
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftinterface +0 -824
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64-simulator/ShortKitSDK.framework/Headers/ShortKitSDK-Swift.h +0 -418
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -824
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -824
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework.bak2/Info.plist +0 -43
- package/ios/ShortKitSDK.xcframework.bak2/ios-arm64/ShortKitSDK.framework/Info.plist +0 -16
- package/ios/ShortKitSDK.xcframework.bak2/ios-arm64/ShortKitSDK.framework/Modules/module.modulemap +0 -4
- package/ios/ShortKitSDK.xcframework.bak2/ios-arm64/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework.bak2/ios-arm64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/{ShortKitSDK.xcframework.bak2/ios-arm64-simulator → ShortKitSDK.xcframework/ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Modules/module.modulemap +0 -0
- package/ios/{ShortKitSDK.xcframework.bak → ShortKitSDK.xcframework.dev-backup}/Info.plist +4 -4
- /package/ios/{ShortKitSDK.xcframework.bak2 → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Headers/ShortKitSDK-Swift.h +0 -0
- /package/ios/{ShortKitSDK.xcframework.bak → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Info.plist +0 -0
- /package/ios/{ShortKitSDK.xcframework.bak → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Modules/module.modulemap +0 -0
- /package/ios/{ShortKitSDK.xcframework.bak2 → ShortKitSDK.xcframework.dev-backup}/ios-arm64-simulator/ShortKitSDK.framework/Headers/ShortKitSDK-Swift.h +0 -0
- /package/ios/{ShortKitSDK.xcframework.bak → ShortKitSDK.xcframework.dev-backup}/ios-arm64-simulator/ShortKitSDK.framework/Info.plist +0 -0
- /package/ios/{ShortKitSDK.xcframework → ShortKitSDK.xcframework.dev-backup}/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -0
- /package/ios/{ShortKitSDK.xcframework → ShortKitSDK.xcframework.dev-backup}/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- /package/ios/{ShortKitSDK.xcframework → ShortKitSDK.xcframework.dev-backup}/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -0
- /package/ios/{ShortKitSDK.xcframework.bak → ShortKitSDK.xcframework.dev-backup}/ios-arm64-simulator/ShortKitSDK.framework/Modules/module.modulemap +0 -0
|
@@ -203,6 +203,7 @@ public struct FeedConfig : Swift.Codable {
|
|
|
203
203
|
public var scrollAxis: ShortKitSDK.ScrollAxis
|
|
204
204
|
public var videoOverlay: ShortKitSDK.VideoOverlayMode
|
|
205
205
|
public var carouselOverlay: ShortKitSDK.CarouselOverlayMode
|
|
206
|
+
public var videoCarouselOverlay: ShortKitSDK.VideoCarouselOverlayMode
|
|
206
207
|
public var surveyOverlay: ShortKitSDK.SurveyOverlayMode
|
|
207
208
|
public var adOverlay: ShortKitSDK.AdOverlayMode
|
|
208
209
|
public var muteOnStart: Swift.Bool
|
|
@@ -211,7 +212,7 @@ public struct FeedConfig : Swift.Codable {
|
|
|
211
212
|
public var coldStartEnabled: Swift.Bool
|
|
212
213
|
public var filter: ShortKitSDK.FeedFilter?
|
|
213
214
|
public var preload: ShortKitSDK.FeedPreload?
|
|
214
|
-
public init(feedHeight: ShortKitSDK.FeedHeight = .fullscreen, scrollAxis: ShortKitSDK.ScrollAxis = .vertical, videoOverlay: ShortKitSDK.VideoOverlayMode = .none, carouselOverlay: ShortKitSDK.CarouselOverlayMode = .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, filter: ShortKitSDK.FeedFilter? = nil, preload: ShortKitSDK.FeedPreload? = nil)
|
|
215
|
+
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, filter: ShortKitSDK.FeedFilter? = nil, preload: ShortKitSDK.FeedPreload? = nil)
|
|
215
216
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
216
217
|
public init(from decoder: any Swift.Decoder) throws
|
|
217
218
|
}
|
|
@@ -240,6 +241,17 @@ extension ShortKitSDK.CarouselOverlayMode : Swift.Codable {
|
|
|
240
241
|
public init(from decoder: any Swift.Decoder) throws
|
|
241
242
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
242
243
|
}
|
|
244
|
+
public enum VideoCarouselOverlayMode {
|
|
245
|
+
case none
|
|
246
|
+
case custom(@Sendable () -> any UIKit.UIView & ShortKitSDK.VideoCarouselOverlay)
|
|
247
|
+
}
|
|
248
|
+
extension ShortKitSDK.VideoCarouselOverlayMode : Swift.Equatable {
|
|
249
|
+
public static func == (lhs: ShortKitSDK.VideoCarouselOverlayMode, rhs: ShortKitSDK.VideoCarouselOverlayMode) -> Swift.Bool
|
|
250
|
+
}
|
|
251
|
+
extension ShortKitSDK.VideoCarouselOverlayMode : Swift.Codable {
|
|
252
|
+
public init(from decoder: any Swift.Decoder) throws
|
|
253
|
+
public func encode(to encoder: any Swift.Encoder) throws
|
|
254
|
+
}
|
|
243
255
|
public enum SurveyOverlayMode {
|
|
244
256
|
case none
|
|
245
257
|
case custom(@Sendable () -> any UIKit.UIView & ShortKitSDK.SurveyOverlay)
|
|
@@ -409,12 +421,14 @@ public struct ContentItem : Swift.Codable, Swift.Equatable, @unchecked Swift.Sen
|
|
|
409
421
|
public enum FeedInput : Swift.Sendable {
|
|
410
422
|
case video(playbackId: Swift.String, fallbackUrl: Swift.String? = nil)
|
|
411
423
|
case imageCarousel(ShortKitSDK.ImageCarouselItem)
|
|
424
|
+
case videoCarousel(ShortKitSDK.VideoCarouselItem)
|
|
412
425
|
}
|
|
413
426
|
public enum FeedItem : Swift.Sendable {
|
|
414
427
|
case content(ShortKitSDK.ContentItem)
|
|
415
428
|
case adSlot(ShortKitSDK.AdSlot)
|
|
416
429
|
case imageCarousel(ShortKitSDK.ImageCarouselItem)
|
|
417
430
|
case survey(ShortKitSDK.SurveyItem)
|
|
431
|
+
case videoCarousel(ShortKitSDK.VideoCarouselItem)
|
|
418
432
|
public var isContent: Swift.Bool {
|
|
419
433
|
get
|
|
420
434
|
}
|
|
@@ -427,6 +441,9 @@ public enum FeedItem : Swift.Sendable {
|
|
|
427
441
|
public var isSurvey: Swift.Bool {
|
|
428
442
|
get
|
|
429
443
|
}
|
|
444
|
+
public var isVideoCarousel: Swift.Bool {
|
|
445
|
+
get
|
|
446
|
+
}
|
|
430
447
|
public var isNonVideo: Swift.Bool {
|
|
431
448
|
get
|
|
432
449
|
}
|
|
@@ -442,6 +459,9 @@ public enum FeedItem : Swift.Sendable {
|
|
|
442
459
|
public var surveyItem: ShortKitSDK.SurveyItem? {
|
|
443
460
|
get
|
|
444
461
|
}
|
|
462
|
+
public var videoCarouselItem: ShortKitSDK.VideoCarouselItem? {
|
|
463
|
+
get
|
|
464
|
+
}
|
|
445
465
|
public var id: Swift.String {
|
|
446
466
|
get
|
|
447
467
|
}
|
|
@@ -545,6 +565,19 @@ public struct VTTCue : Swift.Equatable, Swift.Sendable {
|
|
|
545
565
|
public init(startTime: Swift.Double, endTime: Swift.Double, text: Swift.String)
|
|
546
566
|
public static func == (a: ShortKitSDK.VTTCue, b: ShortKitSDK.VTTCue) -> Swift.Bool
|
|
547
567
|
}
|
|
568
|
+
public struct VideoCarouselItem : Swift.Codable, Swift.Equatable, Swift.Sendable {
|
|
569
|
+
public let id: Swift.String
|
|
570
|
+
public let videos: [ShortKitSDK.ContentItem]
|
|
571
|
+
public let title: Swift.String?
|
|
572
|
+
public let description: Swift.String?
|
|
573
|
+
public let author: Swift.String?
|
|
574
|
+
public let section: Swift.String?
|
|
575
|
+
public let articleUrl: Swift.String?
|
|
576
|
+
public init(id: Swift.String, videos: [ShortKitSDK.ContentItem], title: Swift.String? = nil, description: Swift.String? = nil, author: Swift.String? = nil, section: Swift.String? = nil, articleUrl: Swift.String? = nil)
|
|
577
|
+
public static func == (a: ShortKitSDK.VideoCarouselItem, b: ShortKitSDK.VideoCarouselItem) -> Swift.Bool
|
|
578
|
+
public func encode(to encoder: any Swift.Encoder) throws
|
|
579
|
+
public init(from decoder: any Swift.Decoder) throws
|
|
580
|
+
}
|
|
548
581
|
public protocol AdOverlay : AnyObject {
|
|
549
582
|
func configure(with content: ShortKitSDK.NativeAdContent)
|
|
550
583
|
func resetState()
|
|
@@ -554,6 +587,8 @@ public protocol CarouselOverlay : AnyObject {
|
|
|
554
587
|
func configure(with item: ShortKitSDK.ImageCarouselItem)
|
|
555
588
|
func resetState()
|
|
556
589
|
var wantsNativeImagePrefetch: Swift.Bool { get }
|
|
590
|
+
func activatePlayback()
|
|
591
|
+
func updateActiveImage(index: Swift.Int)
|
|
557
592
|
}
|
|
558
593
|
extension ShortKitSDK.CarouselOverlay {
|
|
559
594
|
public var cachedImage: ((Swift.String) -> UIKit.UIImage?)? {
|
|
@@ -563,6 +598,8 @@ extension ShortKitSDK.CarouselOverlay {
|
|
|
563
598
|
public var wantsNativeImagePrefetch: Swift.Bool {
|
|
564
599
|
get
|
|
565
600
|
}
|
|
601
|
+
public func activatePlayback()
|
|
602
|
+
public func updateActiveImage(index: Swift.Int)
|
|
566
603
|
}
|
|
567
604
|
final public class CellContent : Combine.ObservableObject {
|
|
568
605
|
@Combine.Published @_projectedValueProperty($item) final public var item: ShortKitSDK.ContentItem? {
|
|
@@ -592,6 +629,19 @@ public protocol SurveyOverlay : AnyObject {
|
|
|
592
629
|
func configure(with item: ShortKitSDK.SurveyItem)
|
|
593
630
|
func resetState()
|
|
594
631
|
}
|
|
632
|
+
public protocol VideoCarouselOverlay : AnyObject {
|
|
633
|
+
func configure(with item: ShortKitSDK.VideoCarouselItem)
|
|
634
|
+
func updateActiveVideo(index: Swift.Int, item: ShortKitSDK.ContentItem)
|
|
635
|
+
func resetState()
|
|
636
|
+
func attach(player: ShortKitSDK.ShortKitPlayer)
|
|
637
|
+
func activatePlayback()
|
|
638
|
+
func deactivatePlayback()
|
|
639
|
+
}
|
|
640
|
+
extension ShortKitSDK.VideoCarouselOverlay {
|
|
641
|
+
public func attach(player: ShortKitSDK.ShortKitPlayer)
|
|
642
|
+
public func activatePlayback()
|
|
643
|
+
public func deactivatePlayback()
|
|
644
|
+
}
|
|
595
645
|
public struct PlayerTime : Swift.Equatable, Swift.Sendable {
|
|
596
646
|
public let current: Swift.Double
|
|
597
647
|
public let duration: Swift.Double
|
|
Binary file
|
|
@@ -203,6 +203,7 @@ public struct FeedConfig : Swift.Codable {
|
|
|
203
203
|
public var scrollAxis: ShortKitSDK.ScrollAxis
|
|
204
204
|
public var videoOverlay: ShortKitSDK.VideoOverlayMode
|
|
205
205
|
public var carouselOverlay: ShortKitSDK.CarouselOverlayMode
|
|
206
|
+
public var videoCarouselOverlay: ShortKitSDK.VideoCarouselOverlayMode
|
|
206
207
|
public var surveyOverlay: ShortKitSDK.SurveyOverlayMode
|
|
207
208
|
public var adOverlay: ShortKitSDK.AdOverlayMode
|
|
208
209
|
public var muteOnStart: Swift.Bool
|
|
@@ -211,7 +212,7 @@ public struct FeedConfig : Swift.Codable {
|
|
|
211
212
|
public var coldStartEnabled: Swift.Bool
|
|
212
213
|
public var filter: ShortKitSDK.FeedFilter?
|
|
213
214
|
public var preload: ShortKitSDK.FeedPreload?
|
|
214
|
-
public init(feedHeight: ShortKitSDK.FeedHeight = .fullscreen, scrollAxis: ShortKitSDK.ScrollAxis = .vertical, videoOverlay: ShortKitSDK.VideoOverlayMode = .none, carouselOverlay: ShortKitSDK.CarouselOverlayMode = .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, filter: ShortKitSDK.FeedFilter? = nil, preload: ShortKitSDK.FeedPreload? = nil)
|
|
215
|
+
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, filter: ShortKitSDK.FeedFilter? = nil, preload: ShortKitSDK.FeedPreload? = nil)
|
|
215
216
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
216
217
|
public init(from decoder: any Swift.Decoder) throws
|
|
217
218
|
}
|
|
@@ -240,6 +241,17 @@ extension ShortKitSDK.CarouselOverlayMode : Swift.Codable {
|
|
|
240
241
|
public init(from decoder: any Swift.Decoder) throws
|
|
241
242
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
242
243
|
}
|
|
244
|
+
public enum VideoCarouselOverlayMode {
|
|
245
|
+
case none
|
|
246
|
+
case custom(@Sendable () -> any UIKit.UIView & ShortKitSDK.VideoCarouselOverlay)
|
|
247
|
+
}
|
|
248
|
+
extension ShortKitSDK.VideoCarouselOverlayMode : Swift.Equatable {
|
|
249
|
+
public static func == (lhs: ShortKitSDK.VideoCarouselOverlayMode, rhs: ShortKitSDK.VideoCarouselOverlayMode) -> Swift.Bool
|
|
250
|
+
}
|
|
251
|
+
extension ShortKitSDK.VideoCarouselOverlayMode : Swift.Codable {
|
|
252
|
+
public init(from decoder: any Swift.Decoder) throws
|
|
253
|
+
public func encode(to encoder: any Swift.Encoder) throws
|
|
254
|
+
}
|
|
243
255
|
public enum SurveyOverlayMode {
|
|
244
256
|
case none
|
|
245
257
|
case custom(@Sendable () -> any UIKit.UIView & ShortKitSDK.SurveyOverlay)
|
|
@@ -409,12 +421,14 @@ public struct ContentItem : Swift.Codable, Swift.Equatable, @unchecked Swift.Sen
|
|
|
409
421
|
public enum FeedInput : Swift.Sendable {
|
|
410
422
|
case video(playbackId: Swift.String, fallbackUrl: Swift.String? = nil)
|
|
411
423
|
case imageCarousel(ShortKitSDK.ImageCarouselItem)
|
|
424
|
+
case videoCarousel(ShortKitSDK.VideoCarouselItem)
|
|
412
425
|
}
|
|
413
426
|
public enum FeedItem : Swift.Sendable {
|
|
414
427
|
case content(ShortKitSDK.ContentItem)
|
|
415
428
|
case adSlot(ShortKitSDK.AdSlot)
|
|
416
429
|
case imageCarousel(ShortKitSDK.ImageCarouselItem)
|
|
417
430
|
case survey(ShortKitSDK.SurveyItem)
|
|
431
|
+
case videoCarousel(ShortKitSDK.VideoCarouselItem)
|
|
418
432
|
public var isContent: Swift.Bool {
|
|
419
433
|
get
|
|
420
434
|
}
|
|
@@ -427,6 +441,9 @@ public enum FeedItem : Swift.Sendable {
|
|
|
427
441
|
public var isSurvey: Swift.Bool {
|
|
428
442
|
get
|
|
429
443
|
}
|
|
444
|
+
public var isVideoCarousel: Swift.Bool {
|
|
445
|
+
get
|
|
446
|
+
}
|
|
430
447
|
public var isNonVideo: Swift.Bool {
|
|
431
448
|
get
|
|
432
449
|
}
|
|
@@ -442,6 +459,9 @@ public enum FeedItem : Swift.Sendable {
|
|
|
442
459
|
public var surveyItem: ShortKitSDK.SurveyItem? {
|
|
443
460
|
get
|
|
444
461
|
}
|
|
462
|
+
public var videoCarouselItem: ShortKitSDK.VideoCarouselItem? {
|
|
463
|
+
get
|
|
464
|
+
}
|
|
445
465
|
public var id: Swift.String {
|
|
446
466
|
get
|
|
447
467
|
}
|
|
@@ -545,6 +565,19 @@ public struct VTTCue : Swift.Equatable, Swift.Sendable {
|
|
|
545
565
|
public init(startTime: Swift.Double, endTime: Swift.Double, text: Swift.String)
|
|
546
566
|
public static func == (a: ShortKitSDK.VTTCue, b: ShortKitSDK.VTTCue) -> Swift.Bool
|
|
547
567
|
}
|
|
568
|
+
public struct VideoCarouselItem : Swift.Codable, Swift.Equatable, Swift.Sendable {
|
|
569
|
+
public let id: Swift.String
|
|
570
|
+
public let videos: [ShortKitSDK.ContentItem]
|
|
571
|
+
public let title: Swift.String?
|
|
572
|
+
public let description: Swift.String?
|
|
573
|
+
public let author: Swift.String?
|
|
574
|
+
public let section: Swift.String?
|
|
575
|
+
public let articleUrl: Swift.String?
|
|
576
|
+
public init(id: Swift.String, videos: [ShortKitSDK.ContentItem], title: Swift.String? = nil, description: Swift.String? = nil, author: Swift.String? = nil, section: Swift.String? = nil, articleUrl: Swift.String? = nil)
|
|
577
|
+
public static func == (a: ShortKitSDK.VideoCarouselItem, b: ShortKitSDK.VideoCarouselItem) -> Swift.Bool
|
|
578
|
+
public func encode(to encoder: any Swift.Encoder) throws
|
|
579
|
+
public init(from decoder: any Swift.Decoder) throws
|
|
580
|
+
}
|
|
548
581
|
public protocol AdOverlay : AnyObject {
|
|
549
582
|
func configure(with content: ShortKitSDK.NativeAdContent)
|
|
550
583
|
func resetState()
|
|
@@ -554,6 +587,8 @@ public protocol CarouselOverlay : AnyObject {
|
|
|
554
587
|
func configure(with item: ShortKitSDK.ImageCarouselItem)
|
|
555
588
|
func resetState()
|
|
556
589
|
var wantsNativeImagePrefetch: Swift.Bool { get }
|
|
590
|
+
func activatePlayback()
|
|
591
|
+
func updateActiveImage(index: Swift.Int)
|
|
557
592
|
}
|
|
558
593
|
extension ShortKitSDK.CarouselOverlay {
|
|
559
594
|
public var cachedImage: ((Swift.String) -> UIKit.UIImage?)? {
|
|
@@ -563,6 +598,8 @@ extension ShortKitSDK.CarouselOverlay {
|
|
|
563
598
|
public var wantsNativeImagePrefetch: Swift.Bool {
|
|
564
599
|
get
|
|
565
600
|
}
|
|
601
|
+
public func activatePlayback()
|
|
602
|
+
public func updateActiveImage(index: Swift.Int)
|
|
566
603
|
}
|
|
567
604
|
final public class CellContent : Combine.ObservableObject {
|
|
568
605
|
@Combine.Published @_projectedValueProperty($item) final public var item: ShortKitSDK.ContentItem? {
|
|
@@ -592,6 +629,19 @@ public protocol SurveyOverlay : AnyObject {
|
|
|
592
629
|
func configure(with item: ShortKitSDK.SurveyItem)
|
|
593
630
|
func resetState()
|
|
594
631
|
}
|
|
632
|
+
public protocol VideoCarouselOverlay : AnyObject {
|
|
633
|
+
func configure(with item: ShortKitSDK.VideoCarouselItem)
|
|
634
|
+
func updateActiveVideo(index: Swift.Int, item: ShortKitSDK.ContentItem)
|
|
635
|
+
func resetState()
|
|
636
|
+
func attach(player: ShortKitSDK.ShortKitPlayer)
|
|
637
|
+
func activatePlayback()
|
|
638
|
+
func deactivatePlayback()
|
|
639
|
+
}
|
|
640
|
+
extension ShortKitSDK.VideoCarouselOverlay {
|
|
641
|
+
public func attach(player: ShortKitSDK.ShortKitPlayer)
|
|
642
|
+
public func activatePlayback()
|
|
643
|
+
public func deactivatePlayback()
|
|
644
|
+
}
|
|
595
645
|
public struct PlayerTime : Swift.Equatable, Swift.Sendable {
|
|
596
646
|
public let current: Swift.Double
|
|
597
647
|
public let duration: Swift.Double
|
|
Binary file
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>files</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>Headers/ShortKitSDK-Swift.h</key>
|
|
8
|
+
<data>
|
|
9
|
+
3bbpoSImjQOVLQbSfh6sAEp9NqY=
|
|
10
|
+
</data>
|
|
11
|
+
<key>Info.plist</key>
|
|
12
|
+
<data>
|
|
13
|
+
Ley678FJu8DKkhiCwrDCSa/fREc=
|
|
14
|
+
</data>
|
|
15
|
+
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.abi.json</key>
|
|
16
|
+
<data>
|
|
17
|
+
UXy9TKZ3jOo1h3yIihNnV4dQp7U=
|
|
18
|
+
</data>
|
|
19
|
+
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface</key>
|
|
20
|
+
<data>
|
|
21
|
+
IZNdocAE7nxibe9ciOMtS5/duMY=
|
|
22
|
+
</data>
|
|
23
|
+
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftdoc</key>
|
|
24
|
+
<data>
|
|
25
|
+
lyMHdu2nhDSI/iYtndpddOI0LOI=
|
|
26
|
+
</data>
|
|
27
|
+
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftinterface</key>
|
|
28
|
+
<data>
|
|
29
|
+
IZNdocAE7nxibe9ciOMtS5/duMY=
|
|
30
|
+
</data>
|
|
31
|
+
<key>Modules/module.modulemap</key>
|
|
32
|
+
<data>
|
|
33
|
+
QthRxkVp/MRBzYVNLtX05t2Csso=
|
|
34
|
+
</data>
|
|
35
|
+
</dict>
|
|
36
|
+
<key>files2</key>
|
|
37
|
+
<dict>
|
|
38
|
+
<key>Headers/ShortKitSDK-Swift.h</key>
|
|
39
|
+
<dict>
|
|
40
|
+
<key>hash2</key>
|
|
41
|
+
<data>
|
|
42
|
+
V+jQ2eNebJRtNpq31u6WQqjInnpmCU26LytMq5YTXJk=
|
|
43
|
+
</data>
|
|
44
|
+
</dict>
|
|
45
|
+
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.abi.json</key>
|
|
46
|
+
<dict>
|
|
47
|
+
<key>hash2</key>
|
|
48
|
+
<data>
|
|
49
|
+
xc/3beYtE9m0Lo6S3wpA6SlO9HYbjsJ985rl98j1eIY=
|
|
50
|
+
</data>
|
|
51
|
+
</dict>
|
|
52
|
+
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface</key>
|
|
53
|
+
<dict>
|
|
54
|
+
<key>hash2</key>
|
|
55
|
+
<data>
|
|
56
|
+
ZrJFDZDIX1r57QKRkG6lKzC1vGtLHmFg0YZQUIH9Fqg=
|
|
57
|
+
</data>
|
|
58
|
+
</dict>
|
|
59
|
+
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftdoc</key>
|
|
60
|
+
<dict>
|
|
61
|
+
<key>hash2</key>
|
|
62
|
+
<data>
|
|
63
|
+
3BSBNIbUXJpeNzyAISR71ve7QrCu4RSatXFFNTeMhB4=
|
|
64
|
+
</data>
|
|
65
|
+
</dict>
|
|
66
|
+
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftinterface</key>
|
|
67
|
+
<dict>
|
|
68
|
+
<key>hash2</key>
|
|
69
|
+
<data>
|
|
70
|
+
ZrJFDZDIX1r57QKRkG6lKzC1vGtLHmFg0YZQUIH9Fqg=
|
|
71
|
+
</data>
|
|
72
|
+
</dict>
|
|
73
|
+
<key>Modules/module.modulemap</key>
|
|
74
|
+
<dict>
|
|
75
|
+
<key>hash2</key>
|
|
76
|
+
<data>
|
|
77
|
+
K4gZcRkdlvQBo5cnduiRMooPuUS6dWAP1E7dBJRuHL4=
|
|
78
|
+
</data>
|
|
79
|
+
</dict>
|
|
80
|
+
</dict>
|
|
81
|
+
<key>rules</key>
|
|
82
|
+
<dict>
|
|
83
|
+
<key>^.*</key>
|
|
84
|
+
<true/>
|
|
85
|
+
<key>^.*\.lproj/</key>
|
|
86
|
+
<dict>
|
|
87
|
+
<key>optional</key>
|
|
88
|
+
<true/>
|
|
89
|
+
<key>weight</key>
|
|
90
|
+
<real>1000</real>
|
|
91
|
+
</dict>
|
|
92
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
93
|
+
<dict>
|
|
94
|
+
<key>omit</key>
|
|
95
|
+
<true/>
|
|
96
|
+
<key>weight</key>
|
|
97
|
+
<real>1100</real>
|
|
98
|
+
</dict>
|
|
99
|
+
<key>^Base\.lproj/</key>
|
|
100
|
+
<dict>
|
|
101
|
+
<key>weight</key>
|
|
102
|
+
<real>1010</real>
|
|
103
|
+
</dict>
|
|
104
|
+
<key>^version.plist$</key>
|
|
105
|
+
<true/>
|
|
106
|
+
</dict>
|
|
107
|
+
<key>rules2</key>
|
|
108
|
+
<dict>
|
|
109
|
+
<key>.*\.dSYM($|/)</key>
|
|
110
|
+
<dict>
|
|
111
|
+
<key>weight</key>
|
|
112
|
+
<real>11</real>
|
|
113
|
+
</dict>
|
|
114
|
+
<key>^(.*/)?\.DS_Store$</key>
|
|
115
|
+
<dict>
|
|
116
|
+
<key>omit</key>
|
|
117
|
+
<true/>
|
|
118
|
+
<key>weight</key>
|
|
119
|
+
<real>2000</real>
|
|
120
|
+
</dict>
|
|
121
|
+
<key>^.*</key>
|
|
122
|
+
<true/>
|
|
123
|
+
<key>^.*\.lproj/</key>
|
|
124
|
+
<dict>
|
|
125
|
+
<key>optional</key>
|
|
126
|
+
<true/>
|
|
127
|
+
<key>weight</key>
|
|
128
|
+
<real>1000</real>
|
|
129
|
+
</dict>
|
|
130
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
131
|
+
<dict>
|
|
132
|
+
<key>omit</key>
|
|
133
|
+
<true/>
|
|
134
|
+
<key>weight</key>
|
|
135
|
+
<real>1100</real>
|
|
136
|
+
</dict>
|
|
137
|
+
<key>^Base\.lproj/</key>
|
|
138
|
+
<dict>
|
|
139
|
+
<key>weight</key>
|
|
140
|
+
<real>1010</real>
|
|
141
|
+
</dict>
|
|
142
|
+
<key>^Info\.plist$</key>
|
|
143
|
+
<dict>
|
|
144
|
+
<key>omit</key>
|
|
145
|
+
<true/>
|
|
146
|
+
<key>weight</key>
|
|
147
|
+
<real>20</real>
|
|
148
|
+
</dict>
|
|
149
|
+
<key>^PkgInfo$</key>
|
|
150
|
+
<dict>
|
|
151
|
+
<key>omit</key>
|
|
152
|
+
<true/>
|
|
153
|
+
<key>weight</key>
|
|
154
|
+
<real>20</real>
|
|
155
|
+
</dict>
|
|
156
|
+
<key>^embedded\.provisionprofile$</key>
|
|
157
|
+
<dict>
|
|
158
|
+
<key>weight</key>
|
|
159
|
+
<real>20</real>
|
|
160
|
+
</dict>
|
|
161
|
+
<key>^version\.plist$</key>
|
|
162
|
+
<dict>
|
|
163
|
+
<key>weight</key>
|
|
164
|
+
<real>20</real>
|
|
165
|
+
</dict>
|
|
166
|
+
</dict>
|
|
167
|
+
</dict>
|
|
168
|
+
</plist>
|
|
@@ -32261,42 +32261,42 @@
|
|
|
32261
32261
|
{
|
|
32262
32262
|
"filePath": "\/Users\/michaelseleman\/shortkit\/swift_sdk\/Sources\/ShortKit\/Feed\/FeedViewController.swift",
|
|
32263
32263
|
"kind": "IntegerLiteral",
|
|
32264
|
-
"offset":
|
|
32264
|
+
"offset": 6707,
|
|
32265
32265
|
"length": 2,
|
|
32266
32266
|
"value": "24"
|
|
32267
32267
|
},
|
|
32268
32268
|
{
|
|
32269
32269
|
"filePath": "\/Users\/michaelseleman\/shortkit\/swift_sdk\/Sources\/ShortKit\/Feed\/FeedViewController.swift",
|
|
32270
32270
|
"kind": "BooleanLiteral",
|
|
32271
|
-
"offset":
|
|
32271
|
+
"offset": 6904,
|
|
32272
32272
|
"length": 5,
|
|
32273
32273
|
"value": "false"
|
|
32274
32274
|
},
|
|
32275
32275
|
{
|
|
32276
32276
|
"filePath": "\/Users\/michaelseleman\/shortkit\/swift_sdk\/Sources\/ShortKit\/Feed\/FeedViewController.swift",
|
|
32277
32277
|
"kind": "IntegerLiteral",
|
|
32278
|
-
"offset":
|
|
32278
|
+
"offset": 6934,
|
|
32279
32279
|
"length": 1,
|
|
32280
32280
|
"value": "0"
|
|
32281
32281
|
},
|
|
32282
32282
|
{
|
|
32283
32283
|
"filePath": "\/Users\/michaelseleman\/shortkit\/swift_sdk\/Sources\/ShortKit\/Feed\/FeedViewController.swift",
|
|
32284
32284
|
"kind": "StringLiteral",
|
|
32285
|
-
"offset":
|
|
32285
|
+
"offset": 6973,
|
|
32286
32286
|
"length": 21,
|
|
32287
32287
|
"value": "\"Loading new content\""
|
|
32288
32288
|
},
|
|
32289
32289
|
{
|
|
32290
32290
|
"filePath": "\/Users\/michaelseleman\/shortkit\/swift_sdk\/Sources\/ShortKit\/Feed\/FeedViewController.swift",
|
|
32291
32291
|
"kind": "BooleanLiteral",
|
|
32292
|
-
"offset":
|
|
32292
|
+
"offset": 10049,
|
|
32293
32293
|
"length": 5,
|
|
32294
32294
|
"value": "false"
|
|
32295
32295
|
},
|
|
32296
32296
|
{
|
|
32297
32297
|
"filePath": "\/Users\/michaelseleman\/shortkit\/swift_sdk\/Sources\/ShortKit\/Feed\/FeedViewController.swift",
|
|
32298
32298
|
"kind": "BooleanLiteral",
|
|
32299
|
-
"offset":
|
|
32299
|
+
"offset": 104932,
|
|
32300
32300
|
"length": 5,
|
|
32301
32301
|
"value": "false"
|
|
32302
32302
|
},
|
package/ios/ShortKitSDK.xcframework.dev-backup/ios-arm64-simulator/ShortKitSDK.framework/ShortKitSDK
ADDED
|
Binary file
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</data>
|
|
15
15
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
16
16
|
<data>
|
|
17
|
-
|
|
17
|
+
UXy9TKZ3jOo1h3yIihNnV4dQp7U=
|
|
18
18
|
</data>
|
|
19
19
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
20
20
|
<data>
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
<dict>
|
|
47
47
|
<key>hash2</key>
|
|
48
48
|
<data>
|
|
49
|
-
|
|
49
|
+
xc/3beYtE9m0Lo6S3wpA6SlO9HYbjsJ985rl98j1eIY=
|
|
50
50
|
</data>
|
|
51
51
|
</dict>
|
|
52
52
|
<key>Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
package/package.json
CHANGED
package/src/ShortKitContext.ts
CHANGED
|
@@ -54,3 +54,14 @@ export interface ShortKitContextValue {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export const ShortKitContext = createContext<ShortKitContextValue | null>(null);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Lightweight context that only signals "a ShortKitProvider is mounted".
|
|
60
|
+
* Components that need the provider but don't consume player state (e.g.
|
|
61
|
+
* ShortKitFeed, ShortKitWidget) should subscribe to this instead of
|
|
62
|
+
* ShortKitContext to avoid re-rendering on every TIME/PLAYER_STATE dispatch.
|
|
63
|
+
*
|
|
64
|
+
* The value is set once in ShortKitProvider and never changes, so
|
|
65
|
+
* subscribers never re-render from this context.
|
|
66
|
+
*/
|
|
67
|
+
export const ShortKitInitContext = createContext<boolean>(false);
|
package/src/ShortKitFeed.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, forwardRef } from 'react';
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
|
-
import type { ShortKitFeedProps, FeedInput, FeedFilter, ShortKitFeedHandle } from './types';
|
|
3
|
+
import type { ShortKitFeedProps, FeedInput, FeedFilter, ShortKitFeedHandle, ShortKitRefreshState } from './types';
|
|
4
4
|
import ShortKitFeedView from './specs/ShortKitFeedViewNativeComponent';
|
|
5
5
|
import NativeShortKitModule from './specs/NativeShortKitModule';
|
|
6
|
-
import {
|
|
6
|
+
import { ShortKitInitContext } from './ShortKitContext';
|
|
7
7
|
import { deserializeContentItem, serializeFeedConfig, serializeFeedInputs } from './serialization';
|
|
8
8
|
import { registerOverlayComponent } from './ShortKitOverlaySurface';
|
|
9
9
|
import { registerCarouselOverlayComponent } from './ShortKitCarouselOverlaySurface';
|
|
@@ -39,17 +39,24 @@ export const ShortKitFeed = forwardRef<ShortKitFeedHandle, ShortKitFeedProps>(
|
|
|
39
39
|
onFormatChange,
|
|
40
40
|
onContentTapped,
|
|
41
41
|
onDismiss,
|
|
42
|
-
|
|
42
|
+
onRefreshStateChanged,
|
|
43
43
|
onDidFetchContentItems,
|
|
44
44
|
onRemainingContentCountChange,
|
|
45
45
|
onFeedReady,
|
|
46
46
|
} = props;
|
|
47
47
|
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
48
|
+
const isInitialized = useContext(ShortKitInitContext);
|
|
49
|
+
if (!isInitialized) {
|
|
50
50
|
throw new Error('ShortKitFeed must be used within a ShortKitProvider');
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
// ⚡ TEMP — remove after verifying. Should only log on mount, not on every swipe/time update.
|
|
54
|
+
const renderCount = useRef(0);
|
|
55
|
+
renderCount.current++;
|
|
56
|
+
if (renderCount.current <= 3 || renderCount.current % 100 === 0) {
|
|
57
|
+
console.log(`[SK:Feed] render #${renderCount.current}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
53
60
|
// Stable feed instance ID — survives re-renders and React fast refresh
|
|
54
61
|
const feedIdRef = useRef(generateFeedId());
|
|
55
62
|
const feedId = feedIdRef.current;
|
|
@@ -184,10 +191,14 @@ export const ShortKitFeed = forwardRef<ShortKitFeedHandle, ShortKitFeedProps>(
|
|
|
184
191
|
);
|
|
185
192
|
}
|
|
186
193
|
|
|
187
|
-
if (
|
|
194
|
+
if (onRefreshStateChanged) {
|
|
188
195
|
subscriptions.push(
|
|
189
|
-
NativeShortKitModule.
|
|
190
|
-
|
|
196
|
+
NativeShortKitModule.onRefreshStateChanged((event) => {
|
|
197
|
+
const state: ShortKitRefreshState =
|
|
198
|
+
event.status === 'pulling'
|
|
199
|
+
? { status: 'pulling', progress: event.progress }
|
|
200
|
+
: { status: event.status as 'idle' | 'triggered' | 'refreshing' };
|
|
201
|
+
onRefreshStateChanged(state);
|
|
191
202
|
}),
|
|
192
203
|
);
|
|
193
204
|
}
|
|
@@ -217,7 +228,7 @@ export const ShortKitFeed = forwardRef<ShortKitFeedHandle, ShortKitFeedProps>(
|
|
|
217
228
|
onFormatChange,
|
|
218
229
|
onContentTapped,
|
|
219
230
|
onDismiss,
|
|
220
|
-
|
|
231
|
+
onRefreshStateChanged,
|
|
221
232
|
onDidFetchContentItems,
|
|
222
233
|
]);
|
|
223
234
|
|
|
@@ -161,6 +161,8 @@ function ShortKitOverlaySurfaceInner(props: InnerProps) {
|
|
|
161
161
|
const [activeCue, setActiveCue] = useState<OverlayProps['activeCue']>(
|
|
162
162
|
props.activeCue ? JSON.parse(props.activeCue) : null,
|
|
163
163
|
);
|
|
164
|
+
// Track raw JSON string to avoid re-parsing unchanged cues
|
|
165
|
+
const lastActiveCueJsonRef = React.useRef<string | null>(props.activeCue ?? null);
|
|
164
166
|
const [feedScrollPhase, setFeedScrollPhase] =
|
|
165
167
|
useState<FeedScrollPhase | null>(
|
|
166
168
|
props.feedScrollPhase ? JSON.parse(props.feedScrollPhase) : null,
|
|
@@ -176,7 +178,9 @@ function ShortKitOverlaySurfaceInner(props: InnerProps) {
|
|
|
176
178
|
setIsMuted(props.isMuted ?? true);
|
|
177
179
|
setPlaybackRate(props.playbackRate ?? 1);
|
|
178
180
|
setCaptionsEnabled(props.captionsEnabled ?? false);
|
|
179
|
-
|
|
181
|
+
const rawCue = props.activeCue ?? null;
|
|
182
|
+
lastActiveCueJsonRef.current = rawCue;
|
|
183
|
+
setActiveCue(rawCue ? JSON.parse(rawCue) : null);
|
|
180
184
|
setFeedScrollPhase(
|
|
181
185
|
props.feedScrollPhase ? JSON.parse(props.feedScrollPhase) : null,
|
|
182
186
|
);
|
|
@@ -229,7 +233,12 @@ function ShortKitOverlaySurfaceInner(props: InnerProps) {
|
|
|
229
233
|
|
|
230
234
|
useOverlayEvent<{ surfaceId: string; activeCue: string | null }>(
|
|
231
235
|
'onOverlayActiveCueChanged', sid,
|
|
232
|
-
(e) =>
|
|
236
|
+
(e) => {
|
|
237
|
+
const raw = e.activeCue ?? null;
|
|
238
|
+
if (raw === lastActiveCueJsonRef.current) return;
|
|
239
|
+
lastActiveCueJsonRef.current = raw;
|
|
240
|
+
setActiveCue(raw ? JSON.parse(raw) : null);
|
|
241
|
+
},
|
|
233
242
|
);
|
|
234
243
|
|
|
235
244
|
useOverlayEvent<{ surfaceId: string; feedScrollPhase: string | null }>(
|
|
@@ -274,10 +283,15 @@ function ShortKitOverlaySurfaceInner(props: InnerProps) {
|
|
|
274
283
|
setIsMuted(e.isMuted);
|
|
275
284
|
setPlaybackRate(e.playbackRate);
|
|
276
285
|
setCaptionsEnabled(e.captionsEnabled);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
286
|
+
// Only re-parse activeCue if the raw JSON string actually changed
|
|
287
|
+
const rawCue = e.activeCue ?? null;
|
|
288
|
+
if (rawCue !== lastActiveCueJsonRef.current) {
|
|
289
|
+
lastActiveCueJsonRef.current = rawCue;
|
|
290
|
+
try {
|
|
291
|
+
setActiveCue(rawCue ? JSON.parse(rawCue) : null);
|
|
292
|
+
} catch {
|
|
293
|
+
setActiveCue(null);
|
|
294
|
+
}
|
|
281
295
|
}
|
|
282
296
|
try {
|
|
283
297
|
const next = e.feedScrollPhase ? JSON.parse(e.feedScrollPhase) : null;
|
package/src/ShortKitProvider.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useReducer, useRef } from 'react';
|
|
2
2
|
import { AppState } from 'react-native';
|
|
3
3
|
import type { AppStateStatus } from 'react-native';
|
|
4
|
-
import { ShortKitContext } from './ShortKitContext';
|
|
4
|
+
import { ShortKitContext, ShortKitInitContext } from './ShortKitContext';
|
|
5
5
|
import type { ShortKitContextValue } from './ShortKitContext';
|
|
6
6
|
import type {
|
|
7
7
|
ShortKitProviderProps,
|
|
@@ -500,6 +500,8 @@ export function ShortKitProvider({
|
|
|
500
500
|
);
|
|
501
501
|
|
|
502
502
|
return (
|
|
503
|
-
<
|
|
503
|
+
<ShortKitInitContext.Provider value={true}>
|
|
504
|
+
<ShortKitContext.Provider value={value}>{children}</ShortKitContext.Provider>
|
|
505
|
+
</ShortKitInitContext.Provider>
|
|
504
506
|
);
|
|
505
507
|
}
|