fix(env): is mobile flag (#8005)
only 'mobile' entry has isMobile = true flag
This commit is contained in:
@@ -18,7 +18,7 @@ export function useRegisterFindInPageCommands() {
|
||||
}, [findInPage]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!environment.isDesktop) {
|
||||
if (!environment.isElectron) {
|
||||
return;
|
||||
}
|
||||
const unsubs: Array<() => void> = [];
|
||||
|
||||
@@ -284,7 +284,7 @@ export const useMarkdownShortcuts = (): ShortcutsInfo => {
|
||||
|
||||
const macMarkdownShortcuts = useMacMarkdownShortcuts();
|
||||
const winMarkdownShortcuts = useWinMarkdownShortcuts();
|
||||
const isMac = environment.isBrowser && environment.isMacOs;
|
||||
const isMac = environment.isMacOs;
|
||||
return {
|
||||
title: t['com.affine.shortcutsTitle.markdownSyntax'](),
|
||||
shortcuts: isMac ? macMarkdownShortcuts : winMarkdownShortcuts,
|
||||
@@ -296,7 +296,7 @@ export const usePageShortcuts = (): ShortcutsInfo => {
|
||||
|
||||
const macPageShortcuts = useMacPageKeyboardShortcuts();
|
||||
const winPageShortcuts = useWinPageKeyboardShortcuts();
|
||||
const isMac = environment.isBrowser && environment.isMacOs;
|
||||
const isMac = environment.isMacOs;
|
||||
return {
|
||||
title: t['com.affine.shortcutsTitle.page'](),
|
||||
shortcuts: isMac ? macPageShortcuts : winPageShortcuts,
|
||||
@@ -308,7 +308,7 @@ export const useEdgelessShortcuts = (): ShortcutsInfo => {
|
||||
|
||||
const macEdgelessShortcuts = useMacEdgelessKeyboardShortcuts();
|
||||
const winEdgelessShortcuts = useWinEdgelessKeyboardShortcuts();
|
||||
const isMac = environment.isBrowser && environment.isMacOs;
|
||||
const isMac = environment.isMacOs;
|
||||
return {
|
||||
title: t['com.affine.shortcutsTitle.edgeless'](),
|
||||
shortcuts: isMac ? macEdgelessShortcuts : winEdgelessShortcuts,
|
||||
@@ -320,7 +320,7 @@ export const useGeneralShortcuts = (): ShortcutsInfo => {
|
||||
|
||||
const macGeneralShortcuts = useMacGeneralKeyboardShortcuts();
|
||||
const winGeneralShortcuts = useWinGeneralKeyboardShortcuts();
|
||||
const isMac = environment.isBrowser && environment.isMacOs;
|
||||
const isMac = environment.isMacOs;
|
||||
return {
|
||||
title: t['com.affine.shortcutsTitle.general'](),
|
||||
shortcuts: isMac ? macGeneralShortcuts : winGeneralShortcuts,
|
||||
|
||||
@@ -35,7 +35,7 @@ export const appConfigProxy = new AppConfigProxy();
|
||||
|
||||
setupGlobal();
|
||||
|
||||
const storage = environment.isDesktop
|
||||
const storage = environment.isElectron
|
||||
? new AppConfigStorage({
|
||||
config: defaultAppConfig,
|
||||
get: () => appConfigProxy.get(),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { UpdateMeta } from '@affine/electron-api';
|
||||
import { apis, events } from '@affine/electron-api';
|
||||
import { isBrowser } from '@affine/env/constant';
|
||||
import { appSettingAtom } from '@toeverything/infra';
|
||||
import { atom, useAtom, useAtomValue } from 'jotai';
|
||||
import { atomWithObservable, atomWithStorage } from 'jotai/utils';
|
||||
@@ -30,7 +29,7 @@ function rpcToObservable<
|
||||
return new Observable<T | null>(subscriber => {
|
||||
subscriber.next(initialValue);
|
||||
onSubscribe?.();
|
||||
if (!isBrowser || !environment.isDesktop || !event) {
|
||||
if (!environment.isElectron || !event) {
|
||||
subscriber.complete();
|
||||
return;
|
||||
}
|
||||
@@ -76,18 +75,12 @@ export const changelogCheckedAtom = atomWithStorage<Record<string, boolean>>(
|
||||
export const checkingForUpdatesAtom = atom(false);
|
||||
|
||||
export const currentVersionAtom = atom(async () => {
|
||||
if (!isBrowser) {
|
||||
return null;
|
||||
}
|
||||
const currentVersion = await apis?.updater.currentVersion();
|
||||
return currentVersion;
|
||||
});
|
||||
|
||||
const currentChangelogUnreadAtom = atom(
|
||||
async get => {
|
||||
if (!isBrowser) {
|
||||
return false;
|
||||
}
|
||||
const mapping = get(changelogCheckedAtom);
|
||||
const currentVersion = await get(currentVersionAtom);
|
||||
if (currentVersion) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useEffect } from 'react';
|
||||
|
||||
export function useDocumentTitle(newTitle?: string | null) {
|
||||
useEffect(() => {
|
||||
if (environment.isDesktop || !newTitle) {
|
||||
if (environment.isElectron || !newTitle) {
|
||||
return noop;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user