feat(ios): skip already-processed shares in getSharedImageData (Phase 1E)
Return nil from getSharedImageData() when the current sharedPhotoShareId equals the stored sharedPhotoProcessedShareId, so a share that was already marked processed is no longer re-imported on subsequent app activations. The check runs before reading the image file and logs "[ShareTarget] shareId=<id> already processed; skipping". It leaves the image file and all metadata intact (cleanup is deferred to a later phase), and does not change behavior for brand-new shares. iOS only; no changes to markProcessed(), the Share Extension, Android, or the JS flow.
This commit is contained in:
@@ -62,6 +62,19 @@ public class SharedImageUtility {
|
|||||||
|
|
||||||
let fileName = userDefaults.string(forKey: sharedPhotoFileNameKey) ?? "shared-image.jpg"
|
let fileName = userDefaults.string(forKey: sharedPhotoFileNameKey) ?? "shared-image.jpg"
|
||||||
let shareId = userDefaults.string(forKey: sharedPhotoShareIdKey)
|
let shareId = userDefaults.string(forKey: sharedPhotoShareIdKey)
|
||||||
|
|
||||||
|
// Phase 1E: skip a share that has already been marked processed.
|
||||||
|
// If the current pending shareId matches the processed marker, treat it
|
||||||
|
// as if no pending share exists. Leave the file and metadata intact -
|
||||||
|
// cleanup is deferred to a later phase.
|
||||||
|
let processedShareId = userDefaults.string(forKey: sharedPhotoProcessedShareIdKey)
|
||||||
|
if let shareId = shareId,
|
||||||
|
let processedShareId = processedShareId,
|
||||||
|
shareId == processedShareId {
|
||||||
|
print("[ShareTarget] shareId=\(shareId) already processed; skipping")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
let fileURL = containerURL.appendingPathComponent(filePath)
|
let fileURL = containerURL.appendingPathComponent(filePath)
|
||||||
|
|
||||||
// Read image data from file
|
// Read image data from file
|
||||||
|
|||||||
Reference in New Issue
Block a user