-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from hiroshisuga/dev5.0.0_prettyPollPR
Prettier poll result
- Loading branch information
Showing
6 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Bowser from 'bowser'; | ||
|
||
const BOWSER_RESULTS = Bowser.parse(window.navigator.userAgent); | ||
|
||
const isChrome = BOWSER_RESULTS.browser.name === 'Chrome'; | ||
const isSafari = BOWSER_RESULTS.browser.name === 'Safari'; | ||
const isEdge = BOWSER_RESULTS.browser.name === 'Microsoft Edge'; | ||
const isIe = BOWSER_RESULTS.browser.name === 'Internet Explorer'; | ||
const isFirefox = BOWSER_RESULTS.browser.name === 'Firefox'; | ||
|
||
const browserName = BOWSER_RESULTS.browser.name; | ||
const versionNumber = BOWSER_RESULTS.browser.version; | ||
|
||
const isValidSafariVersion = Bowser.getParser(window.navigator.userAgent).satisfies({ | ||
safari: '>12', | ||
}); | ||
|
||
const browserInfo = { | ||
isChrome, | ||
isSafari, | ||
isEdge, | ||
isIe, | ||
isFirefox, | ||
browserName, | ||
versionNumber, | ||
isValidSafariVersion, | ||
}; | ||
|
||
export default browserInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import Bowser from 'bowser'; | ||
|
||
const BOWSER_RESULTS = Bowser.parse(window.navigator.userAgent); | ||
|
||
const isPhone = BOWSER_RESULTS.platform.type === 'mobile'; | ||
// we need a 'hack' to correctly detect ipads with ios > 13 | ||
const isTablet = BOWSER_RESULTS.platform.type === 'tablet' || (BOWSER_RESULTS.os.name === 'macOS' && window.navigator.maxTouchPoints > 0); | ||
const isMobile = isPhone || isTablet; | ||
const hasMediaDevices = !!navigator.mediaDevices; | ||
const osName = BOWSER_RESULTS.os.name; | ||
const osVersion = BOWSER_RESULTS.os.version; | ||
const isIos = osName === 'iOS'; | ||
const isMacos = osName === 'macOS'; | ||
const isIphone = !!(window.navigator.userAgent.match(/iPhone/i)); | ||
|
||
const SUPPORTED_IOS_VERSION = 12.2; | ||
const isIosVersionSupported = () => parseFloat(osVersion) >= SUPPORTED_IOS_VERSION; | ||
|
||
const isPortrait = () => window.innerHeight > window.innerWidth; | ||
|
||
const deviceInfo = { | ||
isTablet, | ||
isPhone, | ||
isMobile, | ||
hasMediaDevices, | ||
osName, | ||
isPortrait, | ||
isIos, | ||
isMacos, | ||
isIphone, | ||
isIosVersionSupported, | ||
}; | ||
|
||
export default deviceInfo; |