Skip to content

Commit

Permalink
Merge branch 'arrow-only-for-pwa-and-desktop' into 'master'
Browse files Browse the repository at this point in the history
allow app navigation buttons on pwa

See merge request kchat/webapp!871
  • Loading branch information
antonbuks committed Aug 12, 2024
2 parents 888459e + f65a21d commit 3e6bfbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import styled from 'styled-components';

import AppNameDisplay from 'components/app_name_display';

import {isDesktopApp, isPWA} from 'utils/user_agent';

import HistoryButtons from './history_buttons';

const LeftControlsContainer = styled.div`
Expand Down Expand Up @@ -40,7 +42,7 @@ const LeftControls = ({headerRef}: {headerRef: React.RefObject<HTMLDivElement>})
<LeftControlsContainer ref={headerRef}>
{/* <ProductMenu/> */}
<AppNameDisplay/>
<HistoryButtons/>
{(isDesktopApp() || isPWA()) && <HistoryButtons/>}
</LeftControlsContainer>
);

Expand Down
4 changes: 4 additions & 0 deletions webapp/channels/src/utils/user_agent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ iOS App:

const userAgent = () => window.navigator.userAgent;

export function isPWA(): boolean {
return window.matchMedia('(display-mode: standalone)').matches;
}

export function isChrome(): boolean {
return userAgent().indexOf('Chrome') > -1 && userAgent().indexOf('Edge') === -1;
}
Expand Down

0 comments on commit 3e6bfbc

Please sign in to comment.