chore(ios): remove temporary Share Target trace diagnostics

Remove the native trace infrastructure that was added solely for the iOS
share-target investigation. This reverts the temporary share-extension and
app-launch trace logging along with the APIs and debug UI built on top of it.

- Remove getShareExtensionTrace/clearShareExtensionTrace/getAppLaunchTrace/
  clearAppLaunchTrace from the native plugin, TS definitions, and web stubs
- Remove appendTrace (ShareViewController) and appendAppLaunchTrace
  (SharedImageUtility) implementations and all call sites
- Drop the share-extension-trace.log / app-launch-trace.log file handling
- Delete ShareTargetDebugView, its /share-target-debug route, and the
  TestView entry point
- Remove now-unused AppDelegate isTimesafariURL helper and launchURL local
- Strip trace dump/alert logic from main.capacitor.ts

Share-target behavior, plugin registration, image storage, SharedPhotoReady
logic, Android, and the share-extension diagnostics snapshot are unchanged.
This commit is contained in:
Jose Olarte III
2026-06-29 17:43:17 +08:00
parent 02e6e3427d
commit 43328e9d4b
10 changed files with 1 additions and 555 deletions

View File

@@ -9,13 +9,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// TEMPORARY SHARE TARGET DIAGNOSTICS
let launchURL = launchOptions?[.url] as? URL
// TEMPORARY SHARE TARGET DIAGNOSTICS
SharedImageUtility.appendAppLaunchTrace(
"didFinishLaunchingWithOptions urlSupplied=\(launchURL != nil) url=\(launchURL?.absoluteString ?? "nil") matchesTimesafari=\(AppDelegate.isTimesafariURL(launchURL)) launchOptionsHasURL=\(launchURL != nil) sharedImageActivationInvoked=false"
)
// Set notification center delegate so notifications show in foreground and rollover is triggered
UNUserNotificationCenter.current().delegate = self
@@ -31,36 +24,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
func applicationWillResignActive(_ application: UIApplication) {
// TEMPORARY SHARE TARGET DIAGNOSTICS
SharedImageUtility.appendAppLaunchTrace(
"applicationWillResignActive urlSupplied=false url=nil matchesTimesafari=false launchOptionsHasURL=false sharedImageActivationInvoked=false"
)
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// TEMPORARY SHARE TARGET DIAGNOSTICS
SharedImageUtility.appendAppLaunchTrace(
"applicationDidEnterBackground urlSupplied=false url=nil matchesTimesafari=false launchOptionsHasURL=false sharedImageActivationInvoked=false"
)
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// TEMPORARY SHARE TARGET DIAGNOSTICS
SharedImageUtility.appendAppLaunchTrace(
"applicationWillEnterForeground urlSupplied=false url=nil matchesTimesafari=false launchOptionsHasURL=false sharedImageActivationInvoked=false"
)
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// TEMPORARY SHARE TARGET DIAGNOSTICS
SharedImageUtility.appendAppLaunchTrace(
"applicationDidBecomeActive urlSupplied=false url=nil matchesTimesafari=false launchOptionsHasURL=false sharedImageActivationInvoked=true"
)
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
// Re-set notification delegate when app becomes active (in case Capacitor resets it)
@@ -102,12 +79,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
*/
private func checkForSharedImageOnActivation() {
// Check if shared photo is ready
// TEMPORARY SHARE TARGET DIAGNOSTICS
let isReady = SharedImageUtility.isSharedPhotoReady()
// TEMPORARY SHARE TARGET DIAGNOSTICS
SharedImageUtility.appendAppLaunchTrace(
"checkForSharedImageOnActivation urlSupplied=false url=nil matchesTimesafari=false launchOptionsHasURL=false sharedImageActivationInvoked=true sharedPhotoReady=\(isReady)"
)
if isReady {
// Clear the flag
SharedImageUtility.clearSharedPhotoReadyFlag()
@@ -119,18 +91,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
func applicationWillTerminate(_ application: UIApplication) {
// TEMPORARY SHARE TARGET DIAGNOSTICS
SharedImageUtility.appendAppLaunchTrace(
"applicationWillTerminate urlSupplied=false url=nil matchesTimesafari=false launchOptionsHasURL=false sharedImageActivationInvoked=false"
)
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
// TEMPORARY SHARE TARGET DIAGNOSTICS
SharedImageUtility.appendAppLaunchTrace(
"application(open:) urlSupplied=true url=\(url.absoluteString) matchesTimesafari=\(AppDelegate.isTimesafariURL(url)) launchOptionsHasURL=false sharedImageActivationInvoked=false"
)
// Called when the app was launched with a url. Feel free to add additional processing here,
// but if you want the App API to support tracking app url opens, make sure to keep this call
// Note: Share Extension opens app with timesafari:// (empty path), which is handled by JavaScript
@@ -138,13 +102,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/// Returns true when the supplied URL uses the timesafari:// scheme.
/// Diagnostics-only helper; does not affect URL handling.
private static func isTimesafariURL(_ url: URL?) -> Bool {
return url?.scheme?.lowercased() == "timesafari"
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
// Called when the app was launched with an activity, including Universal Links.
// Feel free to add additional processing here, but if you want the App API to support

View File

@@ -25,15 +25,7 @@ public class SharedImagePlugin: CAPPlugin, CAPBridgedPlugin {
return [
CAPPluginMethod(#selector(getSharedImage(_:)), returnType: .promise),
CAPPluginMethod(#selector(hasSharedImage(_:)), returnType: .promise),
CAPPluginMethod(#selector(getShareExtensionDiagnostics(_:)), returnType: .promise),
// TEMPORARY SHARE TARGET DIAGNOSTICS
CAPPluginMethod(#selector(getShareExtensionTrace(_:)), returnType: .promise),
// TEMPORARY SHARE TARGET DIAGNOSTICS
CAPPluginMethod(#selector(clearShareExtensionTrace(_:)), returnType: .promise),
// TEMPORARY SHARE TARGET DIAGNOSTICS
CAPPluginMethod(#selector(getAppLaunchTrace(_:)), returnType: .promise),
// TEMPORARY SHARE TARGET DIAGNOSTICS
CAPPluginMethod(#selector(clearAppLaunchTrace(_:)), returnType: .promise)
CAPPluginMethod(#selector(getShareExtensionDiagnostics(_:)), returnType: .promise)
]
}
@@ -78,43 +70,5 @@ public class SharedImagePlugin: CAPPlugin, CAPBridgedPlugin {
@objc public func getShareExtensionDiagnostics(_ call: CAPPluginCall) {
call.resolve(SharedImageUtility.getShareExtensionDiagnostics())
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Return the raw Share Extension execution trace log from the App Group container
*/
@objc public func getShareExtensionTrace(_ call: CAPPluginCall) {
call.resolve([
"trace": SharedImageUtility.getShareExtensionTrace()
])
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Delete the Share Extension execution trace log if present
*/
@objc public func clearShareExtensionTrace(_ call: CAPPluginCall) {
SharedImageUtility.clearShareExtensionTrace()
call.resolve()
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Return the raw app launch lifecycle trace log from the App Group container
*/
@objc public func getAppLaunchTrace(_ call: CAPPluginCall) {
call.resolve([
"trace": SharedImageUtility.getAppLaunchTrace()
])
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Delete the app launch lifecycle trace log if present
*/
@objc public func clearAppLaunchTrace(_ call: CAPPluginCall) {
SharedImageUtility.clearAppLaunchTrace()
call.resolve()
}
}

View File

@@ -16,10 +16,6 @@ public class SharedImageUtility {
private static let sharedPhotoShareIdKey = "sharedPhotoShareId"
private static let shareExtensionLastStartKey = "shareExtensionLastStart"
private static let sharedPhotoReadyKey = "sharedPhotoReady"
// TEMPORARY SHARE TARGET DIAGNOSTICS
private static let shareExtensionTraceFileName = "share-extension-trace.log"
// TEMPORARY SHARE TARGET DIAGNOSTICS
private static let appLaunchTraceFileName = "app-launch-trace.log"
/// Get the App Group container URL for accessing shared files
private static var appGroupContainerURL: URL? {
@@ -149,81 +145,6 @@ public class SharedImageUtility {
]
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Read the Share Extension trace file from the App Group container.
* Read-only: does not modify or delete the trace file.
*
* @returns the full trace contents, or an empty string if no trace exists
*/
static func getShareExtensionTrace() -> String {
guard let containerURL = appGroupContainerURL else {
return ""
}
let fileURL = containerURL.appendingPathComponent(shareExtensionTraceFileName)
return (try? String(contentsOf: fileURL, encoding: .utf8)) ?? ""
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Delete the Share Extension trace file from the App Group container if present.
*/
static func clearShareExtensionTrace() {
guard let containerURL = appGroupContainerURL else {
return
}
let fileURL = containerURL.appendingPathComponent(shareExtensionTraceFileName)
try? FileManager.default.removeItem(at: fileURL)
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Append a single timestamped line to the app launch trace file in the
* App Group container. Each line is prefixed with an ISO8601 timestamp.
* Append-only; logging failures are intentionally swallowed (diagnostics only).
*/
static func appendAppLaunchTrace(_ message: String) {
guard let containerURL = appGroupContainerURL else { return }
let fileURL = containerURL.appendingPathComponent(appLaunchTraceFileName)
let timestamp = ISO8601DateFormatter().string(from: Date())
let line = "\(timestamp) \(message)\n"
guard let data = line.data(using: .utf8) else { return }
if let handle = try? FileHandle(forWritingTo: fileURL) {
defer { try? handle.close() }
_ = try? handle.seekToEnd()
try? handle.write(contentsOf: data)
} else {
try? data.write(to: fileURL, options: .atomic)
}
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Read the app launch trace file from the App Group container.
* Read-only: does not modify or delete the trace file.
*
* @returns the full trace contents, or an empty string if no trace exists
*/
static func getAppLaunchTrace() -> String {
guard let containerURL = appGroupContainerURL else {
return ""
}
let fileURL = containerURL.appendingPathComponent(appLaunchTraceFileName)
return (try? String(contentsOf: fileURL, encoding: .utf8)) ?? ""
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Delete the app launch trace file from the App Group container if present.
*/
static func clearAppLaunchTrace() {
guard let containerURL = appGroupContainerURL else {
return
}
let fileURL = containerURL.appendingPathComponent(appLaunchTraceFileName)
try? FileManager.default.removeItem(at: fileURL)
}
/**
* Check if shared photo ready flag is set
* This flag is set by the Share Extension when image is ready

View File

@@ -17,36 +17,12 @@ class ShareViewController: UIViewController {
private let shareExtensionLastStartKey = "shareExtensionLastStart"
private let sharedImageFileName = "shared-image"
// TEMPORARY SHARE TARGET DIAGNOSTICS
private let shareExtensionTraceFileName = "share-extension-trace.log"
/// Get the App Group container URL for storing shared files
private var appGroupContainerURL: URL? {
return FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupIdentifier)
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/// Append a single timestamped line to the Share Extension trace file in the
/// App Group container. Each line is prefixed with an ISO8601 timestamp.
/// Logging failures are intentionally ignored (diagnostics only).
private func appendTrace(_ message: String) {
guard let containerURL = appGroupContainerURL else { return }
let fileURL = containerURL.appendingPathComponent(shareExtensionTraceFileName)
let timestamp = ISO8601DateFormatter().string(from: Date())
let line = "\(timestamp) \(message)\n"
guard let data = line.data(using: .utf8) else { return }
if let handle = try? FileHandle(forWritingTo: fileURL) {
defer { try? handle.close() }
_ = try? handle.seekToEnd()
try? handle.write(contentsOf: data)
} else {
try? data.write(to: fileURL, options: .atomic)
}
}
override func viewDidLoad() {
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("viewDidLoad START")
if let userDefaults = UserDefaults(suiteName: appGroupIdentifier) {
let timestamp = ISO8601DateFormatter().string(from: Date())
userDefaults.set(timestamp, forKey: shareExtensionLastStartKey)
@@ -63,29 +39,19 @@ class ShareViewController: UIViewController {
// Process image immediately without showing UI
processAndOpenApp()
print("[ShareTarget] viewDidLoad completed")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("viewDidLoad END")
}
private func processAndOpenApp() {
print("[ShareTarget] processAndOpenApp started")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("processAndOpenApp START")
// extensionContext is automatically available on UIViewController when used as extension principal class
guard let context = extensionContext,
let inputItems = context.inputItems as? [NSExtensionItem] else {
print("[ShareTarget] processAndOpenApp failed: missing extensionContext or inputItems")
print("[ShareTarget] completeRequest starting")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("completeRequest START")
extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
print("[ShareTarget] completeRequest completed")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("completeRequest END")
print("[ShareTarget] processAndOpenApp completed")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("processAndOpenApp END")
return
}
@@ -98,8 +64,6 @@ class ShareViewController: UIViewController {
guard let self = self, let context = self.extensionContext else {
print("[ShareTarget] processAndOpenApp failed: self or extensionContext unavailable in completion")
print("[ShareTarget] processAndOpenApp completed")
// TEMPORARY SHARE TARGET DIAGNOSTICS
self?.appendTrace("processAndOpenApp END")
return
}
@@ -114,35 +78,23 @@ class ShareViewController: UIViewController {
// Complete immediately - no UI shown
print("[ShareTarget] completeRequest starting")
// TEMPORARY SHARE TARGET DIAGNOSTICS
self.appendTrace("completeRequest START")
context.completeRequest(returningItems: [], completionHandler: nil)
print("[ShareTarget] completeRequest completed")
// TEMPORARY SHARE TARGET DIAGNOSTICS
self.appendTrace("completeRequest END")
print("[ShareTarget] processAndOpenApp completed")
// TEMPORARY SHARE TARGET DIAGNOSTICS
self.appendTrace("processAndOpenApp END")
}
}
private func setSharedPhotoReadyFlag() {
print("[ShareTarget] setSharedPhotoReadyFlag started")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("setSharedPhotoReadyFlag START")
guard let userDefaults = UserDefaults(suiteName: appGroupIdentifier) else {
print("[ShareTarget] setSharedPhotoReadyFlag failed: UserDefaults unavailable for app group")
print("[ShareTarget] setSharedPhotoReadyFlag completed")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("setSharedPhotoReadyFlag FAILURE")
return
}
userDefaults.set(true, forKey: "sharedPhotoReady")
userDefaults.synchronize()
print("[ShareTarget] setSharedPhotoReadyFlag success")
print("[ShareTarget] setSharedPhotoReadyFlag completed")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("setSharedPhotoReadyFlag SUCCESS")
}
private func processSharedImage(from items: [NSExtensionItem], completion: @escaping (Bool) -> Void) {
@@ -150,8 +102,6 @@ class ShareViewController: UIViewController {
count + (item.attachments?.count ?? 0)
}
print("[ShareTarget] processSharedImage started attachmentCount=\(attachmentCount)")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("processSharedImage START")
// Find the first image attachment
for item in items {
@@ -170,8 +120,6 @@ class ShareViewController: UIViewController {
let shareId = UUID().uuidString
print("[ShareTarget] processSharedImage found image attachment shareId=\(shareId) UTType=\(UTType.image.identifier)")
print("[ShareTarget] share received shareId=\(shareId)")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("image attachment found shareId=\(shareId)")
// Try to load raw data first to preserve original format
// This preserves the original image format without conversion
@@ -186,8 +134,6 @@ class ShareViewController: UIViewController {
if let error = error {
print("[ShareTarget] processSharedImage failed: loadItem error shareId=\(shareId) error=\(error.localizedDescription)")
print("[ShareTarget] processSharedImage completed shareId=\(shareId) success=false")
// TEMPORARY SHARE TARGET DIAGNOSTICS
self.appendTrace("processSharedImage END success=false")
completion(false)
return
}
@@ -231,27 +177,19 @@ class ShareViewController: UIViewController {
guard let finalImageData = imageData else {
print("[ShareTarget] processSharedImage failed: no image data shareId=\(shareId)")
print("[ShareTarget] processSharedImage completed shareId=\(shareId) success=false")
// TEMPORARY SHARE TARGET DIAGNOSTICS
self.appendTrace("processSharedImage END success=false")
completion(false)
return
}
print("[ShareTarget] image loaded bytes=\(finalImageData.count) filename=\(fileName) shareId=\(shareId)")
// TEMPORARY SHARE TARGET DIAGNOSTICS
self.appendTrace("image loaded shareId=\(shareId) bytes=\(finalImageData.count)")
// Store image as file in App Group container
if self.storeImageData(finalImageData, fileName: fileName, shareId: shareId) {
print("[ShareTarget] processSharedImage completed shareId=\(shareId) success=true")
// TEMPORARY SHARE TARGET DIAGNOSTICS
self.appendTrace("processSharedImage END success=true")
completion(true)
} else {
print("[ShareTarget] processSharedImage failed: storeImageData returned false shareId=\(shareId)")
print("[ShareTarget] processSharedImage completed shareId=\(shareId) success=false")
// TEMPORARY SHARE TARGET DIAGNOSTICS
self.appendTrace("processSharedImage END success=false")
completion(false)
}
}
@@ -262,8 +200,6 @@ class ShareViewController: UIViewController {
// No image found
print("[ShareTarget] processSharedImage failed: no image attachment found attachmentCount=\(attachmentCount)")
print("[ShareTarget] processSharedImage completed success=false")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("processSharedImage END success=false")
completion(false)
}
@@ -291,14 +227,10 @@ class ShareViewController: UIViewController {
/// Returns true if successful, false otherwise
private func storeImageData(_ imageData: Data, fileName: String, shareId: String) -> Bool {
print("[ShareTarget] storeImageData started shareId=\(shareId) bytes=\(imageData.count) filename=\(fileName)")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("storeImageData START shareId=\(shareId)")
guard let containerURL = appGroupContainerURL else {
print("[ShareTarget] storeImageData failed: app group container unavailable shareId=\(shareId)")
print("[ShareTarget] storeImageData completed shareId=\(shareId) success=false")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("storeImageData FAILURE shareId=\(shareId)")
return false
}
@@ -321,8 +253,6 @@ class ShareViewController: UIViewController {
} catch {
print("[ShareTarget] storeImageData failed: file write error shareId=\(shareId) error=\(error.localizedDescription)")
print("[ShareTarget] storeImageData completed shareId=\(shareId) success=false")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("storeImageData FAILURE shareId=\(shareId)")
return false
}
print("[ShareTarget] file stored shareId=\(shareId) originalFilename=\(originalFileName) storedFilename=\(storedFileName)")
@@ -331,8 +261,6 @@ class ShareViewController: UIViewController {
guard let userDefaults = UserDefaults(suiteName: appGroupIdentifier) else {
print("[ShareTarget] storeImageData failed: UserDefaults unavailable shareId=\(shareId)")
print("[ShareTarget] storeImageData completed shareId=\(shareId) success=false")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("storeImageData FAILURE shareId=\(shareId)")
return false
}
@@ -348,22 +276,16 @@ class ShareViewController: UIViewController {
print("[ShareTarget] metadata stored shareId=\(shareId) originalFilename=\(originalFileName) storedFilename=\(storedFileName)")
print("[ShareTarget] storeImageData success shareId=\(shareId)")
print("[ShareTarget] storeImageData completed shareId=\(shareId) success=true")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("storeImageData SUCCESS shareId=\(shareId)")
return true
}
private func openMainApp() {
print("[ShareTarget] openMainApp starting")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("openMainApp START")
// Open the main app with minimal URL - app will detect shared data on activation
guard let url = URL(string: "timesafari://") else {
print("[ShareTarget] openMainApp failed: could not create timesafari:// URL")
print("[ShareTarget] openMainApp completed")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("openMainApp FAILURE")
return
}
@@ -372,8 +294,6 @@ class ShareViewController: UIViewController {
if let application = responder as? UIApplication {
application.open(url, options: [:], completionHandler: nil)
print("[ShareTarget] openMainApp completed via UIApplication")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("openMainApp SUCCESS")
return
}
responder = responder?.next
@@ -382,8 +302,6 @@ class ShareViewController: UIViewController {
// Fallback: use extension context
extensionContext?.open(url, completionHandler: nil)
print("[ShareTarget] openMainApp completed via extensionContext fallback")
// TEMPORARY SHARE TARGET DIAGNOSTICS
appendTrace("openMainApp SUCCESS")
}
}

View File

@@ -388,44 +388,6 @@ async function checkForSharedImageAndNavigate() {
})}`,
);
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
const traceResult = await SharedImage.getShareExtensionTrace();
// TEMPORARY SHARE TARGET DIAGNOSTICS
console.info("[ShareTarget] TRACE FULL START");
// TEMPORARY SHARE TARGET DIAGNOSTICS
console.info(traceResult.trace);
// TEMPORARY SHARE TARGET DIAGNOSTICS
console.info("[ShareTarget] TRACE FULL END");
// TEMPORARY SHARE TARGET DIAGNOSTICS
if (Capacitor.getPlatform() === "ios") {
alert(traceResult.trace);
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
console.info("[ShareTarget] Extension Trace\n" + traceResult.trace);
// TEMPORARY SHARE TARGET DIAGNOSTICS
const traceLength = traceResult.trace.length;
// TEMPORARY SHARE TARGET DIAGNOSTICS
console.info(`[ShareTarget] TRACE LENGTH=${traceLength}`);
// TEMPORARY SHARE TARGET DIAGNOSTICS
if (traceLength > 0) {
console.info(
"[ShareTarget] TRACE FIRST 500\n" + traceResult.trace.slice(0, 500),
);
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
const launchTraceResult = await SharedImage.getAppLaunchTrace();
// TEMPORARY SHARE TARGET DIAGNOSTICS
console.info("[ShareTarget] APP LAUNCH TRACE START");
// TEMPORARY SHARE TARGET DIAGNOSTICS
console.info(launchTraceResult.trace);
// TEMPORARY SHARE TARGET DIAGNOSTICS
console.info("[ShareTarget] APP LAUNCH TRACE END");
}
logger.debug("[Main] 🔍 Checking for shared image on app activation");

View File

@@ -8,10 +8,6 @@ import type {
SharedImagePlugin,
SharedImageResult,
ShareExtensionDiagnostics,
// TEMPORARY SHARE TARGET DIAGNOSTICS
ShareExtensionTrace,
// TEMPORARY SHARE TARGET DIAGNOSTICS
AppLaunchTrace,
} from "./definitions";
export class SharedImagePluginWeb
@@ -37,24 +33,4 @@ export class SharedImagePluginWeb
pendingShareExists: false,
};
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
async getShareExtensionTrace(): Promise<ShareExtensionTrace> {
return { trace: "" };
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
async clearShareExtensionTrace(): Promise<void> {
// Web platform doesn't support native sharing - no-op
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
async getAppLaunchTrace(): Promise<AppLaunchTrace> {
return { trace: "" };
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
async clearAppLaunchTrace(): Promise<void> {
// Web platform doesn't support native launch tracing - no-op
}
}

View File

@@ -16,16 +16,6 @@ export interface ShareExtensionDiagnostics {
pendingShareExists: boolean;
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
export interface ShareExtensionTrace {
trace: string;
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
export interface AppLaunchTrace {
trace: string;
}
export interface SharedImagePlugin {
/**
* Get shared image data from native layer
@@ -44,28 +34,4 @@ export interface SharedImagePlugin {
* Diagnostic snapshot of Share Extension startup and pending share state (iOS)
*/
getShareExtensionDiagnostics(): Promise<ShareExtensionDiagnostics>;
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Read the raw Share Extension execution trace log (iOS)
*/
getShareExtensionTrace(): Promise<ShareExtensionTrace>;
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Delete the Share Extension execution trace log if present (iOS)
*/
clearShareExtensionTrace(): Promise<void>;
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Read the raw app launch lifecycle trace log (iOS)
*/
getAppLaunchTrace(): Promise<AppLaunchTrace>;
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Delete the app launch lifecycle trace log if present (iOS)
*/
clearAppLaunchTrace(): Promise<void>;
}

View File

@@ -290,12 +290,6 @@ const routes: Array<RouteRecordRaw> = [
name: "test",
component: () => import("../views/TestView.vue"),
},
// TEMPORARY SHARE TARGET DIAGNOSTICS
{
path: "/share-target-debug",
name: "share-target-debug",
component: () => import("../views/ShareTargetDebugView.vue"),
},
{
path: "/user-profile/:id?",
name: "user-profile",

View File

@@ -1,187 +0,0 @@
<!-- TEMPORARY SHARE TARGET DIAGNOSTICS -->
<!--
ShareTargetDebugView
Temporary, standalone debug panel for the iOS Share Target investigation.
Lets a tester dump and clear the native trace logs (share-extension-trace.log
and app-launch-trace.log) from the App Group container without attaching Xcode.
This entire view is temporary and intended to be deleted once the Share Target
investigation is complete. It does not change any share-target behavior.
-->
<template>
<QuickNav />
<!-- CONTENT -->
<section id="Content" class="p-6 pb-24 max-w-3xl mx-auto">
<!-- Sub View Heading -->
<div id="SubViewHeading" class="flex gap-4 items-start mb-8">
<h1 class="grow text-xl text-center font-semibold leading-tight">
Share Target Debug
</h1>
<!-- Back -->
<a
class="order-first text-lg text-center leading-none p-1"
@click="$router.go(-1)"
>
<font-awesome icon="chevron-left" class="block text-center w-[1em]" />
</a>
</div>
<p class="text-sm text-gray-600 mb-4">
Temporary diagnostics for the iOS Share Target investigation. Dumps the
native trace logs to the console and to the read-only fields below.
</p>
<!-- Action buttons -->
<div class="flex flex-wrap gap-2 mb-4">
<button :class="primaryButtonClasses" @click="dumpNativeTraces()">
Dump Native Traces
</button>
<button :class="warningButtonClasses" @click="clearExtensionTrace()">
Clear Share Extension Trace
</button>
<button :class="warningButtonClasses" @click="clearAppLaunchTrace()">
Clear App Launch Trace
</button>
</div>
<!-- Status message -->
<div
v-if="statusMessage"
class="mb-4 p-2 text-sm rounded-md bg-emerald-50 text-emerald-800 border border-emerald-200"
>
{{ statusMessage }}
</div>
<!-- Extension trace -->
<div class="mb-6">
<h2 class="text-lg font-semibold mb-2">Share Extension Trace</h2>
<textarea
:value="extensionTrace"
readonly
class="w-full h-64 p-2 border border-gray-300 rounded-md font-mono text-xs whitespace-pre overflow-auto"
placeholder="No extension trace loaded. Tap 'Dump Native Traces'."
></textarea>
</div>
<!-- App launch trace -->
<div class="mb-6">
<h2 class="text-lg font-semibold mb-2">App Launch Trace</h2>
<textarea
:value="appLaunchTrace"
readonly
class="w-full h-64 p-2 border border-gray-300 rounded-md font-mono text-xs whitespace-pre overflow-auto"
placeholder="No app launch trace loaded. Tap 'Dump Native Traces'."
></textarea>
</div>
</section>
</template>
<script lang="ts">
import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import QuickNav from "../components/QuickNav.vue";
import { SharedImage } from "../plugins/SharedImagePlugin";
import { logger } from "../utils/logger";
/**
* TEMPORARY SHARE TARGET DIAGNOSTICS
*
* Dedicated debug panel for inspecting the iOS Share Target native traces.
* Temporary; remove once the Share Target investigation is complete.
*/
@Component({
components: {
QuickNav,
},
})
export default class ShareTargetDebugView extends Vue {
$router!: Router;
// TEMPORARY SHARE TARGET DIAGNOSTICS
extensionTrace = "";
// TEMPORARY SHARE TARGET DIAGNOSTICS
appLaunchTrace = "";
// TEMPORARY SHARE TARGET DIAGNOSTICS
statusMessage = "";
// TEMPORARY SHARE TARGET DIAGNOSTICS
get primaryButtonClasses(): string {
return "font-bold capitalize bg-slate-500 text-white px-3 py-2 rounded-md";
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
get warningButtonClasses(): string {
return "font-bold capitalize bg-amber-600 text-white px-3 py-2 rounded-md";
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Retrieve both native traces, log them in full to the console, and display
* them in the read-only fields. Does not truncate either trace.
*/
async dumpNativeTraces(): Promise<void> {
try {
const extensionResult = await SharedImage.getShareExtensionTrace();
const launchResult = await SharedImage.getAppLaunchTrace();
this.extensionTrace = extensionResult.trace;
this.appLaunchTrace = launchResult.trace;
// Log full (untruncated) traces to the console.
console.info("[ShareTarget] EXTENSION TRACE START");
console.info(extensionResult.trace);
console.info("[ShareTarget] EXTENSION TRACE END");
console.info("");
console.info("[ShareTarget] APP LAUNCH TRACE START");
console.info(launchResult.trace);
console.info("[ShareTarget] APP LAUNCH TRACE END");
this.statusMessage =
"Dumped native traces (see console and fields below).";
} catch (error) {
logger.error("[ShareTarget] Failed to dump native traces:", error);
this.statusMessage = `Failed to dump native traces: ${
error instanceof Error ? error.message : String(error)
}`;
}
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Clear the native Share Extension trace log and the displayed value.
*/
async clearExtensionTrace(): Promise<void> {
try {
await SharedImage.clearShareExtensionTrace();
this.extensionTrace = "";
this.statusMessage = "Share Extension trace cleared.";
} catch (error) {
logger.error("[ShareTarget] Failed to clear extension trace:", error);
this.statusMessage = `Failed to clear Share Extension trace: ${
error instanceof Error ? error.message : String(error)
}`;
}
}
// TEMPORARY SHARE TARGET DIAGNOSTICS
/**
* Clear the native app launch trace log and the displayed value.
*/
async clearAppLaunchTrace(): Promise<void> {
try {
await SharedImage.clearAppLaunchTrace();
this.appLaunchTrace = "";
this.statusMessage = "App Launch trace cleared.";
} catch (error) {
logger.error("[ShareTarget] Failed to clear app launch trace:", error);
this.statusMessage = `Failed to clear App Launch trace: ${
error instanceof Error ? error.message : String(error)
}`;
}
}
}
</script>

View File

@@ -112,21 +112,6 @@
</router-link>
</div>
<!-- TEMPORARY SHARE TARGET DIAGNOSTICS -->
<div class="mt-8">
<h2 class="text-xl font-bold mb-4">Share Target Diagnostics</h2>
<p class="text-sm text-gray-600 mb-3">
Temporary debug panel for the iOS Share Target investigation (dump/clear
native traces).
</p>
<router-link
:to="{ name: 'share-target-debug' }"
class="block w-full text-center text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md"
>
Open Share Target Debug Panel
</router-link>
</div>
<!-- URL Flow Testing Section -->
<div class="mt-8">
<h2 class="text-xl font-bold mb-4">URL Flow Testing</h2>