diff --git a/src/lib/stores/ae_events_stores__launcher_defaults.ts b/src/lib/stores/ae_events_stores__launcher_defaults.ts index c2bef4a6..c357d023 100644 --- a/src/lib/stores/ae_events_stores__launcher_defaults.ts +++ b/src/lib/stores/ae_events_stores__launcher_defaults.ts @@ -78,6 +78,13 @@ export interface LauncherLocState { controller: string; controller_group_code: string; controller_client_id: string | null; + /** + * Native test mode: simulates the full native-branch open flow without Electron. + * Shows a debug popup with the resolved profile, commands, and AppleScript instead + * of actually launching files. Useful for testing LaunchProfile config from any + * device/OS without deploying to the Mac laptop. + */ + native_test_mode: boolean; } export interface LauncherSessState { @@ -198,7 +205,8 @@ export const launcher_loc_defaults: LauncherLocState = { controller: 'local', controller_group_code: 'launcher-00', - controller_client_id: null + controller_client_id: null, + native_test_mode: false // controller_cmd: null, // controller_trigger_send: null, }; diff --git a/src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_app_modes.svelte b/src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_app_modes.svelte index 8fe3cc9d..3ac70139 100644 --- a/src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_app_modes.svelte +++ b/src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_app_modes.svelte @@ -230,6 +230,32 @@ function apply_mode(mode: 'poster' | 'oral') { + + + +
+

+ Dev / Testing +

+ + {#if $events_loc.launcher.native_test_mode} +

+ โš  Active: Open buttons will simulate native launch and + show a debug popup instead of running commands. +

+ {/if} +
{/if} diff --git a/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte b/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte index 713e7a9a..fcdc2a10 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte @@ -91,6 +91,10 @@ let open_file_status: null | string = $state(null); let open_file_status_message: null | string = $state(null); let open_file_error_detail: string | null = $state(null); +/** State for the native test mode debug popup */ +let test_mode_popup_open: boolean = $state(false); +let test_mode_popup_data: Record | null = $state(null); + /** Simple promise-based delay for post-open script timing */ const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); @@ -132,6 +136,43 @@ async function handle_open_file() { $events_slct.event_file_id = event_file_id; $events_slct.event_file_obj = event_file_obj; + // 0. NATIVE TEST MODE โ€” simulate full native flow, show debug popup instead of running commands + // Active when native_test_mode toggle is on (regardless of is_native / app_mode). + // Lets you preview the resolved profile, open command, and post-script from any device. + if ($events_loc.launcher.native_test_mode && $events_loc.launcher.app_mode === 'native') { + open_file_clicked = true; + open_file_status = 'checking_cache'; + open_file_status_message = 'Test Mode: simulating cache check...'; + + await sleep(400); // Brief simulated cache check + + open_file_status = 'opening_file'; + open_file_status_message = 'Test Mode: resolving launch profile...'; + + const profile = get_launch_profile(event_file_obj.extension, event_file_obj); + const open_cmd_resolved = profile.open_cmd + ? profile.open_cmd.replaceAll('{{path}}', `/tmp/ae_test/${event_file_obj.filename}`) + : null; + + test_mode_popup_data = { + filename: event_file_obj.filename, + extension: event_file_obj.extension, + hash_sha256: event_file_obj.hash_sha256, + simulated_temp_path: `/tmp/ae_test/${event_file_obj.filename}`, + profile, + open_cmd_resolved, + display_override: event_file_obj?.cfg_json?.display_override ?? null, + cache_check: 'PASS (simulated)', + copy_to_temp: 'PASS (simulated)' + }; + test_mode_popup_open = true; + + open_file_status = 'open'; + open_file_status_message = 'Test Mode: profile resolved โ€” see popup'; + setTimeout(() => (open_file_clicked = false), 6000); + return true; + } + // 1. NATIVE MODE (Electron) if ($ae_loc.is_native && $events_loc.launcher.app_mode === 'native') { const cache_root = $ae_loc.local_file_cache_path; @@ -595,3 +636,121 @@ function prevent_default(fn: (event: T) => void) { + + + +{#if test_mode_popup_open && test_mode_popup_data} + + +{/if}