fix(ios): resolve getSharedImage() with null when no share pending

When no shared image exists, return a bare Capacitor resolve instead of
an object with null base64/fileName/shareId fields, matching the
TypeScript contract and web implementation.
This commit is contained in:
Jose Olarte III
2026-07-01 17:04:45 +08:00
parent 0c91b687f9
commit 85ac6632ed

View File

@@ -34,17 +34,13 @@ public class SharedImagePlugin: CAPPlugin, CAPBridgedPlugin {
/**
* Get shared image data from App Group UserDefaults
* Returns base64 string, fileName, and shareId, or null fields if no image exists
* Returns base64 string, fileName, and shareId, or null if no image exists
* Read-only: native metadata and file are left intact after retrieval (Phase 1C)
*/
@objc public func getSharedImage(_ call: CAPPluginCall) {
guard let sharedData = SharedImageUtility.getSharedImageData() else {
// No shared image exists - return null (not an error)
call.resolve([
"base64": NSNull(),
"fileName": NSNull(),
"shareId": NSNull()
])
call.resolve()
return
}