restrict "share" to mobile, fixes #1505
This commit is contained in:
parent
fc8673b87a
commit
1ec2b995b0
@ -77,6 +77,7 @@ async function polyfillStreams() {
|
|||||||
|
|
||||||
export default async function getCapabilities() {
|
export default async function getCapabilities() {
|
||||||
const browser = browserName();
|
const browser = browserName();
|
||||||
|
const isMobile = /mobi|android/i.test(navigator.userAgent);
|
||||||
const serviceWorker = 'serviceWorker' in navigator && browser !== 'edge';
|
const serviceWorker = 'serviceWorker' in navigator && browser !== 'edge';
|
||||||
let crypto = await checkCrypto();
|
let crypto = await checkCrypto();
|
||||||
const nativeStreams = checkStreams();
|
const nativeStreams = checkStreams();
|
||||||
@ -91,14 +92,15 @@ export default async function getCapabilities() {
|
|||||||
account = false;
|
account = false;
|
||||||
}
|
}
|
||||||
const share =
|
const share =
|
||||||
typeof navigator.share === 'function' && locale().startsWith('en'); // en until strings merge
|
isMobile &&
|
||||||
|
typeof navigator.share === 'function' &&
|
||||||
|
locale().startsWith('en'); // en until strings merge
|
||||||
|
|
||||||
const standalone =
|
const standalone =
|
||||||
window.matchMedia('(display-mode: standalone)').matches ||
|
window.matchMedia('(display-mode: standalone)').matches ||
|
||||||
navigator.standalone;
|
navigator.standalone;
|
||||||
|
|
||||||
const mobileFirefox =
|
const mobileFirefox = browser === 'firefox' && isMobile;
|
||||||
browser === 'firefox' && /mobile/i.test(navigator.userAgent);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
account,
|
account,
|
||||||
|
@ -142,12 +142,16 @@ function openLinksInNewTab(links, should = true) {
|
|||||||
|
|
||||||
function browserName() {
|
function browserName() {
|
||||||
try {
|
try {
|
||||||
|
// order of these matters
|
||||||
if (/firefox/i.test(navigator.userAgent)) {
|
if (/firefox/i.test(navigator.userAgent)) {
|
||||||
return 'firefox';
|
return 'firefox';
|
||||||
}
|
}
|
||||||
if (/edge/i.test(navigator.userAgent)) {
|
if (/edge/i.test(navigator.userAgent)) {
|
||||||
return 'edge';
|
return 'edge';
|
||||||
}
|
}
|
||||||
|
if (/edg/i.test(navigator.userAgent)) {
|
||||||
|
return 'edgium';
|
||||||
|
}
|
||||||
if (/trident/i.test(navigator.userAgent)) {
|
if (/trident/i.test(navigator.userAgent)) {
|
||||||
return 'ie';
|
return 'ie';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user