feat(frontend): implement string-only ID standardization and native data cleaning
Update layout.ts to clean raw data from the native bridge. Initialize events_slct.event_device_id in launcher layout. Resort device_id prioritization in launcher_background_sync.svelte.
This commit is contained in:
@@ -160,6 +160,11 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
// Inject native device metadata into the location state with SAFE MERGE
|
||||
if (native_device_config.native_device) {
|
||||
const incoming_dev = native_device_config.native_device;
|
||||
|
||||
// String-Only ID Vision: Ensure semantic fields use the random string ID
|
||||
if (incoming_dev.event_device_id_random) incoming_dev.event_device_id = incoming_dev.event_device_id_random;
|
||||
if (incoming_dev.event_id_random) incoming_dev.event_id = incoming_dev.event_id_random;
|
||||
if (incoming_dev.id_random) incoming_dev.id = incoming_dev.id_random;
|
||||
|
||||
// 1. Recover existing user overrides from localStorage
|
||||
let existing_dev = {};
|
||||
|
||||
@@ -108,6 +108,12 @@
|
||||
$events_slct.event_location_id = data.params.event_location_id;
|
||||
$events_slct.event_session_id = data.url.searchParams.get('session_id');
|
||||
|
||||
// String-Only ID Vision: Sync the device ID from the native environment
|
||||
const native_dev = $ae_loc.native_device;
|
||||
if (native_dev) {
|
||||
$events_slct.event_device_id = native_dev.event_device_id || native_dev.id || native_dev.event_device_id_random || native_dev.id_random;
|
||||
}
|
||||
|
||||
// console.log(`ae_acct.slct.event_id:`, ae_acct.slct.event_id);
|
||||
// $events_slct.event_id = ae_acct.slct.event_id;
|
||||
// $events_slct.event_obj = ae_acct.slct.event_obj;
|
||||
|
||||
@@ -163,7 +163,8 @@
|
||||
*/
|
||||
async function run_device_heartbeat() {
|
||||
const dev = $ae_loc.native_device;
|
||||
const device_id = dev?.event_device_id || dev?.id_random || dev?.event_device_id_random || dev?.id;
|
||||
// String-Only ID Vision: Prioritize semantic string IDs, then generic, then legacy random strings
|
||||
const device_id = dev?.event_device_id || dev?.id || dev?.event_device_id_random || dev?.id_random;
|
||||
|
||||
if (!device_id) {
|
||||
if (log_lvl) console.warn('Sync: Heartbeat skipped, no device_id found in $ae_loc.native_device.');
|
||||
|
||||
Reference in New Issue
Block a user