fix(core): do not show open-in-app in mobile web browser (#8694)

This commit is contained in:
pengx17
2024-11-04 12:33:10 +00:00
parent d35a9cff95
commit de7b1ff516
4 changed files with 15 additions and 12 deletions

View File

@@ -107,7 +107,7 @@ export const AppearanceSettings = () => {
{enableThemeEditor ? <ThemeEditorSetting /> : null}
</SettingWrapper>
{BUILD_CONFIG.isWeb ? (
{BUILD_CONFIG.isWeb && !environment.isMobile ? (
<SettingWrapper title={t['com.affine.setting.appearance.links']()}>
<SettingRow
name={t['com.affine.setting.appearance.open-in-app']()}

View File

@@ -8,6 +8,7 @@ import { OpenInAppService } from './services';
export * from './services';
export * from './utils';
export * from './views/open-in-app-guard';
export const configureOpenInApp = (framework: Framework) => {
framework.service(OpenInAppService, [GlobalState, WorkspacesService]);

View File

@@ -1,6 +1,6 @@
import { assertExists } from '@blocksuite/affine/global/utils';
import { useLiveData, useService } from '@toeverything/infra';
import { useCallback, useEffect } from 'react';
import { Fragment, useCallback, useEffect } from 'react';
import { OpenInAppService } from '../services';
import { OpenInAppPage } from './open-in-app-page';
@@ -8,11 +8,7 @@ import { OpenInAppPage } from './open-in-app-page';
/**
* Web only guard to open the URL in desktop app for different conditions
*/
export const WebOpenInAppGuard = ({
children,
}: {
children: React.ReactNode;
}) => {
const WebOpenInAppGuard = ({ children }: { children: React.ReactNode }) => {
assertExists(
BUILD_CONFIG.isWeb,
'WebOpenInAppGuard should only be used in web'
@@ -36,9 +32,13 @@ export const WebOpenInAppGuard = ({
return null;
}
return shouldOpenInApp ? (
return shouldOpenInApp && !environment.isMobile ? (
<OpenInAppPage openHereClicked={onOpenHere} />
) : (
children
);
};
export const OpenInAppGuard = environment.isMobile
? Fragment
: WebOpenInAppGuard;