2020-04-23 16:10:40 +02:00
|
|
|
/*
|
|
|
|
Copyright 2020 New Vector Ltd
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2023-08-22 17:32:03 +02:00
|
|
|
import React, { ReactNode } from "react";
|
2022-12-09 13:28:29 +01:00
|
|
|
import SdkConfig from "matrix-react-sdk/src/SdkConfig";
|
2023-08-22 17:32:03 +02:00
|
|
|
|
|
|
|
import { _t } from "../../languageHandler";
|
|
|
|
|
2020-04-23 16:10:40 +02:00
|
|
|
// directly import the style here as this layer does not support rethemedex at this time so no matrix-react-sdk
|
2022-07-15 15:53:21 +02:00
|
|
|
// PostCSS variables will be accessible.
|
|
|
|
import "../../../res/css/structures/ErrorView.pcss";
|
2020-04-23 16:10:40 +02:00
|
|
|
|
|
|
|
interface IProps {
|
2020-04-28 01:53:29 +02:00
|
|
|
onAccept(): void;
|
2020-04-23 16:10:40 +02:00
|
|
|
}
|
|
|
|
|
2020-04-23 17:45:24 +02:00
|
|
|
const CompatibilityView: React.FC<IProps> = ({ onAccept }) => {
|
2022-03-18 17:12:44 +01:00
|
|
|
const brand = SdkConfig.get("brand");
|
|
|
|
const mobileBuilds = SdkConfig.get("mobile_builds");
|
2021-04-09 02:39:09 +02:00
|
|
|
|
2023-05-05 10:08:36 +02:00
|
|
|
let ios: JSX.Element | undefined;
|
2021-04-09 02:39:09 +02:00
|
|
|
const iosCustomUrl = mobileBuilds?.ios;
|
2022-12-09 13:28:29 +01:00
|
|
|
if (iosCustomUrl !== null) {
|
|
|
|
// could be undefined or a string
|
|
|
|
ios = (
|
|
|
|
<>
|
|
|
|
<p>
|
|
|
|
<strong>iOS</strong> (iPhone or iPad)
|
|
|
|
</p>
|
2023-10-13 13:24:54 +02:00
|
|
|
<a href={iosCustomUrl} target="_blank" rel="noreferrer noopener" className="mx_ClearDecoration">
|
2022-12-09 13:28:29 +01:00
|
|
|
<img height="48" src="themes/element/img/download/apple.svg" alt="Apple App Store" />
|
|
|
|
</a>
|
|
|
|
</>
|
|
|
|
);
|
2021-04-09 02:39:09 +02:00
|
|
|
}
|
|
|
|
|
2022-12-09 13:28:29 +01:00
|
|
|
let android = [
|
|
|
|
<p className="mx_Spacer" key="header">
|
|
|
|
<strong>Android</strong>
|
|
|
|
</p>,
|
|
|
|
];
|
2021-04-09 02:39:09 +02:00
|
|
|
const andCustomUrl = mobileBuilds?.android;
|
|
|
|
const fdroidCustomUrl = mobileBuilds?.fdroid;
|
2022-12-09 13:28:29 +01:00
|
|
|
if (andCustomUrl !== null) {
|
|
|
|
// undefined or string
|
|
|
|
android.push(
|
|
|
|
<a
|
2023-10-13 13:24:54 +02:00
|
|
|
href={andCustomUrl}
|
2022-12-09 13:28:29 +01:00
|
|
|
target="_blank"
|
2023-04-17 14:51:30 +02:00
|
|
|
rel="noreferrer noopener"
|
2022-12-09 13:28:29 +01:00
|
|
|
className="mx_ClearDecoration"
|
|
|
|
key="android"
|
|
|
|
>
|
|
|
|
<img height="48" src="themes/element/img/download/google.svg" alt="Google Play Store" />
|
|
|
|
</a>,
|
|
|
|
);
|
2021-04-09 02:39:09 +02:00
|
|
|
}
|
2022-12-09 13:28:29 +01:00
|
|
|
if (fdroidCustomUrl !== null) {
|
|
|
|
// undefined or string
|
|
|
|
android.push(
|
|
|
|
<a
|
2023-10-13 13:24:54 +02:00
|
|
|
href={fdroidCustomUrl}
|
2022-12-09 13:28:29 +01:00
|
|
|
target="_blank"
|
2023-04-17 14:51:30 +02:00
|
|
|
rel="noreferrer noopener"
|
2022-12-09 13:28:29 +01:00
|
|
|
className="mx_ClearDecoration"
|
|
|
|
key="fdroid"
|
|
|
|
>
|
|
|
|
<img height="48" src="themes/element/img/download/fdroid.svg" alt="F-Droid" />
|
|
|
|
</a>,
|
|
|
|
);
|
2021-04-09 02:39:09 +02:00
|
|
|
}
|
2022-12-09 13:28:29 +01:00
|
|
|
if (android.length === 1) {
|
|
|
|
// just a header, meaning no links
|
2021-04-09 02:39:09 +02:00
|
|
|
android = [];
|
|
|
|
}
|
|
|
|
|
2023-09-05 18:17:25 +02:00
|
|
|
let mobileHeader: ReactNode = <h2 id="step2_heading">{_t("use_brand_on_mobile", { brand })}</h2>;
|
2021-04-09 02:39:09 +02:00
|
|
|
if (!android.length && !ios) {
|
|
|
|
mobileHeader = null;
|
|
|
|
}
|
|
|
|
|
2022-12-09 13:28:29 +01:00
|
|
|
return (
|
|
|
|
<div className="mx_ErrorView">
|
|
|
|
<div className="mx_ErrorView_container">
|
|
|
|
<div className="mx_HomePage_header">
|
|
|
|
<span className="mx_HomePage_logo">
|
|
|
|
<img height="42" src="themes/element/img/logos/element-logo.svg" alt="Element" />
|
|
|
|
</span>
|
2023-09-05 18:17:25 +02:00
|
|
|
<h1>{_t("incompatible_browser|title")}</h1>
|
2022-12-09 13:28:29 +01:00
|
|
|
</div>
|
2020-04-23 16:10:40 +02:00
|
|
|
|
2022-12-09 13:28:29 +01:00
|
|
|
<div className="mx_HomePage_col">
|
|
|
|
<div className="mx_HomePage_row">
|
|
|
|
<div>
|
2023-09-05 18:17:25 +02:00
|
|
|
<h2 id="step1_heading">{_t("incompatible_browser|summary", { brand })}</h2>
|
|
|
|
<p>{_t("incompatible_browser|features", { brand })}</p>
|
2022-12-09 13:28:29 +01:00
|
|
|
<p>
|
|
|
|
{_t(
|
2023-09-05 18:17:25 +02:00
|
|
|
"incompatible_browser|browser_links",
|
2022-12-09 13:28:29 +01:00
|
|
|
{},
|
|
|
|
{
|
|
|
|
chromeLink: (sub) => <a href="https://www.google.com/chrome">{sub}</a>,
|
|
|
|
firefoxLink: (sub) => <a href="https://firefox.com">{sub}</a>,
|
|
|
|
safariLink: (sub) => <a href="https://apple.com/safari">{sub}</a>,
|
|
|
|
},
|
|
|
|
)}
|
|
|
|
</p>
|
2023-09-05 18:17:25 +02:00
|
|
|
<p>{_t("incompatible_browser|feature_warning")}</p>
|
|
|
|
<button onClick={onAccept}>{_t("incompatible_browser|continue_warning")}</button>
|
2022-12-09 13:28:29 +01:00
|
|
|
</div>
|
2020-04-23 16:10:40 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-12-09 13:28:29 +01:00
|
|
|
<div className="mx_HomePage_col">
|
|
|
|
<div className="mx_HomePage_row">
|
|
|
|
<div>
|
|
|
|
{mobileHeader}
|
|
|
|
{ios}
|
|
|
|
{android}
|
|
|
|
</div>
|
2020-04-23 16:10:40 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-12-09 13:28:29 +01:00
|
|
|
<div className="mx_HomePage_row mx_Center mx_Spacer">
|
|
|
|
<p className="mx_Spacer">
|
|
|
|
<a href="https://element.io" target="_blank" className="mx_FooterLink">
|
2023-09-05 18:17:25 +02:00
|
|
|
{_t("go_to_element_io")}
|
2022-12-09 13:28:29 +01:00
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
</div>
|
2020-04-23 16:10:40 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-12-09 13:28:29 +01:00
|
|
|
);
|
2020-04-23 16:10:40 +02:00
|
|
|
};
|
|
|
|
|
2020-04-23 17:45:24 +02:00
|
|
|
export default CompatibilityView;
|