chore(ios): add temporary Share Target debug panel (temporary)

Add a dedicated, temporary debug view for the iOS Share Target
investigation so native traces can be inspected without attaching Xcode.
Kept separate from the Notification/Notiwind test panel so it is easy to
remove once the investigation is complete.

The panel (src/views/ShareTargetDebugView.vue, route
/share-target-debug) has three buttons:
- Dump Native Traces: calls SharedImage.getShareExtensionTrace() and
  getAppLaunchTrace(), logs both in full (untruncated) between
  EXTENSION TRACE START/END and APP LAUNCH TRACE START/END markers, and
  shows them in read-only scrollable fields.
- Clear Share Extension Trace: clears the native log and the field.
- Clear App Launch Trace: clears the native log and the field.

Register the route alongside the existing /test debug route and link to
the panel from TestView. No share-target behavior changed; Android
untouched. All additions marked TEMPORARY SHARE TARGET DIAGNOSTICS.
This commit is contained in:
Jose Olarte III
2026-06-26 18:10:08 +08:00
parent 256018d30d
commit 9941264022
3 changed files with 208 additions and 0 deletions

View File

@@ -290,6 +290,12 @@ 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

@@ -0,0 +1,187 @@
<!-- 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,6 +112,21 @@
</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>