fix: add platform abstraction for deeplink
This was crashing App.tsx due to the deep link listener calling methods on window which do not exist.
This commit is contained in:
@@ -56,10 +56,10 @@ function DeepLinkNavigationListener() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
window.electronDeepLink.getPending().then((path) => {
|
||||
platform.deepLink.getPending().then((path) => {
|
||||
if (path) navigate(path);
|
||||
});
|
||||
return window.electronDeepLink.onNavigate((path) => navigate(path));
|
||||
return platform.deepLink.onNavigate((path) => navigate(path));
|
||||
}, [navigate]);
|
||||
|
||||
return null;
|
||||
|
||||
@@ -30,8 +30,7 @@ export default function NetworkRoot() {
|
||||
setSearchParams(
|
||||
(prev) => {
|
||||
const params = new URLSearchParams(prev);
|
||||
if (next === 'open') params.delete('status');
|
||||
else params.set('status', next);
|
||||
params.set('status', next);
|
||||
return params;
|
||||
},
|
||||
{ replace: true },
|
||||
@@ -56,7 +55,6 @@ export default function NetworkRoot() {
|
||||
|
||||
return (
|
||||
<div className="relative flex min-h-0 flex-1 flex-col">
|
||||
{/* Top bar — stays in place */}
|
||||
<div className="flex shrink-0 items-center p-1 border-b">
|
||||
<Tabs
|
||||
value={statusTab}
|
||||
@@ -75,7 +73,6 @@ export default function NetworkRoot() {
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
{/* Scrollable content */}
|
||||
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain pb-14 py-2">
|
||||
<ParticleListView
|
||||
streams={streams}
|
||||
|
||||
@@ -55,4 +55,9 @@ export const electronPlatform: Platform = {
|
||||
setDockBadge: (count) => window.electronApp.setDockBadge(count),
|
||||
getVersion: () => window.electronApp.getVersion(),
|
||||
},
|
||||
|
||||
deepLink: {
|
||||
getPending: () => window.electronDeepLink.getPending(),
|
||||
onNavigate: (cb) => window.electronDeepLink.onNavigate(cb),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -60,6 +60,11 @@ export interface Platform {
|
||||
setDockBadge: (count: number) => void;
|
||||
getVersion: () => Promise<string>;
|
||||
};
|
||||
|
||||
deepLink: {
|
||||
getPending: () => Promise<string | null>;
|
||||
onNavigate: (callback: (path: string) => void) => () => void;
|
||||
};
|
||||
}
|
||||
|
||||
export const DESKTOP_DOWNLOAD_URL = 'https://flowylabs.ai/llink/download';
|
||||
|
||||
@@ -117,4 +117,11 @@ export const webPlatform: Platform = {
|
||||
setDockBadge: applyDockBadge,
|
||||
getVersion: async () => __APP_VERSION__,
|
||||
},
|
||||
|
||||
deepLink: {
|
||||
getPending: () => Promise.resolve(null),
|
||||
onNavigate: (_) => {
|
||||
return () => {};
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user