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] {
|
public var pluginMethods: [CAPPluginMethod] {
|
||||||
return [
|
return [
|
||||||
CAPPluginMethod(#selector(getSharedImage(_:)), returnType: .promise),
|
CAPPluginMethod(#selector(getSharedImage(_:)), returnType: .promise),
|
||||||
CAPPluginMethod(#selector(hasSharedImage(_:)), returnType: .promise),
|
CAPPluginMethod(#selector(hasSharedImage(_:)), returnType: .promise)
|
||||||
CAPPluginMethod(#selector(getShareExtensionDiagnostics(_:)), returnType: .promise)
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,12 +62,5 @@ public class SharedImagePlugin: CAPPlugin, CAPBridgedPlugin {
|
|||||||
"hasImage": hasImage
|
"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 sharedPhotoFileNameKey = "sharedPhotoFileName"
|
||||||
private static let sharedPhotoFilePathKey = "sharedPhotoFilePath"
|
private static let sharedPhotoFilePathKey = "sharedPhotoFilePath"
|
||||||
private static let sharedPhotoShareIdKey = "sharedPhotoShareId"
|
private static let sharedPhotoShareIdKey = "sharedPhotoShareId"
|
||||||
private static let shareExtensionLastStartKey = "shareExtensionLastStart"
|
|
||||||
private static let sharedPhotoReadyKey = "sharedPhotoReady"
|
private static let sharedPhotoReadyKey = "sharedPhotoReady"
|
||||||
|
|
||||||
/// Get the App Group container URL for accessing shared files
|
/// Get the App Group container URL for accessing shared files
|
||||||
@@ -98,41 +97,6 @@ public class SharedImageUtility {
|
|||||||
return FileManager.default.fileExists(atPath: fileURL.path)
|
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
|
* Check if shared photo ready flag is set
|
||||||
* This flag is set by the Share Extension when image is ready
|
* This flag is set by the Share Extension when image is ready
|
||||||
|
|||||||
@@ -4,11 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { WebPlugin } from "@capacitor/core";
|
import { WebPlugin } from "@capacitor/core";
|
||||||
import type {
|
import type { SharedImagePlugin, SharedImageResult } from "./definitions";
|
||||||
SharedImagePlugin,
|
|
||||||
SharedImageResult,
|
|
||||||
ShareExtensionDiagnostics,
|
|
||||||
} from "./definitions";
|
|
||||||
|
|
||||||
export class SharedImagePluginWeb
|
export class SharedImagePluginWeb
|
||||||
extends WebPlugin
|
extends WebPlugin
|
||||||
@@ -22,13 +18,4 @@ export class SharedImagePluginWeb
|
|||||||
async hasSharedImage(): Promise<{ hasImage: boolean }> {
|
async hasSharedImage(): Promise<{ hasImage: boolean }> {
|
||||||
return { hasImage: false };
|
return { hasImage: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
async getShareExtensionDiagnostics(): Promise<ShareExtensionDiagnostics> {
|
|
||||||
return {
|
|
||||||
shareExtensionLastStart: null,
|
|
||||||
sharedPhotoShareId: null,
|
|
||||||
sharedPhotoFilePath: null,
|
|
||||||
fileExists: false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,6 @@ export interface SharedImageResult {
|
|||||||
fileName: string;
|
fileName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShareExtensionDiagnostics {
|
|
||||||
shareExtensionLastStart: string | null;
|
|
||||||
sharedPhotoShareId: string | null;
|
|
||||||
sharedPhotoFilePath: string | null;
|
|
||||||
fileExists: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SharedImagePlugin {
|
export interface SharedImagePlugin {
|
||||||
/**
|
/**
|
||||||
* Get shared image data from native layer
|
* Get shared image data from native layer
|
||||||
@@ -27,9 +20,4 @@ export interface SharedImagePlugin {
|
|||||||
* Useful for quick checks before calling getSharedImage()
|
* Useful for quick checks before calling getSharedImage()
|
||||||
*/
|
*/
|
||||||
hasSharedImage(): Promise<{ hasImage: boolean }>;
|
hasSharedImage(): Promise<{ hasImage: boolean }>;
|
||||||
|
|
||||||
/**
|
|
||||||
* Diagnostic snapshot of Share Extension startup and pending share state (iOS)
|
|
||||||
*/
|
|
||||||
getShareExtensionDiagnostics(): Promise<ShareExtensionDiagnostics>;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user