@shortkitsdk/react-native 0.2.12 → 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/ReactCarouselOverlayHost.kt +47 -4
- package/android/src/main/java/com/shortkit/reactnative/ReactVideoCarouselOverlayHost.kt +431 -0
- package/android/src/main/java/com/shortkit/reactnative/ShortKitBridge.kt +117 -2
- package/android/src/main/java/com/shortkit/reactnative/ShortKitModule.kt +7 -5
- package/ios/ReactCarouselOverlayHost.swift +67 -35
- package/ios/ReactOverlayHost.swift +85 -75
- package/ios/ReactVideoCarouselOverlayHost.swift +283 -0
- package/ios/ShortKitBridge.swift +122 -20
- package/ios/ShortKitModule.mm +15 -5
- package/ios/ShortKitSDK.xcframework/Info.plist +5 -4
- 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 +2488 -281
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +65 -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 +65 -5
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/_CodeSignature/CodeResources +168 -0
- package/ios/{ShortKitSDK.xcframework.bak/ios-arm64-simulator → ShortKitSDK.xcframework/ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Headers/ShortKitSDK-Swift.h +2 -1
- package/ios/ShortKitSDK.xcframework/{ios-arm64-simulator → ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Info.plist +5 -1
- package/ios/{ShortKitSDK.xcframework.bak/ios-arm64-simulator → ShortKitSDK.xcframework/ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +8233 -3592
- package/ios/{ShortKitSDK.xcframework.bak/ios-arm64-simulator → ShortKitSDK.xcframework/ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +120 -19
- package/ios/{ShortKitSDK.xcframework.bak/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.bak/ios-arm64-simulator → ShortKitSDK.xcframework/ios-arm64_x86_64-simulator}/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +120 -19
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +33558 -0
- 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/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.bak → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Headers/ShortKitSDK-Swift.h +1 -1
- package/ios/{ShortKitSDK.xcframework.bak → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.abi.json +7338 -3272
- package/ios/{ShortKitSDK.xcframework.bak → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +106 -15
- package/ios/{ShortKitSDK.xcframework.bak → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/{ShortKitSDK.xcframework.bak → ShortKitSDK.xcframework.dev-backup}/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.swiftinterface +106 -15
- 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 +1838 -206
- package/ios/{ShortKitSDK.xcframework → ShortKitSDK.xcframework.dev-backup}/ios-arm64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +51 -1
- 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 +51 -1
- package/ios/ShortKitSDK.xcframework.dev-backup/ios-arm64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework.dev-backup/ios-arm64-simulator/ShortKitSDK.framework/_CodeSignature/CodeResources +168 -0
- package/package.json +1 -1
- package/src/ShortKitCarouselOverlaySurface.tsx +57 -2
- package/src/ShortKitContext.ts +11 -0
- package/src/ShortKitFeed.tsx +25 -10
- package/src/ShortKitOverlaySurface.tsx +24 -11
- package/src/ShortKitProvider.tsx +4 -2
- package/src/ShortKitVideoCarouselOverlaySurface.tsx +156 -0
- package/src/ShortKitWidget.tsx +3 -3
- package/src/index.ts +5 -1
- package/src/serialization.ts +7 -0
- package/src/specs/NativeShortKitModule.ts +18 -2
- package/src/types.ts +48 -3
- package/ios/ShortKitSDK.xcframework/ios-arm64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework.bak/ios-arm64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework/{ios-arm64-simulator → 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.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 → 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.bak → ShortKitSDK.xcframework.dev-backup}/ios-arm64-simulator/ShortKitSDK.framework/Modules/module.modulemap +0 -0
package/ios/ShortKitBridge.swift
CHANGED
|
@@ -17,6 +17,15 @@ import ShortKitSDK
|
|
|
17
17
|
private var shortKit: ShortKit?
|
|
18
18
|
private var cancellables = Set<AnyCancellable>()
|
|
19
19
|
private weak var delegate: ShortKitBridgeDelegateProtocol?
|
|
20
|
+
private var lastProgressEmitTime: CFTimeInterval = 0
|
|
21
|
+
|
|
22
|
+
// Time update coalescing (250ms, matching overlay timer interval)
|
|
23
|
+
private var cachedTime: (current: Double, duration: Double, buffered: Double) = (0, 0, 0)
|
|
24
|
+
private var timeCoalesceTimer: Timer?
|
|
25
|
+
private var timeDirty = false
|
|
26
|
+
|
|
27
|
+
// Scroll phase coalescing — only emit .dragging on first touch
|
|
28
|
+
private var lastEmittedScrollPhase: String = "settled"
|
|
20
29
|
|
|
21
30
|
/// Surface presenter for creating RCTFabricSurface instances in overlay hosts.
|
|
22
31
|
/// Set from ShortKitModule.mm via setSurfacePresenter: (called by RCTInstance).
|
|
@@ -116,12 +125,15 @@ import ShortKitSDK
|
|
|
116
125
|
}
|
|
117
126
|
|
|
118
127
|
subscribeToPublishers(sdk.player)
|
|
128
|
+
startTimeCoalescing()
|
|
119
129
|
sdk.delegate = self
|
|
120
130
|
}
|
|
121
131
|
|
|
122
132
|
// MARK: - Teardown
|
|
123
133
|
|
|
124
134
|
@objc public func teardown() {
|
|
135
|
+
timeCoalesceTimer?.invalidate()
|
|
136
|
+
timeCoalesceTimer = nil
|
|
125
137
|
cancellables.removeAll()
|
|
126
138
|
preloadHandles.removeAll()
|
|
127
139
|
feedRegistry.removeAll()
|
|
@@ -376,24 +388,27 @@ import ShortKitSDK
|
|
|
376
388
|
}
|
|
377
389
|
.store(in: &cancellables)
|
|
378
390
|
|
|
379
|
-
// Current item
|
|
391
|
+
// Current item — deferred to next run-loop tick so emission doesn't
|
|
392
|
+
// contend with Core Animation's commit phase during swipe settle.
|
|
380
393
|
player.currentItem
|
|
381
394
|
.receive(on: DispatchQueue.main)
|
|
382
395
|
.sink { [weak self] item in
|
|
383
396
|
guard let item else { return }
|
|
384
|
-
|
|
397
|
+
let body = Self.contentItemDict(item)
|
|
398
|
+
DispatchQueue.main.async {
|
|
399
|
+
self?.emit("onCurrentItemChanged", body: body)
|
|
400
|
+
}
|
|
385
401
|
}
|
|
386
402
|
.store(in: &cancellables)
|
|
387
403
|
|
|
388
|
-
// Time updates
|
|
404
|
+
// Time updates — coalesced at 250ms (4 events/sec) to avoid flooding
|
|
405
|
+
// the JS bridge. Matches the overlay timer interval in ReactOverlayHost.
|
|
389
406
|
player.time
|
|
390
407
|
.receive(on: DispatchQueue.main)
|
|
391
408
|
.sink { [weak self] time in
|
|
392
|
-
self
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
"buffered": time.buffered
|
|
396
|
-
])
|
|
409
|
+
guard let self else { return }
|
|
410
|
+
self.cachedTime = (time.current, time.duration, time.buffered)
|
|
411
|
+
self.timeDirty = true
|
|
397
412
|
}
|
|
398
413
|
.store(in: &cancellables)
|
|
399
414
|
|
|
@@ -458,7 +473,8 @@ import ShortKitSDK
|
|
|
458
473
|
}
|
|
459
474
|
.store(in: &cancellables)
|
|
460
475
|
|
|
461
|
-
// Feed transition
|
|
476
|
+
// Feed transition — deferred to next run-loop tick so emission doesn't
|
|
477
|
+
// contend with Core Animation's commit phase during swipe settle.
|
|
462
478
|
player.feedTransition
|
|
463
479
|
.receive(on: DispatchQueue.main)
|
|
464
480
|
.sink { [weak self] event in
|
|
@@ -473,24 +489,35 @@ import ShortKitSDK
|
|
|
473
489
|
if let to = event.to {
|
|
474
490
|
body["toItem"] = self.serializeContentItemToJSON(to)
|
|
475
491
|
}
|
|
476
|
-
|
|
492
|
+
DispatchQueue.main.async { [weak self] in
|
|
493
|
+
self?.emit("onFeedTransition", body: body)
|
|
494
|
+
}
|
|
477
495
|
}
|
|
478
496
|
.store(in: &cancellables)
|
|
479
497
|
|
|
480
|
-
// Feed scroll phase
|
|
498
|
+
// Feed scroll phase — coalesced: only emit .dragging on first touch
|
|
499
|
+
// (transition from settled), drop intermediate .dragging events. Always
|
|
500
|
+
// emit .settled. Deferred to next run-loop tick to avoid contending with
|
|
501
|
+
// Core Animation's commit phase.
|
|
481
502
|
player.feedScrollPhase
|
|
482
503
|
.receive(on: DispatchQueue.main)
|
|
483
504
|
.sink { [weak self] phase in
|
|
505
|
+
guard let self else { return }
|
|
484
506
|
switch phase {
|
|
485
507
|
case .dragging(let fromId):
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
]
|
|
508
|
+
// Only emit on transition from settled → dragging
|
|
509
|
+
guard self.lastEmittedScrollPhase != "dragging" else { return }
|
|
510
|
+
self.lastEmittedScrollPhase = "dragging"
|
|
511
|
+
let body: [String: Any] = ["phase": "dragging", "fromId": fromId]
|
|
512
|
+
DispatchQueue.main.async { [weak self] in
|
|
513
|
+
self?.emit("onFeedScrollPhase", body: body)
|
|
514
|
+
}
|
|
490
515
|
case .settled:
|
|
491
|
-
self
|
|
492
|
-
|
|
493
|
-
]
|
|
516
|
+
self.lastEmittedScrollPhase = "settled"
|
|
517
|
+
let body: [String: Any] = ["phase": "settled"]
|
|
518
|
+
DispatchQueue.main.async { [weak self] in
|
|
519
|
+
self?.emit("onFeedScrollPhase", body: body)
|
|
520
|
+
}
|
|
494
521
|
}
|
|
495
522
|
}
|
|
496
523
|
.store(in: &cancellables)
|
|
@@ -536,6 +563,21 @@ import ShortKitSDK
|
|
|
536
563
|
}
|
|
537
564
|
}
|
|
538
565
|
|
|
566
|
+
// MARK: - Time Coalescing
|
|
567
|
+
|
|
568
|
+
private func startTimeCoalescing() {
|
|
569
|
+
timeCoalesceTimer?.invalidate()
|
|
570
|
+
timeCoalesceTimer = Timer.scheduledTimer(withTimeInterval: 0.25, repeats: true) { [weak self] _ in
|
|
571
|
+
guard let self, self.timeDirty else { return }
|
|
572
|
+
self.timeDirty = false
|
|
573
|
+
self.emit("onTimeUpdate", body: [
|
|
574
|
+
"current": self.cachedTime.current,
|
|
575
|
+
"duration": self.cachedTime.duration,
|
|
576
|
+
"buffered": self.cachedTime.buffered
|
|
577
|
+
])
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
539
581
|
// MARK: - Content Item Serialization
|
|
540
582
|
|
|
541
583
|
/// Serialize a ContentItem to a JSON string for bridge transport.
|
|
@@ -651,22 +693,27 @@ import ShortKitSDK
|
|
|
651
693
|
let feedSource: FeedSource = feedSourceStr == "custom" ? .custom : .algorithmic
|
|
652
694
|
|
|
653
695
|
let carouselOverlay = parseCarouselOverlay(obj["carouselOverlay"] as? String)
|
|
696
|
+
let videoCarouselOverlay = parseVideoCarouselOverlay(obj["videoCarouselOverlay"] as? String)
|
|
654
697
|
|
|
655
698
|
let filter = parseFeedFilter(obj["filter"] as? String)
|
|
656
699
|
|
|
657
700
|
let scrollAxisStr = obj["scrollAxis"] as? String ?? "vertical"
|
|
658
701
|
let scrollAxis: ScrollAxis = scrollAxisStr == "horizontal" ? .horizontal : .vertical
|
|
659
702
|
|
|
703
|
+
let pullToRefreshEnabled = obj["pullToRefreshEnabled"] as? Bool ?? true
|
|
704
|
+
|
|
660
705
|
return FeedConfig(
|
|
661
706
|
feedHeight: feedHeight,
|
|
662
707
|
scrollAxis: scrollAxis,
|
|
663
708
|
videoOverlay: videoOverlay,
|
|
664
709
|
carouselOverlay: carouselOverlay,
|
|
710
|
+
videoCarouselOverlay: videoCarouselOverlay,
|
|
665
711
|
surveyOverlay: .none,
|
|
666
712
|
adOverlay: .none,
|
|
667
713
|
muteOnStart: muteOnStart,
|
|
668
714
|
autoplay: autoplay,
|
|
669
715
|
feedSource: feedSource,
|
|
716
|
+
pullToRefreshEnabled: pullToRefreshEnabled,
|
|
670
717
|
filter: filter
|
|
671
718
|
)
|
|
672
719
|
}
|
|
@@ -740,6 +787,39 @@ import ShortKitSDK
|
|
|
740
787
|
return .none
|
|
741
788
|
}
|
|
742
789
|
|
|
790
|
+
/// Parse a double-stringified video carousel overlay JSON into a `VideoCarouselOverlayMode`.
|
|
791
|
+
///
|
|
792
|
+
/// Examples:
|
|
793
|
+
/// - `"\"none\""` -> `.none`
|
|
794
|
+
/// - `"{\"type\":\"custom\",\"name\":\"news\"}"` -> `.custom { ReactVideoCarouselOverlayHost() }`
|
|
795
|
+
private static func parseVideoCarouselOverlay(_ json: String?) -> VideoCarouselOverlayMode {
|
|
796
|
+
guard let json,
|
|
797
|
+
let data = json.data(using: .utf8),
|
|
798
|
+
let parsed = try? JSONSerialization.jsonObject(with: data) else {
|
|
799
|
+
return .none
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
if let str = parsed as? String, str == "none" {
|
|
803
|
+
return .none
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
if let obj = parsed as? [String: Any],
|
|
807
|
+
let type = obj["type"] as? String,
|
|
808
|
+
type == "custom" {
|
|
809
|
+
let name = obj["name"] as? String ?? "Default"
|
|
810
|
+
return .custom { @Sendable in
|
|
811
|
+
let host = ReactVideoCarouselOverlayHost()
|
|
812
|
+
host.surfacePresenter = ShortKitBridge.shared?.surfacePresenter
|
|
813
|
+
host.bridge = ShortKitBridge.shared
|
|
814
|
+
host.videoCarouselOverlayModuleName = "ShortKitVideoCarouselOverlay_\(name)"
|
|
815
|
+
host.prepareSurface()
|
|
816
|
+
return host
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
return .none
|
|
821
|
+
}
|
|
822
|
+
|
|
743
823
|
/// Parse a double-stringified feedHeight JSON.
|
|
744
824
|
/// e.g. `"{\"type\":\"fullscreen\"}"` or `"{\"type\":\"percentage\",\"value\":0.8}"`
|
|
745
825
|
private static func parseFeedHeight(_ json: String?) -> FeedHeight {
|
|
@@ -800,6 +880,13 @@ import ShortKitSDK
|
|
|
800
880
|
continue
|
|
801
881
|
}
|
|
802
882
|
result.append(.imageCarousel(carouselItem))
|
|
883
|
+
case "videoCarousel":
|
|
884
|
+
guard let itemData = obj["item"] as? [String: Any],
|
|
885
|
+
let itemJSON = try? JSONSerialization.data(withJSONObject: itemData),
|
|
886
|
+
let carouselItem = try? JSONDecoder().decode(VideoCarouselItem.self, from: itemJSON) else {
|
|
887
|
+
continue
|
|
888
|
+
}
|
|
889
|
+
result.append(.videoCarousel(carouselItem))
|
|
803
890
|
default:
|
|
804
891
|
continue
|
|
805
892
|
}
|
|
@@ -828,8 +915,23 @@ extension ShortKitBridge: ShortKitDelegate {
|
|
|
828
915
|
])
|
|
829
916
|
}
|
|
830
917
|
|
|
831
|
-
public func
|
|
832
|
-
|
|
918
|
+
public func shortKit(_ shortKit: ShortKit, didChangeRefreshState state: ShortKitRefreshState) {
|
|
919
|
+
let body: [String: Any]
|
|
920
|
+
switch state {
|
|
921
|
+
case .idle:
|
|
922
|
+
body = ["status": "idle", "progress": 0.0]
|
|
923
|
+
case .pulling(let progress):
|
|
924
|
+
// Throttle pulling events to max 1 per 16ms to avoid bridge saturation
|
|
925
|
+
let now = CACurrentMediaTime()
|
|
926
|
+
guard now - lastProgressEmitTime >= 0.016 else { return }
|
|
927
|
+
lastProgressEmitTime = now
|
|
928
|
+
body = ["status": "pulling", "progress": progress]
|
|
929
|
+
case .triggered:
|
|
930
|
+
body = ["status": "triggered", "progress": 0.0]
|
|
931
|
+
case .refreshing:
|
|
932
|
+
body = ["status": "refreshing", "progress": 0.0]
|
|
933
|
+
}
|
|
934
|
+
emitOnMain("onRefreshStateChanged", body: body)
|
|
833
935
|
}
|
|
834
936
|
|
|
835
937
|
public func shortKit(_ shortKit: ShortKit, didFetchContentItems items: [ContentItem]) {
|
package/ios/ShortKitModule.mm
CHANGED
|
@@ -72,7 +72,7 @@ RCT_EXPORT_MODULE(ShortKitModule)
|
|
|
72
72
|
@"onContentTapped",
|
|
73
73
|
@"onDismiss",
|
|
74
74
|
@"onFeedReady",
|
|
75
|
-
@"
|
|
75
|
+
@"onRefreshStateChanged",
|
|
76
76
|
@"onDidFetchContentItems",
|
|
77
77
|
@"onOverlayActiveChanged",
|
|
78
78
|
@"onOverlayPlayerStateChanged",
|
|
@@ -83,6 +83,8 @@ RCT_EXPORT_MODULE(ShortKitModule)
|
|
|
83
83
|
@"onOverlayFeedScrollPhaseChanged",
|
|
84
84
|
@"onOverlayTimeUpdate",
|
|
85
85
|
@"onOverlayFullState",
|
|
86
|
+
@"onCarouselActiveImageChanged",
|
|
87
|
+
@"onVideoCarouselActiveVideoChanged",
|
|
86
88
|
];
|
|
87
89
|
}
|
|
88
90
|
|
|
@@ -106,7 +108,6 @@ RCT_EXPORT_MODULE(ShortKitModule)
|
|
|
106
108
|
|
|
107
109
|
- (void)emitEvent:(NSString *)name body:(NSDictionary *)body {
|
|
108
110
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
109
|
-
// New Architecture: use the codegen EventEmitterCallback directly
|
|
110
111
|
if (_eventEmitterCallback) {
|
|
111
112
|
_eventEmitterCallback(std::string([name UTF8String]), body);
|
|
112
113
|
}
|
|
@@ -263,9 +264,18 @@ RCT_EXPORT_METHOD(preloadFeed:(NSString *)configJSON
|
|
|
263
264
|
itemsJSON:(NSString *)itemsJSON
|
|
264
265
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
265
266
|
reject:(RCTPromiseRejectBlock)reject) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
if (_shortKitBridge) {
|
|
268
|
+
[_shortKitBridge preloadFeed:configJSON itemsJSON:itemsJSON completion:^(NSString *uuid) {
|
|
269
|
+
resolve(uuid);
|
|
270
|
+
}];
|
|
271
|
+
} else {
|
|
272
|
+
if (!_pendingBridgeOps) _pendingBridgeOps = [NSMutableArray new];
|
|
273
|
+
[_pendingBridgeOps addObject:^{
|
|
274
|
+
[self->_shortKitBridge preloadFeed:configJSON itemsJSON:itemsJSON completion:^(NSString *uuid) {
|
|
275
|
+
resolve(uuid);
|
|
276
|
+
}];
|
|
277
|
+
}];
|
|
278
|
+
}
|
|
269
279
|
}
|
|
270
280
|
|
|
271
281
|
// MARK: - Storyboard / Seek Thumbnails
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>ShortKitSDK.framework/ShortKitSDK</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-arm64
|
|
11
|
+
<string>ios-arm64</string>
|
|
12
12
|
<key>LibraryPath</key>
|
|
13
13
|
<string>ShortKitSDK.framework</string>
|
|
14
14
|
<key>SupportedArchitectures</key>
|
|
@@ -17,22 +17,23 @@
|
|
|
17
17
|
</array>
|
|
18
18
|
<key>SupportedPlatform</key>
|
|
19
19
|
<string>ios</string>
|
|
20
|
-
<key>SupportedPlatformVariant</key>
|
|
21
|
-
<string>simulator</string>
|
|
22
20
|
</dict>
|
|
23
21
|
<dict>
|
|
24
22
|
<key>BinaryPath</key>
|
|
25
23
|
<string>ShortKitSDK.framework/ShortKitSDK</string>
|
|
26
24
|
<key>LibraryIdentifier</key>
|
|
27
|
-
<string>ios-
|
|
25
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
28
26
|
<key>LibraryPath</key>
|
|
29
27
|
<string>ShortKitSDK.framework</string>
|
|
30
28
|
<key>SupportedArchitectures</key>
|
|
31
29
|
<array>
|
|
32
30
|
<string>arm64</string>
|
|
31
|
+
<string>x86_64</string>
|
|
33
32
|
</array>
|
|
34
33
|
<key>SupportedPlatform</key>
|
|
35
34
|
<string>ios</string>
|
|
35
|
+
<key>SupportedPlatformVariant</key>
|
|
36
|
+
<string>simulator</string>
|
|
36
37
|
</dict>
|
|
37
38
|
</array>
|
|
38
39
|
<key>CFBundlePackageType</key>
|
package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Headers/ShortKitSDK-Swift.h
CHANGED
|
@@ -360,6 +360,7 @@ SWIFT_CLASS("_TtC11ShortKitSDK26ShortKitFeedViewController")
|
|
|
360
360
|
- (void)scrollViewWillBeginDragging:(UIScrollView * _Nonnull)scrollView;
|
|
361
361
|
- (void)scrollViewDidEndDecelerating:(UIScrollView * _Nonnull)scrollView;
|
|
362
362
|
- (void)scrollViewDidEndDragging:(UIScrollView * _Nonnull)scrollView willDecelerate:(BOOL)decelerate;
|
|
363
|
+
- (void)scrollViewDidScrollToTop:(UIScrollView * _Nonnull)scrollView;
|
|
363
364
|
- (void)scrollViewDidScroll:(UIScrollView * _Nonnull)scrollView;
|
|
364
365
|
@end
|
|
365
366
|
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
<key>CFBundlePackageType</key>
|
|
12
12
|
<string>FMWK</string>
|
|
13
13
|
<key>CFBundleVersion</key>
|
|
14
|
-
<string>
|
|
14
|
+
<string>0.2.15</string>
|
|
15
|
+
<key>CFBundleShortVersionString</key>
|
|
16
|
+
<string>0.2.15</string>
|
|
17
|
+
<key>MinimumOSVersion</key>
|
|
18
|
+
<string>16.0</string>
|
|
15
19
|
</dict>
|
|
16
20
|
</plist>
|