Skip to content

Commit

Permalink
feat: always detect firefox browsers for warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
janrembold committed May 22, 2024
1 parent c56aaa2 commit ed82390
Showing 1 changed file with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
UserDataContext
} from '../../globalState';
import { STATUS_EMPTY } from '../../globalState/interfaces';
import { Link } from 'react-router-dom';

export const E2EEncryptionSupportBanner = () => {
const [showBanner, setShowBanner] = useState<boolean>(false);
Expand All @@ -25,18 +24,22 @@ export const E2EEncryptionSupportBanner = () => {
const { sessions } = useContext(SessionsDataContext);

useEffect(() => {
const isFirefox =
navigator.userAgent.toLowerCase().indexOf('firefox') > -1;

if (
hasVideoCallAbility(userData, consultingTypes) &&
// don't show banner when user enters first message
!(
hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData) &&
(sessions.length === 0 ||
(sessions.length === 1 &&
sessions[0]?.session?.status === STATUS_EMPTY))
)
isFirefox ||
(hasVideoCallAbility(userData, consultingTypes) &&
// don't show banner when user enters first message
!(
hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData) &&
(sessions.length === 0 ||
(sessions.length === 1 &&
sessions[0]?.session?.status === STATUS_EMPTY))
))
) {
setShowBanner(
!supportsE2EEncryptionVideoCall() &&
(isFirefox || !supportsE2EEncryptionVideoCall()) &&
!sessionStorage.getItem('hideEncryptionBanner')
);
}
Expand Down Expand Up @@ -71,12 +74,7 @@ export const E2EEncryptionSupportBanner = () => {
fill="black"
/>
</svg>
<p>
{translate('help.videoCall.banner.content')}{' '}
<Link to="/profile/hilfe/videoCall">
{translate('help.videoCall.banner.more')}
</Link>
</p>
<p>{translate('help.videoCall.banner.content')} </p>
</Banner>
);
};

0 comments on commit ed82390

Please sign in to comment.