Skip to content

Commit

Permalink
refactor: remove workaround for Safari in browserCheck
Browse files Browse the repository at this point in the history
- faisalman/ua-parser-js#599 is fixed in 1.0.32

Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
  • Loading branch information
ShGKme authored and backportbot-nextcloud[bot] committed Nov 27, 2023
1 parent 7128c07 commit 772b093
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/utils/browserCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,9 @@ import { translate as t } from '@nextcloud/l10n'
const parser = new UAParser()
const browser = parser.getBrowser()

const getBrowserVersion = () => {
if (browser.version) {
return browser.version
}

if (browser.name === 'Safari') {
// Workaround for https://github.com/faisalman/ua-parser-js/issues/599
const match = parser.getUA().match(' Version/([0-9.,]+) ')
if (match) {
return match[1]
}
}

return undefined
}
/**
* Per-browser flags and a major version
*/

export const isFirefox = browser.name === 'Firefox'
export const isChrome = browser.name === 'Chrome' || browser.name === 'Chromium'
Expand All @@ -54,8 +42,7 @@ export const isBrave = browser.name === 'Brave'
export const isIE = browser.name === 'IE' || browser.name === 'IEMobile'
export const isYandex = browser.name === 'Yandex'

export const browserVersion = getBrowserVersion()
export const majorVersion = browserVersion ? parseInt(browserVersion.split('.')[0], 10) : 0
export const majorVersion = browser.version ? parseInt(browser.version.split('.')[0], 10) : 0

/**
* Is the browser fully supported by Talk
Expand Down Expand Up @@ -86,7 +73,7 @@ export const unsupportedWarning = t('spreed', "The browser you're using is not f
* Show an error toast if the browser is not fully supported
*/
export function checkBrowser() {
console.info('Detected browser ' + browser.name + ' ' + majorVersion + ' (' + browserVersion + ')')
console.info('Detected browser ' + browser.name + ' ' + majorVersion + ' (' + browser.version + ')')
if (!isFullySupported) {
showError(unsupportedWarning, { timeout: TOAST_PERMANENT_TIMEOUT })
}
Expand Down

0 comments on commit 772b093

Please sign in to comment.