feat(ios): expose shareId from getSharedImage()

Include the existing native sharedPhotoShareId in the SharedImage
getSharedImage() result so the web layer can identify the current share.
Add shareId to the native result dictionary and plugin response (NSNull on
the no-image branch), and add shareId: string to the TypeScript
SharedImageResult interface.

This surfaces a value that was already produced natively (previously used
only for logging) so application code can later pass it to markProcessed().
No behavior changes beyond exposing the value; Android untouched. Updates
doc/share-target-ios-audit.md accordingly.
This commit is contained in:
Jose Olarte III
2026-06-30 11:02:59 +08:00
parent 981f8b77d0
commit a3e9a0104d
4 changed files with 19 additions and 6 deletions

View File

@@ -33,7 +33,7 @@ public class SharedImagePlugin: CAPPlugin, CAPBridgedPlugin {
/**
* Get shared image data from App Group UserDefaults
* Returns base64 string and fileName, or null if no image exists
* Returns base64 string, fileName, and shareId, or null fields if no image exists
* Read-only: native metadata and file are left intact after retrieval (Phase 1C)
*/
@objc public func getSharedImage(_ call: CAPPluginCall) {
@@ -41,7 +41,8 @@ public class SharedImagePlugin: CAPPlugin, CAPBridgedPlugin {
// No shared image exists - return null (not an error)
call.resolve([
"base64": NSNull(),
"fileName": NSNull()
"fileName": NSNull(),
"shareId": NSNull()
])
return
}
@@ -49,7 +50,8 @@ public class SharedImagePlugin: CAPPlugin, CAPBridgedPlugin {
// Return the shared image data
call.resolve([
"base64": sharedData["base64"] ?? "",
"fileName": sharedData["fileName"] ?? ""
"fileName": sharedData["fileName"] ?? "",
"shareId": sharedData["shareId"] ?? ""
])
}

View File

@@ -44,7 +44,7 @@ public class SharedImageUtility {
* All images are stored as files for consistency and to avoid UserDefaults size limits
* Read-only: metadata and file are left intact after retrieval (Phase 1C)
*
* @returns Dictionary with "base64" and "fileName" keys, or nil if no shared image
* @returns Dictionary with "base64", "fileName", and "shareId" keys, or nil if no shared image
*/
static func getSharedImageData() -> [String: String]? {
let userDefaults = UserDefaults(suiteName: appGroupIdentifier)
@@ -76,7 +76,7 @@ public class SharedImageUtility {
// Convert file data to base64 for JavaScript consumption
let base64String = imageData.base64EncodedString()
return ["base64": base64String, "fileName": fileName]
return ["base64": base64String, "fileName": fileName, "shareId": resolvedShareId]
}
/**