mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 03:49:56 +08:00
fix(env): is mobile flag (#8005)
only 'mobile' entry has isMobile = true flag
This commit is contained in:
@@ -304,7 +304,7 @@ export const AppTabsHeader = ({
|
||||
const sidebarWidth = useAtomValue(appSidebarWidthAtom);
|
||||
const sidebarOpen = useAtomValue(appSidebarOpenAtom);
|
||||
const sidebarResizing = useAtomValue(appSidebarResizingAtom);
|
||||
const isMacosDesktop = environment.isDesktop && environment.isMacOs;
|
||||
const isMacosDesktop = environment.isElectron && environment.isMacOs;
|
||||
const fullScreen = useIsFullScreen();
|
||||
|
||||
const tabsHeaderService = useService(AppTabsHeaderService);
|
||||
@@ -413,7 +413,7 @@ export const AppTabsHeader = ({
|
||||
className={clsx(styles.root, className)}
|
||||
style={style}
|
||||
data-mode={mode}
|
||||
data-is-windows={environment.isDesktop && environment.isWindows}
|
||||
data-is-windows={environment.isElectron && environment.isWindows}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
@@ -474,7 +474,7 @@ export const AppTabsHeader = ({
|
||||
<IconButton size="24" onClick={onToggleRightSidebar}>
|
||||
<RightSidebarIcon />
|
||||
</IconButton>
|
||||
{environment.isDesktop && environment.isWindows ? (
|
||||
{environment.isElectron && environment.isWindows ? (
|
||||
<WindowsAppControls />
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
@@ -88,7 +88,7 @@ export class AuthService extends Service {
|
||||
email,
|
||||
// we call it [callbackUrl] instead of [redirect_uri]
|
||||
// to make it clear the url is used to finish the sign-in process instead of redirect after signed-in
|
||||
callbackUrl: `/magic-link?client=${environment.isDesktop ? appInfo?.schema : 'web'}`,
|
||||
callbackUrl: `/magic-link?client=${environment.isElectron ? appInfo?.schema : 'web'}`,
|
||||
}),
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
@@ -131,7 +131,7 @@ export class AuthService extends Service {
|
||||
'state',
|
||||
JSON.stringify({
|
||||
state: oauthUrl.searchParams.get('state'),
|
||||
client: environment.isDesktop ? appInfo?.schema : 'web',
|
||||
client: environment.isElectron ? appInfo?.schema : 'web',
|
||||
})
|
||||
);
|
||||
url = oauthUrl.toString();
|
||||
|
||||
@@ -5,7 +5,7 @@ import { fromPromise, Service } from '@toeverything/infra';
|
||||
import { BackendError, NetworkError } from '../error';
|
||||
|
||||
export function getAffineCloudBaseUrl(): string {
|
||||
if (environment.isDesktop) {
|
||||
if (environment.isElectron) {
|
||||
return runtimeConfig.serverUrlPrefix;
|
||||
}
|
||||
const { protocol, hostname, port } = window.location;
|
||||
|
||||
@@ -28,7 +28,7 @@ const getDefaultSubscriptionSuccessCallbackLink = (
|
||||
plan === SubscriptionPlan.AI ? '/ai-upgrade-success' : '/upgrade-success';
|
||||
const urlString = getAffineCloudBaseUrl() + path;
|
||||
const url = new URL(urlString);
|
||||
if (environment.isDesktop && appInfo) {
|
||||
if (environment.isElectron && appInfo) {
|
||||
url.searchParams.set('schema', appInfo.schema);
|
||||
}
|
||||
return url.toString();
|
||||
|
||||
@@ -183,7 +183,7 @@ export const useExplorerCollectionNodeOperations = (
|
||||
</MenuItem>
|
||||
),
|
||||
},
|
||||
...(environment.isDesktop && enableMultiView
|
||||
...(environment.isElectron && enableMultiView
|
||||
? [
|
||||
{
|
||||
index: 99,
|
||||
|
||||
@@ -181,7 +181,7 @@ export const useExplorerDocNodeOperations = (
|
||||
</MenuItem>
|
||||
),
|
||||
},
|
||||
...(enableMultiView && environment.isDesktop
|
||||
...(enableMultiView && environment.isElectron
|
||||
? [
|
||||
{
|
||||
index: 100,
|
||||
|
||||
@@ -119,7 +119,7 @@ export const useExplorerTagNodeOperations = (
|
||||
</MenuItem>
|
||||
),
|
||||
},
|
||||
...(enableMultiView && environment.isDesktop
|
||||
...(enableMultiView && environment.isElectron
|
||||
? [
|
||||
{
|
||||
index: 100,
|
||||
|
||||
@@ -40,7 +40,7 @@ export class Navigator extends Entity {
|
||||
);
|
||||
|
||||
back() {
|
||||
if (!environment.isDesktop) {
|
||||
if (!environment.isElectron) {
|
||||
window.history.back();
|
||||
} else {
|
||||
this.history$.value.back();
|
||||
@@ -48,7 +48,7 @@ export class Navigator extends Entity {
|
||||
}
|
||||
|
||||
forward() {
|
||||
if (!environment.isDesktop) {
|
||||
if (!environment.isElectron) {
|
||||
window.history.forward();
|
||||
} else {
|
||||
this.history$.value.forward();
|
||||
|
||||
@@ -44,7 +44,7 @@ export const NavigationButtons = () => {
|
||||
};
|
||||
}, [navigator]);
|
||||
|
||||
if (!environment.isDesktop) {
|
||||
if (!environment.isElectron) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ export const DocPeekViewControls = ({
|
||||
peekView.close('none');
|
||||
},
|
||||
},
|
||||
environment.isDesktop && {
|
||||
environment.isElectron && {
|
||||
icon: <SplitViewIcon />,
|
||||
nameKey: 'split-view',
|
||||
name: t['com.affine.peek-view-controls.open-doc-in-split-view'](),
|
||||
|
||||
@@ -283,7 +283,7 @@ export const CMDKGroup = ({
|
||||
};
|
||||
|
||||
const CMDKKeyBinding = ({ keyBinding }: { keyBinding: string }) => {
|
||||
const isMacOS = environment.isBrowser && environment.isMacOs;
|
||||
const isMacOS = environment.isMacOs;
|
||||
const fragments = useMemo(() => {
|
||||
return keyBinding.split('+').map(fragment => {
|
||||
if (fragment === '$mod') {
|
||||
|
||||
@@ -13,7 +13,7 @@ export class DesktopStateSynchronizer extends Service {
|
||||
}
|
||||
|
||||
startSync = () => {
|
||||
if (!environment.isDesktop) {
|
||||
if (!environment.isElectron) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ export const RouteContainer = () => {
|
||||
return (
|
||||
<div className={styles.root}>
|
||||
<div className={styles.header}>
|
||||
{viewPosition.isFirst && !environment.isDesktop && (
|
||||
{viewPosition.isFirst && !environment.isElectron && (
|
||||
<SidebarSwitch
|
||||
show={!leftSidebarOpen}
|
||||
className={styles.leftSidebarButton}
|
||||
@@ -64,7 +64,7 @@ export const RouteContainer = () => {
|
||||
viewId={view.id}
|
||||
className={styles.viewHeaderContainer}
|
||||
/>
|
||||
{viewPosition.isLast && !environment.isDesktop && (
|
||||
{viewPosition.isLast && !environment.isElectron && (
|
||||
<ToggleButton
|
||||
show={!sidebarOpen}
|
||||
className={styles.rightSidebarButton}
|
||||
|
||||
@@ -38,7 +38,7 @@ export const SidebarContainer = ({
|
||||
viewId={view.id}
|
||||
className={clsx(
|
||||
styles.sidebarBodyTarget,
|
||||
!environment.isDesktop && styles.borderTop
|
||||
!environment.isElectron && styles.borderTop
|
||||
)}
|
||||
/>
|
||||
))
|
||||
|
||||
@@ -44,7 +44,7 @@ export const Header = ({ floating, children, onToggle }: HeaderProps) => {
|
||||
return (
|
||||
<Container className={styles.header} floating={floating}>
|
||||
{children}
|
||||
{!environment.isDesktop && (
|
||||
{!environment.isElectron && (
|
||||
<>
|
||||
<div className={styles.spacer} />
|
||||
<ToggleButton onToggle={onToggle} />
|
||||
|
||||
@@ -40,7 +40,7 @@ export const WorkbenchLink = forwardRef<HTMLAnchorElement, WorkbenchLinkProps>(
|
||||
}
|
||||
const at = (() => {
|
||||
if (isNewTabTrigger(event)) {
|
||||
return event.altKey && enableMultiView && environment.isDesktop
|
||||
return event.altKey && enableMultiView && environment.isElectron
|
||||
? 'tail'
|
||||
: 'new-tab';
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import { ViewIslandRegistryProvider } from './view-islands';
|
||||
import { ViewRoot } from './view-root';
|
||||
import * as styles from './workbench-root.css';
|
||||
|
||||
const useAdapter = environment.isDesktop
|
||||
const useAdapter = environment.isElectron
|
||||
? useBindWorkbenchToDesktopRouter
|
||||
: useBindWorkbenchToBrowserRouter;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ export class LocalWorkspaceFlavourProvider
|
||||
JSON.stringify(allWorkspaceIDs.filter(x => x !== id))
|
||||
);
|
||||
|
||||
if (apis && environment.isDesktop) {
|
||||
if (apis && environment.isElectron) {
|
||||
await apis.workspace.delete(id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user