@shortkitsdk/react-native 0.2.30 → 0.2.32
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/ios/ShortKitBridge.swift +77 -3
- package/ios/ShortKitFeedView.swift +1 -12
- package/ios/ShortKitModule.mm +5 -1
- 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 +5652 -972
- package/ios/ShortKitSDK.xcframework/ios-arm64/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +111 -9
- 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 +111 -9
- 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 +5652 -972
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +111 -9
- 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 +111 -9
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +5652 -972
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/Modules/ShortKitSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +111 -9
- 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 +111 -9
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/ShortKitSDK +0 -0
- package/ios/ShortKitSDK.xcframework/ios-arm64_x86_64-simulator/ShortKitSDK.framework/_CodeSignature/CodeResources +17 -17
- package/ios/ShortKitWidgetNativeView.swift +23 -0
- package/ios/ShortKitWidgetNativeViewManager.mm +1 -0
- package/package.json +1 -1
- package/src/ShortKitCommands.ts +12 -2
- package/src/ShortKitContext.ts +7 -1
- package/src/ShortKitWidget.tsx +47 -2
- package/src/specs/NativeShortKitModule.ts +9 -1
- package/src/specs/ShortKitWidgetViewNativeComponent.ts +6 -0
- package/src/types.ts +15 -0
- package/ios/DebugPanelView.swift +0 -302
|
Binary file
|
package/ios/ShortKitBridge.swift
CHANGED
|
@@ -1164,13 +1164,31 @@ extension ShortKitBridge: ShortKitDownloadDelegate {
|
|
|
1164
1164
|
emitOnMain("onDownloadStarted", body: ["itemId": item.id])
|
|
1165
1165
|
}
|
|
1166
1166
|
|
|
1167
|
+
// Legacy phase-less progress overload. Intentionally a no-op on the
|
|
1168
|
+
// bridge: `DownloadManager.emitProgress` invokes both this method and
|
|
1169
|
+
// the phase-aware overload below for backwards compatibility with
|
|
1170
|
+
// native Swift delegates that only implement the legacy method, but
|
|
1171
|
+
// RN consumers want a single phase-aware emit per progress tick.
|
|
1172
|
+
// Suppressing the legacy emit here avoids double-firing
|
|
1173
|
+
// `onDownloadProgress` (and prevents the `phase` field from being
|
|
1174
|
+
// dropped when this overload would otherwise win the throttle gate).
|
|
1167
1175
|
public func shortKit(_ shortKit: ShortKit, didUpdateDownloadProgress item: ContentItem, progress: Double) {
|
|
1176
|
+
// No-op — see comment above.
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
public func shortKit(
|
|
1180
|
+
_ shortKit: ShortKit,
|
|
1181
|
+
didUpdateDownloadProgress item: ContentItem,
|
|
1182
|
+
progress: Double,
|
|
1183
|
+
phase: DownloadPhase
|
|
1184
|
+
) {
|
|
1168
1185
|
let now = CACurrentMediaTime()
|
|
1169
1186
|
guard now - lastDownloadProgressEmitTime >= 0.1 else { return }
|
|
1170
1187
|
lastDownloadProgressEmitTime = now
|
|
1171
1188
|
emitOnMain("onDownloadProgress", body: [
|
|
1172
1189
|
"itemId": item.id,
|
|
1173
1190
|
"progress": progress,
|
|
1191
|
+
"phase": phase.rawValue,
|
|
1174
1192
|
])
|
|
1175
1193
|
}
|
|
1176
1194
|
|
|
@@ -1194,6 +1212,10 @@ extension ShortKitBridge: ShortKitDownloadDelegate {
|
|
|
1194
1212
|
message = "HTTP error: \(statusCode)"
|
|
1195
1213
|
case .cancelled:
|
|
1196
1214
|
message = "Download cancelled"
|
|
1215
|
+
case .exportFailed(let underlying):
|
|
1216
|
+
message = "Overlay export failed: \(underlying.localizedDescription)"
|
|
1217
|
+
case .overlayNotVisibleForSnapshot:
|
|
1218
|
+
message = "Overlay not visible for snapshot"
|
|
1197
1219
|
}
|
|
1198
1220
|
emitOnMain("onDownloadFailed", body: [
|
|
1199
1221
|
"itemId": item.id,
|
|
@@ -1205,9 +1227,16 @@ extension ShortKitBridge: ShortKitDownloadDelegate {
|
|
|
1205
1227
|
// MARK: - Downloads
|
|
1206
1228
|
|
|
1207
1229
|
extension ShortKitBridge {
|
|
1208
|
-
@objc public func downloadVideo(
|
|
1230
|
+
@objc public func downloadVideo(
|
|
1231
|
+
_ itemId: String,
|
|
1232
|
+
mode: String,
|
|
1233
|
+
overlayMode: String,
|
|
1234
|
+
completion: @escaping (String?, NSError?) -> Void
|
|
1235
|
+
) {
|
|
1236
|
+
print("[SKComposite] Bridge.downloadVideo ENTER itemId=\(itemId) mode=\(mode) overlayMode=\(overlayMode)")
|
|
1209
1237
|
DispatchQueue.main.async {
|
|
1210
1238
|
guard let shortKit = self.shortKit else {
|
|
1239
|
+
print("[SKComposite] Bridge.downloadVideo ERROR shortKit==nil")
|
|
1211
1240
|
completion(nil, NSError(domain: "ShortKitBridge", code: 1, userInfo: [
|
|
1212
1241
|
NSLocalizedDescriptionKey: "ShortKit not initialized"
|
|
1213
1242
|
]))
|
|
@@ -1215,25 +1244,70 @@ extension ShortKitBridge {
|
|
|
1215
1244
|
}
|
|
1216
1245
|
|
|
1217
1246
|
guard let item = self.itemCache[itemId] else {
|
|
1247
|
+
print("[SKComposite] Bridge.downloadVideo ERROR itemCache miss — cache has \(self.itemCache.count) items; keys=\(Array(self.itemCache.keys).prefix(5))")
|
|
1218
1248
|
completion(nil, NSError(domain: "ShortKitBridge", code: 2, userInfo: [
|
|
1219
1249
|
NSLocalizedDescriptionKey: "Content item not found: \(itemId)"
|
|
1220
1250
|
]))
|
|
1221
1251
|
return
|
|
1222
1252
|
}
|
|
1253
|
+
print("[SKComposite] Bridge.downloadVideo resolved item id=\(item.id) title=\(item.title) isLive=\(item.isLive) downloadUrl=\(item.downloadUrl ?? "<nil>")")
|
|
1223
1254
|
|
|
1224
1255
|
let downloadMode: DownloadMode = mode == "interruptive" ? .interruptive : .nonInterruptive
|
|
1225
1256
|
|
|
1257
|
+
let resolvedOverlayMode: DownloadOverlayMode
|
|
1258
|
+
switch overlayMode {
|
|
1259
|
+
case "static":
|
|
1260
|
+
print("[SKComposite] Bridge.downloadVideo resolving overlay — feedRegistry has \(self.feedRegistry.count) feeds")
|
|
1261
|
+
guard let overlay = self.findActiveOverlay(for: itemId) else {
|
|
1262
|
+
print("[SKComposite] Bridge.downloadVideo ERROR no visible overlay found for itemId=\(itemId)")
|
|
1263
|
+
completion(nil, ShortKitDownloadError.overlayNotVisibleForSnapshot as NSError)
|
|
1264
|
+
return
|
|
1265
|
+
}
|
|
1266
|
+
print("[SKComposite] Bridge.downloadVideo found overlay class=\(type(of: overlay)) bounds=\(overlay.bounds)")
|
|
1267
|
+
resolvedOverlayMode = .staticSnapshot(source: overlay)
|
|
1268
|
+
case "deterministic":
|
|
1269
|
+
print("[SKComposite] Bridge.downloadVideo deterministic mode requested — Phase 2, not implemented")
|
|
1270
|
+
completion(nil, ShortKitDownloadError.downloadNotAvailable as NSError)
|
|
1271
|
+
return
|
|
1272
|
+
default:
|
|
1273
|
+
resolvedOverlayMode = .none
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1226
1276
|
Task {
|
|
1227
1277
|
do {
|
|
1228
|
-
|
|
1278
|
+
print("[SKComposite] Bridge.downloadVideo calling shortKit.downloadVideo(mode=\(downloadMode), overlayMode=\(overlayMode))")
|
|
1279
|
+
let fileURL = try await shortKit.downloadVideo(item, mode: downloadMode, overlayMode: resolvedOverlayMode)
|
|
1280
|
+
print("[SKComposite] Bridge.downloadVideo SUCCESS fileURL=\(fileURL.absoluteString)")
|
|
1229
1281
|
completion(fileURL.absoluteString, nil)
|
|
1230
1282
|
} catch {
|
|
1231
|
-
|
|
1283
|
+
let ns = error as NSError
|
|
1284
|
+
print("[SKComposite] Bridge.downloadVideo ERROR domain=\(ns.domain) code=\(ns.code) desc=\(ns.localizedDescription) userInfo=\(ns.userInfo)")
|
|
1285
|
+
completion(nil, ns)
|
|
1232
1286
|
}
|
|
1233
1287
|
}
|
|
1234
1288
|
}
|
|
1235
1289
|
}
|
|
1236
1290
|
|
|
1291
|
+
/// Finds the currently-attached overlay for the given item ID by iterating
|
|
1292
|
+
/// all registered feed view controllers. Returns the first match, or nil
|
|
1293
|
+
/// if no visible cell is found for this item in any registered feed.
|
|
1294
|
+
@MainActor
|
|
1295
|
+
private func findActiveOverlay(for itemId: String) -> (UIView & FeedOverlay)? {
|
|
1296
|
+
for (feedId, entry) in feedRegistry {
|
|
1297
|
+
guard let vc = entry.vc else {
|
|
1298
|
+
print("[SKComposite] findActiveOverlay feedId=\(feedId) vc was deallocated")
|
|
1299
|
+
continue
|
|
1300
|
+
}
|
|
1301
|
+
if let overlay = vc.overlayView(forItemId: itemId) {
|
|
1302
|
+
print("[SKComposite] findActiveOverlay matched in feedId=\(feedId)")
|
|
1303
|
+
return overlay
|
|
1304
|
+
} else {
|
|
1305
|
+
print("[SKComposite] findActiveOverlay miss in feedId=\(feedId) — no visible cell for itemId=\(itemId)")
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
return nil
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1237
1311
|
@objc public func cancelDownload() {
|
|
1238
1312
|
shortKit?.cancelDownload()
|
|
1239
1313
|
}
|
|
@@ -174,18 +174,7 @@ import ShortKitSDK
|
|
|
174
174
|
|
|
175
175
|
let debugPanelEnabled = self.debugPanel?.boolValue ?? sdk.debugPanelEnabled
|
|
176
176
|
if debugPanelEnabled {
|
|
177
|
-
feedVC.debugPanelFactory =
|
|
178
|
-
let panel = DebugPanelView(frame: CGRect(
|
|
179
|
-
x: 0, y: 0,
|
|
180
|
-
width: DebugPanelView.panelWidth,
|
|
181
|
-
height: DebugPanelView.panelHeight
|
|
182
|
-
))
|
|
183
|
-
panel.center = CGPoint(x: UIScreen.main.bounds.width / 2,
|
|
184
|
-
y: UIScreen.main.bounds.height / 2)
|
|
185
|
-
panel.subscribe(to: active)
|
|
186
|
-
panel.subscribeAdjacent(prev: prev, next: next)
|
|
187
|
-
return panel
|
|
188
|
-
}
|
|
177
|
+
feedVC.debugPanelFactory = ShortKit.defaultDebugPanelFactory
|
|
189
178
|
}
|
|
190
179
|
|
|
191
180
|
feedVC.onDismiss = {
|
package/ios/ShortKitModule.mm
CHANGED
|
@@ -363,12 +363,16 @@ RCT_EXPORT_METHOD(getStoryboardData:(NSString *)playbackId
|
|
|
363
363
|
|
|
364
364
|
RCT_EXPORT_METHOD(downloadVideo:(NSString *)itemId
|
|
365
365
|
mode:(NSString *)mode
|
|
366
|
+
overlayMode:(NSString *)overlayMode
|
|
366
367
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
367
368
|
reject:(RCTPromiseRejectBlock)reject) {
|
|
368
|
-
[
|
|
369
|
+
NSLog(@"[SKComposite] Module.downloadVideo ENTER itemId=%@ mode=%@ overlayMode=%@", itemId, mode, overlayMode);
|
|
370
|
+
[_shortKitBridge downloadVideo:itemId mode:mode overlayMode:overlayMode completion:^(NSString *fileUrl, NSError *error) {
|
|
369
371
|
if (error) {
|
|
372
|
+
NSLog(@"[SKComposite] Module.downloadVideo REJECT domain=%@ code=%ld desc=%@", error.domain, (long)error.code, error.localizedDescription);
|
|
370
373
|
reject(@"DOWNLOAD_ERROR", error.localizedDescription, error);
|
|
371
374
|
} else {
|
|
375
|
+
NSLog(@"[SKComposite] Module.downloadVideo RESOLVE fileUrl=%@", fileUrl);
|
|
372
376
|
resolve(fileUrl);
|
|
373
377
|
}
|
|
374
378
|
}];
|
|
@@ -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.32</string>
|
|
15
15
|
<key>CFBundleShortVersionString</key>
|
|
16
|
-
<string>0.2.
|
|
16
|
+
<string>0.2.32</string>
|
|
17
17
|
<key>MinimumOSVersion</key>
|
|
18
18
|
<string>16.0</string>
|
|
19
19
|
</dict>
|