• Syncs the application theme with the locally stored preference or system preference.

    Returns Promise<void>

    A promise that resolves when the theme has been synced.

    If syncing fails, falls back to light theme and logs the error.

    export async function syncThemeWithLocal() {
    try {
    const { local, system } = await getCurrentTheme();

    // If we have a stored preference, use it
    if (local) {
    await setTheme(local);
    return;
    }

    // Otherwise set system as default and save it to local storage
    // This ensures we have a saved preference for next time
    await setTheme(system || "light");
    } catch (error) {
    console.error("Failed to sync theme:", error);
    // Fallback to light theme if there's an error
    await setTheme("light");
    }
    }