Rename "ios" & "fxios" to "Safari" and "Firefox" for browser name (#119)

This commit is contained in:
Ryan Alexander 2021-09-03 19:35:02 +10:00 committed by GitHub
parent c302eade17
commit a08ad7aa0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,11 +1,7 @@
import { detect } from "detect-browser";
import { useHistory } from "react-router-dom";
import { useContext } from "preact/hooks";
import { OperationsContext } from "../../../context/revoltjs/RevoltClient";
import { Form } from "./Form";
import { detect } from "detect-browser";
import { useContext } from "preact/hooks";
import { OperationsContext } from "../../../context/revoltjs/RevoltClient";
export function FormLogin() {
const { login } = useContext(OperationsContext);
@ -14,15 +10,21 @@ export function FormLogin() {
return (
<Form
page="login"
callback={async (data) => {
callback={async data => {
const browser = detect();
let device_name;
if (browser) {
const { name, os } = browser;
let { name } = browser;
const { os } = browser;
if (window.isNative) {
device_name = `Revolt Desktop on ${os}`;
} else {
device_name = `${name} on ${os}`;
if(name === "ios") {
name = "safari";
}else if(name === "fxios") {
name = "firefox";
}
device_name = `${name} on ${os}`;
}
} else {
device_name = "Unknown Device";