From 7093f38e09445ad44bcf8f5d251f216c70ac0b93 Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Tue, 30 Jun 2026 22:05:29 +0800 Subject: [PATCH] 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= 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. --- ios/App/App/SharedImageUtility.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ios/App/App/SharedImageUtility.swift b/ios/App/App/SharedImageUtility.swift index 72cb1b64..defacc51 100644 --- a/ios/App/App/SharedImageUtility.swift +++ b/ios/App/App/SharedImageUtility.swift @@ -62,6 +62,19 @@ public class SharedImageUtility { let fileName = userDefaults.string(forKey: sharedPhotoFileNameKey) ?? "shared-image.jpg" 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) // Read image data from file