@shortkitsdk/react-native 0.2.27 → 0.2.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/libs/shortkit-release.aar +0 -0
- package/android/src/main/java/com/shortkit/reactnative/ShortKitBridge.kt +8 -0
- package/android/src/main/java/com/shortkit/reactnative/ShortKitModule.kt +10 -0
- package/android/src/main/java/com/shortkit/reactnative/ShortKitPlayerNativeView.kt +4 -0
- package/android/src/main/java/com/shortkit/reactnative/ShortKitWidgetNativeView.kt +45 -33
- package/ios/ReactVideoCarouselOverlayHost.swift +6 -0
- package/ios/ShortKitBridge.swift +142 -35
- package/ios/ShortKitFeedView.swift +43 -44
- package/ios/ShortKitModule.mm +11 -0
- package/ios/ShortKitPlayerNativeView.swift +7 -1
- package/ios/ShortKitSDK.xcframework/Info.plist +5 -5
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Info.plist +2 -2
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.abi.json +950 -126
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +26 -3
- 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 +26 -3
- 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 +950 -126
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +26 -3
- 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 +26 -3
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +950 -126
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +26 -3
- 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 +26 -3
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/_CodeSignature/CodeResources +17 -17
- package/ios/ShortKitWidgetNativeView.swift +33 -12
- package/package.json +1 -1
- package/src/ShortKitFeed.tsx +34 -0
- package/src/ShortKitPlayer.tsx +25 -15
- package/src/ShortKitWidget.tsx +24 -18
- package/src/index.ts +1 -0
- package/src/serialization.ts +38 -0
- package/src/specs/NativeShortKitModule.ts +7 -0
- package/src/types.ts +19 -1
|
@@ -38,14 +38,19 @@ import ShortKitSDK
|
|
|
38
38
|
didSet { /* used at embed time only */ }
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
///
|
|
42
|
-
///
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
/// The `active` prop is authoritative: whenever the view is deciding
|
|
42
|
+
/// whether to activate/deactivate/suspend its FeedViewController, it
|
|
43
|
+
/// consults this value directly. The `didSet` only exists to react to
|
|
44
|
+
/// transitions while the VC already exists. Transitions that arrive
|
|
45
|
+
/// before the VC is created (a common Fabric ordering: props set on the
|
|
46
|
+
/// view instance before `didMoveToWindow` runs) are stored in the Bool
|
|
47
|
+
/// property by Swift automatically — `embedFeedViewControllerIfNeeded`
|
|
48
|
+
/// reads the current value and acts on it when the VC is finally set up.
|
|
45
49
|
@objc public var active: Bool = true {
|
|
46
50
|
didSet {
|
|
47
|
-
guard active != oldValue, let feedVC = feedViewController else {
|
|
48
|
-
|
|
51
|
+
guard active != oldValue, let feedVC = feedViewController else {
|
|
52
|
+
return
|
|
53
|
+
}
|
|
49
54
|
if active {
|
|
50
55
|
feedVC.activate()
|
|
51
56
|
} else {
|
|
@@ -62,9 +67,16 @@ import ShortKitSDK
|
|
|
62
67
|
|
|
63
68
|
// MARK: - Lifecycle
|
|
64
69
|
|
|
70
|
+
public override init(frame: CGRect) {
|
|
71
|
+
super.init(frame: frame)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public required init?(coder: NSCoder) {
|
|
75
|
+
super.init(coder: coder)
|
|
76
|
+
}
|
|
77
|
+
|
|
65
78
|
public override func didMoveToWindow() {
|
|
66
79
|
super.didMoveToWindow()
|
|
67
|
-
|
|
68
80
|
if window != nil {
|
|
69
81
|
embedFeedViewControllerIfNeeded()
|
|
70
82
|
}
|
|
@@ -72,8 +84,11 @@ import ShortKitSDK
|
|
|
72
84
|
|
|
73
85
|
public override func willMove(toWindow newWindow: UIWindow?) {
|
|
74
86
|
super.willMove(toWindow: newWindow)
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
// Suspend only if we're leaving the window AND the prop says this
|
|
88
|
+
// surface should be active. When the prop is false, the consumer has
|
|
89
|
+
// already driven the VC into deactivate via active.didSet (or will,
|
|
90
|
+
// once the VC exists), and we mustn't double-suspend.
|
|
91
|
+
if newWindow == nil && active {
|
|
77
92
|
suspendFeedViewController()
|
|
78
93
|
}
|
|
79
94
|
}
|
|
@@ -96,18 +111,21 @@ import ShortKitSDK
|
|
|
96
111
|
|
|
97
112
|
// Re-attach an existing suspended VC (e.g. after native stack pop)
|
|
98
113
|
if let feedVC = feedViewController {
|
|
99
|
-
NSLog("[ShortKit FeedView] re-attaching suspended VC feedId=%@", feedId ?? "nil")
|
|
100
114
|
parentVC.addChild(feedVC)
|
|
101
115
|
feedVC.view.frame = bounds
|
|
102
116
|
addSubview(feedVC.view)
|
|
103
117
|
feedVC.didMove(toParent: parentVC)
|
|
104
|
-
|
|
118
|
+
// Authoritative: read the current active prop and act on it.
|
|
119
|
+
// If prop is false, stay deactivated — do NOT claim the pool.
|
|
120
|
+
// This is the fix for the prop-arrived-before-VC race: a prop
|
|
121
|
+
// update dropped by the didSet guard (vcExists=false) lands here
|
|
122
|
+
// and is honored.
|
|
123
|
+
if active {
|
|
105
124
|
feedVC.activate()
|
|
106
125
|
}
|
|
107
126
|
if let feedId = self.feedId {
|
|
108
127
|
ShortKitBridge.shared?.registerFeed(id: feedId, viewController: feedVC)
|
|
109
128
|
}
|
|
110
|
-
NSLog("[ShortKit FeedView] re-attach complete — activate() called")
|
|
111
129
|
return
|
|
112
130
|
}
|
|
113
131
|
|
|
@@ -120,33 +138,22 @@ import ShortKitSDK
|
|
|
120
138
|
|
|
121
139
|
// Consume preload handle if available
|
|
122
140
|
if let preloadId = self.preloadId {
|
|
123
|
-
NSLog("[ShortKit FeedView] preloadId prop: %@", preloadId)
|
|
124
141
|
if let preload = ShortKitBridge.shared?.consumePreload(id: preloadId) {
|
|
125
142
|
feedConfig.preload = preload
|
|
126
|
-
NSLog("[ShortKit FeedView] ✅ Preload handle consumed for feedId: %@", preloadId)
|
|
127
|
-
} else {
|
|
128
|
-
NSLog("[ShortKit FeedView] ❌ No preload handle found for feedId: %@", preloadId)
|
|
129
|
-
NSLog("[ShortKit FeedView] Available preload handles: %@", ShortKitBridge.shared?.preloadHandles.keys.joined(separator: ", ") ?? "none")
|
|
130
143
|
}
|
|
131
144
|
} else if let json = self.feedItemsJSON,
|
|
132
145
|
let items = ShortKitBridge.parseFeedInputs(json) {
|
|
133
146
|
// feedItems prop: wrap in an immediate preload (no async prefetch
|
|
134
147
|
// work — items are available synchronously at viewDidLoad).
|
|
135
148
|
feedConfig.preload = FeedPreload(immediateItems: items)
|
|
136
|
-
NSLog("[ShortKit FeedView] feedItems prop: created immediate preload with %d items", items.count)
|
|
137
|
-
} else {
|
|
138
|
-
NSLog("[ShortKit FeedView] No preloadId or feedItems prop set")
|
|
139
149
|
}
|
|
140
150
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
let feedVC = ShortKitFeedViewController(shortKit: sdk, config: feedConfig, startAtItemId: startAtItemId)
|
|
149
|
-
feedVC.setBridgeManaged()
|
|
151
|
+
let feedVC = ShortKitFeedViewController(
|
|
152
|
+
shortKit: sdk,
|
|
153
|
+
config: feedConfig,
|
|
154
|
+
startAtItemId: startAtItemId,
|
|
155
|
+
lifecycle: .manual
|
|
156
|
+
)
|
|
150
157
|
|
|
151
158
|
// Seed a thumbnail from the host app's image cache so the first cell
|
|
152
159
|
// renders with a visible thumbnail from frame zero. Synchronous
|
|
@@ -174,8 +181,6 @@ import ShortKitSDK
|
|
|
174
181
|
}
|
|
175
182
|
}
|
|
176
183
|
|
|
177
|
-
NSLog("[ShortKit FeedView] VC created successfully (bridge-managed)")
|
|
178
|
-
|
|
179
184
|
feedVC.onDismiss = {
|
|
180
185
|
ShortKitBridge.shared?.emitDismiss()
|
|
181
186
|
}
|
|
@@ -192,13 +197,12 @@ import ShortKitSDK
|
|
|
192
197
|
feedVC.didMove(toParent: parentVC)
|
|
193
198
|
|
|
194
199
|
// With FVC.viewDidAppear no longer self-claiming for bridge-managed
|
|
195
|
-
// surfaces, the bridge is the sole authority on claim timing.
|
|
196
|
-
// the
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
// prop's didSet.
|
|
200
|
+
// surfaces, the bridge is the sole authority on claim timing. Read
|
|
201
|
+
// the authoritative `active` prop and act on it. If the prop is
|
|
202
|
+
// false (including the case where it was set to false before the VC
|
|
203
|
+
// existed and the didSet guard returned early), the FVC stays idle —
|
|
204
|
+
// no claim, no pool mutation, no hijack. A later prop change to
|
|
205
|
+
// active=true triggers `feedVC.activate()` via the prop's didSet.
|
|
202
206
|
if active {
|
|
203
207
|
feedVC.activate()
|
|
204
208
|
}
|
|
@@ -209,20 +213,15 @@ import ShortKitSDK
|
|
|
209
213
|
/// (e.g. pushing a new screen on top). The feedVC and its state are preserved
|
|
210
214
|
/// so they can be re-attached when the view returns to the window.
|
|
211
215
|
private func suspendFeedViewController() {
|
|
212
|
-
NSLog("[ShortKit FeedView] suspendFeedViewController ENTRY feedId=%@", feedId ?? "nil")
|
|
213
216
|
if let feedId = self.feedId {
|
|
214
217
|
ShortKitBridge.shared?.unregisterFeed(id: feedId)
|
|
215
218
|
}
|
|
216
|
-
guard let feedVC = feedViewController else {
|
|
217
|
-
NSLog("[ShortKit FeedView] suspendFeedViewController NOOP — no feedVC")
|
|
218
|
-
return
|
|
219
|
-
}
|
|
219
|
+
guard let feedVC = feedViewController else { return }
|
|
220
220
|
|
|
221
221
|
feedVC.deactivate()
|
|
222
222
|
feedVC.willMove(toParent: nil)
|
|
223
223
|
feedVC.view.removeFromSuperview()
|
|
224
224
|
feedVC.removeFromParent()
|
|
225
|
-
NSLog("[ShortKit FeedView] suspendFeedViewController EXIT — VC retained for re-attach")
|
|
226
225
|
// Keep feedViewController reference — re-attached in embedFeedViewControllerIfNeeded
|
|
227
226
|
}
|
|
228
227
|
|
package/ios/ShortKitModule.mm
CHANGED
|
@@ -308,6 +308,17 @@ RCT_EXPORT_METHOD(applyFilter:(NSString *)feedId filterJSON:(NSString *)filterJS
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
RCT_EXPORT_METHOD(refresh:(NSString *)feedId) {
|
|
312
|
+
if (_shortKitBridge) {
|
|
313
|
+
[_shortKitBridge refresh:feedId];
|
|
314
|
+
} else {
|
|
315
|
+
if (!_pendingBridgeOps) _pendingBridgeOps = [NSMutableArray new];
|
|
316
|
+
[_pendingBridgeOps addObject:^{
|
|
317
|
+
[self->_shortKitBridge refresh:feedId];
|
|
318
|
+
}];
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
311
322
|
RCT_EXPORT_METHOD(preloadFeed:(NSString *)configJSON
|
|
312
323
|
itemsJSON:(NSString *)itemsJSON
|
|
313
324
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
@@ -187,13 +187,19 @@ import ShortKitSDK
|
|
|
187
187
|
overlayMode = .none
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
let feedConfig: FeedConfig = {
|
|
191
|
+
guard let feedConfigStr = obj["feedConfig"] as? String else { return FeedConfig() }
|
|
192
|
+
return ShortKitBridge.parseFeedConfig(feedConfigStr)
|
|
193
|
+
}()
|
|
194
|
+
|
|
190
195
|
return PlayerConfig(
|
|
191
196
|
cornerRadius: cornerRadius,
|
|
192
197
|
clickAction: clickAction,
|
|
193
198
|
autoplay: autoplay,
|
|
194
199
|
loop: loop,
|
|
195
200
|
muteOnStart: muteOnStart,
|
|
196
|
-
videoOverlay: overlayMode
|
|
201
|
+
videoOverlay: overlayMode,
|
|
202
|
+
feedConfig: feedConfig
|
|
197
203
|
)
|
|
198
204
|
}
|
|
199
205
|
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>ShortKitSDK.framework/ShortKitSDK</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-
|
|
11
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
12
12
|
<key>LibraryPath</key>
|
|
13
13
|
<string>ShortKitSDK.framework</string>
|
|
14
14
|
<key>SupportedArchitectures</key>
|
|
15
15
|
<array>
|
|
16
16
|
<string>arm64</string>
|
|
17
|
+
<string>x86_64</string>
|
|
17
18
|
</array>
|
|
18
19
|
<key>SupportedPlatform</key>
|
|
19
20
|
<string>ios</string>
|
|
21
|
+
<key>SupportedPlatformVariant</key>
|
|
22
|
+
<string>simulator</string>
|
|
20
23
|
</dict>
|
|
21
24
|
<dict>
|
|
22
25
|
<key>BinaryPath</key>
|
|
23
26
|
<string>ShortKitSDK.framework/ShortKitSDK</string>
|
|
24
27
|
<key>LibraryIdentifier</key>
|
|
25
|
-
<string>ios-
|
|
28
|
+
<string>ios-arm64</string>
|
|
26
29
|
<key>LibraryPath</key>
|
|
27
30
|
<string>ShortKitSDK.framework</string>
|
|
28
31
|
<key>SupportedArchitectures</key>
|
|
29
32
|
<array>
|
|
30
33
|
<string>arm64</string>
|
|
31
|
-
<string>x86_64</string>
|
|
32
34
|
</array>
|
|
33
35
|
<key>SupportedPlatform</key>
|
|
34
36
|
<string>ios</string>
|
|
35
|
-
<key>SupportedPlatformVariant</key>
|
|
36
|
-
<string>simulator</string>
|
|
37
37
|
</dict>
|
|
38
38
|
</array>
|
|
39
39
|
<key>CFBundlePackageType</key>
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
<key>CFBundlePackageType</key>
|
|
12
12
|
<string>FMWK</string>
|
|
13
13
|
<key>CFBundleVersion</key>
|
|
14
|
-
<string>0.2.
|
|
14
|
+
<string>0.2.29</string>
|
|
15
15
|
<key>CFBundleShortVersionString</key>
|
|
16
|
-
<string>0.2.
|
|
16
|
+
<string>0.2.29</string>
|
|
17
17
|
<key>MinimumOSVersion</key>
|
|
18
18
|
<string>16.0</string>
|
|
19
19
|
</dict>
|