feat: implement openExternalUrl utility for consistent external link handling

This commit is contained in:
2026-01-24 07:59:45 +11:00
parent c0af925420
commit a6b76a9be7
5 changed files with 29 additions and 12 deletions

View File

@@ -1,3 +1,19 @@
/**
* Open an external URL using Tauri shell on desktop/mobile, or window.open in browser
* @param url The URL to open
*/
export const openExternalUrl = async (url: string): Promise<void> => {
if (isTauri()) {
try {
const { open } = await import('@tauri-apps/plugin-shell');
await open(url);
return;
} catch (err) {
console.warn('Tauri shell.open failed, falling back to window.open:', err);
}
}
window.open(url, '_blank');
};
/**
* Tauri-specific utilities for desktop and mobile platforms
*/