refactor(ios): remove orphaned Share Extension diagnostics API
Remove the getShareExtensionDiagnostics() API now that the share-target investigation is complete and it has no remaining callers. - Drop getShareExtensionDiagnostics from the plugin definition, web stub, Swift plugin method + registration, and SharedImageUtility implementation - Remove the ShareExtensionDiagnostics TypeScript interface and its now-dead import in the web stub - Remove the diagnostics-only [ShareTarget] log line and the now-unused shareExtensionLastStartKey constant in SharedImageUtility getSharedImage/hasSharedImage, SharedPhotoReady logic, ShareViewController, AppDelegate, and Android are unchanged. TypeScript type-check passes.
This commit is contained in:
@@ -24,8 +24,7 @@ public class SharedImagePlugin: CAPPlugin, CAPBridgedPlugin {
|
||||
public var pluginMethods: [CAPPluginMethod] {
|
||||
return [
|
||||
CAPPluginMethod(#selector(getSharedImage(_:)), returnType: .promise),
|
||||
CAPPluginMethod(#selector(hasSharedImage(_:)), returnType: .promise),
|
||||
CAPPluginMethod(#selector(getShareExtensionDiagnostics(_:)), returnType: .promise)
|
||||
CAPPluginMethod(#selector(hasSharedImage(_:)), returnType: .promise)
|
||||
]
|
||||
}
|
||||
|
||||
@@ -63,12 +62,5 @@ public class SharedImagePlugin: CAPPlugin, CAPBridgedPlugin {
|
||||
"hasImage": hasImage
|
||||
])
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnostic snapshot of Share Extension startup and pending share state
|
||||
*/
|
||||
@objc public func getShareExtensionDiagnostics(_ call: CAPPluginCall) {
|
||||
call.resolve(SharedImageUtility.getShareExtensionDiagnostics())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ public class SharedImageUtility {
|
||||
private static let sharedPhotoFileNameKey = "sharedPhotoFileName"
|
||||
private static let sharedPhotoFilePathKey = "sharedPhotoFilePath"
|
||||
private static let sharedPhotoShareIdKey = "sharedPhotoShareId"
|
||||
private static let shareExtensionLastStartKey = "shareExtensionLastStart"
|
||||
private static let sharedPhotoReadyKey = "sharedPhotoReady"
|
||||
|
||||
/// Get the App Group container URL for accessing shared files
|
||||
@@ -98,41 +97,6 @@ public class SharedImageUtility {
|
||||
return FileManager.default.fileExists(atPath: fileURL.path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnostic snapshot of Share Extension startup and pending share state
|
||||
* Read-only: does not modify App Group storage
|
||||
*/
|
||||
static func getShareExtensionDiagnostics() -> [String: Any] {
|
||||
guard let userDefaults = UserDefaults(suiteName: appGroupIdentifier) else {
|
||||
return [
|
||||
"shareExtensionLastStart": NSNull(),
|
||||
"sharedPhotoShareId": NSNull(),
|
||||
"sharedPhotoFilePath": NSNull(),
|
||||
"fileExists": false
|
||||
]
|
||||
}
|
||||
|
||||
let shareExtensionLastStart = userDefaults.string(forKey: shareExtensionLastStartKey)
|
||||
let shareId = userDefaults.string(forKey: sharedPhotoShareIdKey)
|
||||
let filePath = userDefaults.string(forKey: sharedPhotoFilePathKey)
|
||||
let fileExists: Bool
|
||||
if let filePath = filePath, let containerURL = appGroupContainerURL {
|
||||
let fileURL = containerURL.appendingPathComponent(filePath)
|
||||
fileExists = FileManager.default.fileExists(atPath: fileURL.path)
|
||||
} else {
|
||||
fileExists = false
|
||||
}
|
||||
|
||||
print("[ShareTarget] getShareExtensionDiagnostics shareExtensionLastStart=\(shareExtensionLastStart ?? "nil") sharedPhotoShareId=\(shareId ?? "nil") sharedPhotoFilePath=\(filePath ?? "nil") fileExists=\(fileExists)")
|
||||
|
||||
return [
|
||||
"shareExtensionLastStart": shareExtensionLastStart ?? NSNull(),
|
||||
"sharedPhotoShareId": shareId ?? NSNull(),
|
||||
"sharedPhotoFilePath": filePath ?? NSNull(),
|
||||
"fileExists": fileExists
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if shared photo ready flag is set
|
||||
* This flag is set by the Share Extension when image is ready
|
||||
|
||||
Reference in New Issue
Block a user