mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 01:26:37 +08:00
fix(core): move openinapp guard to workspace scope (#9751)
This commit is contained in:
@@ -4,7 +4,6 @@ import { router } from '@affine/core/desktop/router';
|
||||
import { configureCommonModules } from '@affine/core/modules';
|
||||
import { I18nProvider } from '@affine/core/modules/i18n';
|
||||
import { LifecycleService } from '@affine/core/modules/lifecycle';
|
||||
import { OpenInAppGuard } from '@affine/core/modules/open-in-app';
|
||||
import {
|
||||
configureLocalStorageStateStorageImpls,
|
||||
NbstoreProvider,
|
||||
@@ -100,13 +99,11 @@ export function App() {
|
||||
<CacheProvider value={cache}>
|
||||
<I18nProvider>
|
||||
<AffineContext store={getCurrentStore()}>
|
||||
<OpenInAppGuard>
|
||||
<RouterProvider
|
||||
fallbackElement={<AppContainer fallback />}
|
||||
router={router}
|
||||
future={future}
|
||||
/>
|
||||
</OpenInAppGuard>
|
||||
<RouterProvider
|
||||
fallbackElement={<AppContainer fallback />}
|
||||
router={router}
|
||||
future={future}
|
||||
/>
|
||||
</AffineContext>
|
||||
</I18nProvider>
|
||||
</CacheProvider>
|
||||
|
||||
@@ -27,11 +27,12 @@ const OpenUrl = () => {
|
||||
return null;
|
||||
}
|
||||
|
||||
params.delete('url');
|
||||
|
||||
const urlObj = new URL(urlToOpen || '');
|
||||
|
||||
params.forEach((v, k) => {
|
||||
if (k === 'url') {
|
||||
return;
|
||||
}
|
||||
urlObj.searchParams.set(k, v);
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
import { GlobalDialogService } from '@affine/core/modules/dialogs';
|
||||
import { DndService } from '@affine/core/modules/dnd/services';
|
||||
import { GlobalContextService } from '@affine/core/modules/global-context';
|
||||
import { OpenInAppGuard } from '@affine/core/modules/open-in-app';
|
||||
import {
|
||||
type Workspace,
|
||||
type WorkspaceMetadata,
|
||||
@@ -330,7 +331,9 @@ const WorkspacePage = ({ meta }: { meta: WorkspaceMetadata }) => {
|
||||
return (
|
||||
<FrameworkScope scope={workspace.scope}>
|
||||
<DNDContextProvider>
|
||||
<AppContainer fallback />
|
||||
<OpenInAppGuard>
|
||||
<AppContainer fallback />
|
||||
</OpenInAppGuard>
|
||||
</DNDContextProvider>
|
||||
</FrameworkScope>
|
||||
);
|
||||
@@ -339,11 +342,13 @@ const WorkspacePage = ({ meta }: { meta: WorkspaceMetadata }) => {
|
||||
return (
|
||||
<FrameworkScope scope={workspace.scope}>
|
||||
<DNDContextProvider>
|
||||
<AffineErrorBoundary height="100vh">
|
||||
<WorkspaceLayout>
|
||||
<WorkbenchRoot />
|
||||
</WorkspaceLayout>
|
||||
</AffineErrorBoundary>
|
||||
<OpenInAppGuard>
|
||||
<AffineErrorBoundary height="100vh">
|
||||
<WorkspaceLayout>
|
||||
<WorkbenchRoot />
|
||||
</WorkspaceLayout>
|
||||
</AffineErrorBoundary>
|
||||
</OpenInAppGuard>
|
||||
</DNDContextProvider>
|
||||
</FrameworkScope>
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { WorkspaceDialogService } from '@affine/core/modules/dialogs';
|
||||
import { appIconMap, appNames } from '@affine/core/utils/channel';
|
||||
import { Trans, useI18n } from '@affine/i18n';
|
||||
import { LocalWorkspaceIcon, Logo1Icon } from '@blocksuite/icons/rc';
|
||||
import { useService } from '@toeverything/infra';
|
||||
import { useServiceOptional } from '@toeverything/infra';
|
||||
import type { MouseEvent } from 'react';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
@@ -28,7 +28,7 @@ export const OpenInAppPage = ({
|
||||
}: OpenAppProps) => {
|
||||
// default to open the current page in desktop app
|
||||
urlToOpen ??= getOpenUrlInDesktopAppLink(window.location.href, true);
|
||||
const workspaceDialogService = useService(WorkspaceDialogService);
|
||||
const workspaceDialogService = useServiceOptional(WorkspaceDialogService);
|
||||
const t = useI18n();
|
||||
|
||||
const openDownloadLink = useCallback(() => {
|
||||
@@ -41,7 +41,7 @@ export const OpenInAppPage = ({
|
||||
const goToAppearanceSetting = useCallback(
|
||||
(e: MouseEvent) => {
|
||||
openHereClicked?.(e);
|
||||
workspaceDialogService.open('setting', {
|
||||
workspaceDialogService?.open('setting', {
|
||||
activeTab: 'appearance',
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user