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();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.electronDeepLink.getPending().then((path) => {
|
platform.deepLink.getPending().then((path) => {
|
||||||
if (path) navigate(path);
|
if (path) navigate(path);
|
||||||
});
|
});
|
||||||
return window.electronDeepLink.onNavigate((path) => navigate(path));
|
return platform.deepLink.onNavigate((path) => navigate(path));
|
||||||
}, [navigate]);
|
}, [navigate]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ export default function NetworkRoot() {
|
|||||||
setSearchParams(
|
setSearchParams(
|
||||||
(prev) => {
|
(prev) => {
|
||||||
const params = new URLSearchParams(prev);
|
const params = new URLSearchParams(prev);
|
||||||
if (next === 'open') params.delete('status');
|
params.set('status', next);
|
||||||
else params.set('status', next);
|
|
||||||
return params;
|
return params;
|
||||||
},
|
},
|
||||||
{ replace: true },
|
{ replace: true },
|
||||||
@@ -56,7 +55,6 @@ export default function NetworkRoot() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative flex min-h-0 flex-1 flex-col">
|
<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">
|
<div className="flex shrink-0 items-center p-1 border-b">
|
||||||
<Tabs
|
<Tabs
|
||||||
value={statusTab}
|
value={statusTab}
|
||||||
@@ -75,7 +73,6 @@ export default function NetworkRoot() {
|
|||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Scrollable content */}
|
|
||||||
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain pb-14 py-2">
|
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain pb-14 py-2">
|
||||||
<ParticleListView
|
<ParticleListView
|
||||||
streams={streams}
|
streams={streams}
|
||||||
|
|||||||
@@ -55,4 +55,9 @@ export const electronPlatform: Platform = {
|
|||||||
setDockBadge: (count) => window.electronApp.setDockBadge(count),
|
setDockBadge: (count) => window.electronApp.setDockBadge(count),
|
||||||
getVersion: () => window.electronApp.getVersion(),
|
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;
|
setDockBadge: (count: number) => void;
|
||||||
getVersion: () => Promise<string>;
|
getVersion: () => Promise<string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
deepLink: {
|
||||||
|
getPending: () => Promise<string | null>;
|
||||||
|
onNavigate: (callback: (path: string) => void) => () => void;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DESKTOP_DOWNLOAD_URL = 'https://flowylabs.ai/llink/download';
|
export const DESKTOP_DOWNLOAD_URL = 'https://flowylabs.ai/llink/download';
|
||||||
|
|||||||
@@ -117,4 +117,11 @@ export const webPlatform: Platform = {
|
|||||||
setDockBadge: applyDockBadge,
|
setDockBadge: applyDockBadge,
|
||||||
getVersion: async () => __APP_VERSION__,
|
getVersion: async () => __APP_VERSION__,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
deepLink: {
|
||||||
|
getPending: () => Promise.resolve(null),
|
||||||
|
onNavigate: (_) => {
|
||||||
|
return () => {};
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user