From e8c7db724ee870c87fec6cae17deed4718bf1526 Mon Sep 17 00:00:00 2001 From: pietrobs Date: Wed, 5 Aug 2020 15:38:59 -0300 Subject: [PATCH 1/3] Add browser type MIUI --- src/components/helpers/types.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/helpers/types.js b/src/components/helpers/types.js index 51d3760..1695d66 100644 --- a/src/components/helpers/types.js +++ b/src/components/helpers/types.js @@ -20,7 +20,8 @@ export const BROWSER_TYPES = { CHROMIUM: "Chromium", IE: 'IE', MOBILE_SAFARI: "Mobile Safari", - EDGE_CHROMIUM: "Edge Chromium" + EDGE_CHROMIUM: "Edge Chromium", + MIUI: "MIUI Browser" }; export const OS_TYPES = { From 1b1a968ef2332adc35404b035dec3d87ae01afe3 Mon Sep 17 00:00:00 2001 From: pietrobs Date: Wed, 5 Aug 2020 15:39:44 -0300 Subject: [PATCH 2/3] Feature/add miui --- main.js | 9 ++++++++- src/components/helpers/selectors.js | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 753e2ed..31358ac 100644 --- a/main.js +++ b/main.js @@ -204,7 +204,8 @@ var BROWSER_TYPES = { CHROMIUM: "Chromium", IE: 'IE', MOBILE_SAFARI: "Mobile Safari", - EDGE_CHROMIUM: "Edge Chromium" + EDGE_CHROMIUM: "Edge Chromium", + MIUI: "MIUI Browser" }; var OS_TYPES = { IOS: 'iOS', @@ -444,6 +445,10 @@ var isIEType = function isIEType() { return browser.name === BROWSER_TYPES.INTERNET_EXPLORER || browser.name === BROWSER_TYPES.IE; }; +var isMIUIType = function isMIUIType() { + return browser.name === BROWSER_TYPES.MIUI; +}; + var isElectronType = function isElectronType() { var nav = getNavigatorInstance(); var ua = nav && nav.userAgent.toLowerCase(); @@ -550,6 +555,7 @@ var isEdgeChromium = isEdgeChromiumType(); var isLegacyEdge = isEdgeType(); var isWindows = isWindowsType(); var isMacOs = isMacOsType(); +var isMIUI = isMIUIType(); var AndroidView = function AndroidView(_ref) { var renderWithFragment = _ref.renderWithFragment, @@ -789,6 +795,7 @@ exports.isIPad13 = isIPad13; exports.isIPhone13 = isIPhone13; exports.isIPod13 = isIPod13; exports.isLegacyEdge = isLegacyEdge; +exports.isMIUI = isMIUI; exports.isMacOs = isMacOs; exports.isMobile = isMobile; exports.isMobileOnly = isMobileOnly; diff --git a/src/components/helpers/selectors.js b/src/components/helpers/selectors.js index da33849..d5dbaed 100644 --- a/src/components/helpers/selectors.js +++ b/src/components/helpers/selectors.js @@ -40,6 +40,7 @@ const isSafariType = () => browser.name === BROWSER_TYPES.SAFARI || browser.name const isMobileSafariType = () => browser.name === BROWSER_TYPES.MOBILE_SAFARI; const isOperaType = () => browser.name === BROWSER_TYPES.OPERA; const isIEType = () => browser.name === BROWSER_TYPES.INTERNET_EXPLORER || browser.name === BROWSER_TYPES.IE; +const isMIUIType = () => browser.name === BROWSER_TYPES.MIUI; const isElectronType = () => { const nav = getNavigatorInstance(); const ua = nav && nav.userAgent.toLowerCase(); @@ -111,3 +112,4 @@ export const isEdgeChromium = isEdgeChromiumType(); export const isLegacyEdge = isEdgeType(); export const isWindows = isWindowsType(); export const isMacOs = isMacOsType(); +export const isMIUI = isMIUIType(); From 207a412a2b4d8fa45c1be2e040f4c1b933509234 Mon Sep 17 00:00:00 2001 From: pietrobs Date: Wed, 5 Aug 2020 16:36:24 -0300 Subject: [PATCH 3/3] Add type of isMIUI helper --- index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.d.ts b/index.d.ts index 134fe13..af774e5 100644 --- a/index.d.ts +++ b/index.d.ts @@ -61,6 +61,7 @@ declare module "react-device-detect" { export import isWindows = ReactDeviceDetect.isWindows; export import isMacOs = ReactDeviceDetect.isMacOs; export import withOrientationChange = ReactDeviceDetect.withOrientationChange; + export import isMIUI = ReactDeviceDetect.isMIUI; } declare namespace ReactDeviceDetect { @@ -196,4 +197,6 @@ declare namespace ReactDeviceDetect { export const isWindows: boolean; export const isMacOs: boolean; + + export const isMIUI: boolean; }