aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/common/components/NativeInterface.js2
-rw-r--r--modern/src/login/LoginPage.js4
2 files changed, 4 insertions, 2 deletions
diff --git a/modern/src/common/components/NativeInterface.js b/modern/src/common/components/NativeInterface.js
index d36b64c5..4e6ad4fe 100644
--- a/modern/src/common/components/NativeInterface.js
+++ b/modern/src/common/components/NativeInterface.js
@@ -3,6 +3,8 @@ import { useDispatch, useSelector } from 'react-redux';
import { useEffectAsync } from '../../reactHelper';
import { sessionActions } from '../../store';
+export const nativeEnvironment = window.appInterface || (window.webkit && window.webkit.messageHandlers.appInterface);
+
export const nativePostMessage = (message) => {
if (window.webkit && window.webkit.messageHandlers.appInterface) {
window.webkit.messageHandlers.appInterface.postMessage(message);
diff --git a/modern/src/login/LoginPage.js b/modern/src/login/LoginPage.js
index e3b5f39b..9bb764a8 100644
--- a/modern/src/login/LoginPage.js
+++ b/modern/src/login/LoginPage.js
@@ -12,7 +12,7 @@ import { sessionActions } from '../store';
import { useLocalization, useTranslation } from '../common/components/LocalizationProvider';
import LoginLayout from './LoginLayout';
import usePersistedState from '../common/util/usePersistedState';
-import { nativePostMessage } from '../common/components/NativeInterface';
+import { nativeEnvironment, nativePostMessage } from '../common/components/NativeInterface';
import LogoImage from './LogoImage';
const useStyles = makeStyles((theme) => ({
@@ -92,7 +92,7 @@ const LoginPage = () => {
return (
<LoginLayout>
<div className={classes.options}>
- {(window.appInterface || (window.webkit && window.webkit.messageHandlers.appInterface)) && (
+ {nativeEnvironment && (
<Tooltip title={t('settingsServer')}>
<IconButton onClick={() => navigate('/change-server')}>
<LockOpenIcon />