App: Disable multitab on mobile PWA (#2806)
This commit is contained in:
parent
1f401378ea
commit
2d2ac41c6b
@ -17,7 +17,7 @@ import type { AnimationLevel } from '../../../types';
|
||||
import type { ChatAnimationTypes } from './hooks';
|
||||
|
||||
import { MAIN_THREAD_ID } from '../../../api/types';
|
||||
import { IS_MULTITAB_SUPPORTED } from '../../../util/environment';
|
||||
import { IS_OPEN_IN_NEW_TAB_SUPPORTED } from '../../../util/environment';
|
||||
import {
|
||||
isUserId,
|
||||
getPrivateChatUserId,
|
||||
@ -223,7 +223,7 @@ const Chat: FC<OwnProps & StateProps> = ({
|
||||
<ListItem
|
||||
ref={ref}
|
||||
className={className}
|
||||
href={IS_MULTITAB_SUPPORTED ? `#${createLocationHash(chatId, 'thread', MAIN_THREAD_ID)}` : undefined}
|
||||
href={IS_OPEN_IN_NEW_TAB_SUPPORTED ? `#${createLocationHash(chatId, 'thread', MAIN_THREAD_ID)}` : undefined}
|
||||
style={`top: ${offsetTop}px`}
|
||||
ripple={!isForum && !isMobile}
|
||||
contextActions={contextActions}
|
||||
|
||||
@ -11,7 +11,7 @@ import type { ObserveFn } from '../../../hooks/useIntersectionObserver';
|
||||
import type { ChatAnimationTypes } from './hooks';
|
||||
import type { AnimationLevel } from '../../../types';
|
||||
|
||||
import { IS_MULTITAB_SUPPORTED } from '../../../util/environment';
|
||||
import { IS_OPEN_IN_NEW_TAB_SUPPORTED } from '../../../util/environment';
|
||||
import {
|
||||
selectCanDeleteTopic,
|
||||
selectChat,
|
||||
@ -146,7 +146,7 @@ const Topic: FC<OwnProps & StateProps> = ({
|
||||
)}
|
||||
onClick={handleOpenTopic}
|
||||
style={style}
|
||||
href={IS_MULTITAB_SUPPORTED ? `#${createLocationHash(chatId, 'thread', topic.id)}` : undefined}
|
||||
href={IS_OPEN_IN_NEW_TAB_SUPPORTED ? `#${createLocationHash(chatId, 'thread', topic.id)}` : undefined}
|
||||
contextActions={contextActions}
|
||||
ref={ref}
|
||||
>
|
||||
|
||||
@ -6,7 +6,7 @@ import type { MenuItemContextAction } from '../../../ui/ListItem';
|
||||
|
||||
import { compact } from '../../../../util/iteratees';
|
||||
import { getCanManageTopic, getHasAdminRight } from '../../../../global/helpers';
|
||||
import { IS_MULTITAB_SUPPORTED } from '../../../../util/environment';
|
||||
import { IS_OPEN_IN_NEW_TAB_SUPPORTED } from '../../../../util/environment';
|
||||
|
||||
import useLang from '../../../../hooks/useLang';
|
||||
|
||||
@ -37,7 +37,7 @@ export default function useTopicContextActions(
|
||||
const canToggleClosed = getCanManageTopic(chat, topic);
|
||||
const canTogglePinned = chat.isCreator || getHasAdminRight(chat, 'manageTopics');
|
||||
|
||||
const actionOpenInNewTab = IS_MULTITAB_SUPPORTED && {
|
||||
const actionOpenInNewTab = IS_OPEN_IN_NEW_TAB_SUPPORTED && {
|
||||
title: 'Open in new tab',
|
||||
icon: 'open-in-new-tab',
|
||||
handler: () => {
|
||||
|
||||
@ -4,7 +4,7 @@ import { getActions } from '../global';
|
||||
import type { ApiChat, ApiUser } from '../api/types';
|
||||
import type { MenuItemContextAction } from '../components/ui/ListItem';
|
||||
|
||||
import { IS_MULTITAB_SUPPORTED } from '../util/environment';
|
||||
import { IS_OPEN_IN_NEW_TAB_SUPPORTED } from '../util/environment';
|
||||
import { SERVICE_NOTIFICATIONS_USER_ID } from '../config';
|
||||
import {
|
||||
isChatArchived, getCanDeleteChat, isUserId, isChatChannel, isChatGroup,
|
||||
@ -51,7 +51,7 @@ const useChatContextActions = ({
|
||||
openChatInNewTab,
|
||||
} = getActions();
|
||||
|
||||
const actionOpenInNewTab = IS_MULTITAB_SUPPORTED && {
|
||||
const actionOpenInNewTab = IS_OPEN_IN_NEW_TAB_SUPPORTED && {
|
||||
title: 'Open in new tab',
|
||||
icon: 'open-in-new-tab',
|
||||
handler: () => {
|
||||
@ -59,8 +59,6 @@ const useChatContextActions = ({
|
||||
},
|
||||
};
|
||||
|
||||
const newTabActionSeparator = actionOpenInNewTab && { isSeparator: true, key: 'newTabSeparator' };
|
||||
|
||||
const actionAddToFolder = canChangeFolder ? {
|
||||
title: lang('ChatList.Filter.AddToFolder'),
|
||||
icon: 'folder',
|
||||
@ -122,7 +120,6 @@ const useChatContextActions = ({
|
||||
|
||||
return compact([
|
||||
actionOpenInNewTab,
|
||||
newTabActionSeparator,
|
||||
actionAddToFolder,
|
||||
actionMaskAsRead,
|
||||
actionMarkAsUnread,
|
||||
|
||||
@ -39,6 +39,7 @@ export const PLATFORM_ENV = getPlatform();
|
||||
export const IS_MAC_OS = PLATFORM_ENV === 'macOS';
|
||||
export const IS_IOS = PLATFORM_ENV === 'iOS';
|
||||
export const IS_ANDROID = PLATFORM_ENV === 'Android';
|
||||
export const IS_MOBILE = IS_IOS || IS_ANDROID;
|
||||
export const IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
||||
export const IS_YA_BROWSER = navigator.userAgent.includes('YaBrowser');
|
||||
|
||||
@ -109,15 +110,16 @@ export const IS_OFFSET_PATH_SUPPORTED = CSS.supports('offset-rotate: 0deg');
|
||||
export const IS_BACKDROP_BLUR_SUPPORTED = CSS.supports('backdrop-filter: blur()')
|
||||
|| CSS.supports('-webkit-backdrop-filter: blur()');
|
||||
export const IS_COMPACT_MENU = !IS_TOUCH_ENV;
|
||||
export const IS_SCROLL_PATCH_NEEDED = !IS_MAC_OS && !IS_IOS && !IS_ANDROID;
|
||||
export const IS_SCROLL_PATCH_NEEDED = !IS_MAC_OS && !IS_MOBILE;
|
||||
export const IS_INSTALL_PROMPT_SUPPORTED = 'onbeforeinstallprompt' in window;
|
||||
export const IS_MULTITAB_SUPPORTED = 'BroadcastChannel' in window;
|
||||
export const IS_OPEN_IN_NEW_TAB_SUPPORTED = IS_MULTITAB_SUPPORTED && !(IS_PWA && IS_MOBILE);
|
||||
export const IS_TRANSLATION_SUPPORTED = Boolean(Intl.DisplayNames);
|
||||
|
||||
// Smaller area reduces scroll jumps caused by `patchChromiumScroll`
|
||||
export const MESSAGE_LIST_SENSITIVE_AREA = IS_SCROLL_PATCH_NEEDED ? 300 : 750;
|
||||
|
||||
export const MAX_BUFFER_SIZE = (IS_ANDROID || IS_IOS ? 512 : 2000) * 1024 ** 2; // 512 OR 2000 MB
|
||||
export const MAX_BUFFER_SIZE = (IS_MOBILE ? 512 : 2000) * 1024 ** 2; // 512 OR 2000 MB
|
||||
|
||||
// TODO Turn on later as `!IS_IOS && !IS_ANDROID`
|
||||
export const VIDEO_AVATARS_DISABLED = true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user