Skip to content

Commit

Permalink
iOS Detection #36, #37, #88, #93
Browse files Browse the repository at this point in the history
  • Loading branch information
AguzzTN54 committed May 21, 2024
1 parent 552e7b0 commit e6cb515
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/lib/helpers/mobileDetect.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export const browserDetect = () => {

export const isSafari = () => {
const userAgent = window.navigator?.userAgent?.toLowerCase();
const chromeFn = window.chrome;
const chromeAgent = userAgent?.indexOf('chrome');
const safariAgent = userAgent?.match('safari') && !chromeAgent && !chromeFn;
return safariAgent;
const safariAgent = /^((?!chrome|android).)*safari/i.test(userAgent);
const iosDevice = /ipad|iphone|ipod|macintosh/.test(userAgent) && !window?.MSStream;
const isSafariBrowser = safariAgent || iosDevice;
return isSafariBrowser;
};
7 changes: 4 additions & 3 deletions src/routes/_index/ModalWelcome.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@
{#if !browserDetect().isSupported && isPWA}
<div class="updates adExpired">
<strong>
We highly recommend you to install
<span style="display: inline; color:#5ab3ff"> Google Chrome </span>
First, Maybe some features won't work properly for now!
We highly recommend installing <span style="display: inline; color:#5ab3ff">
Google Chrome
</span>
for optimal performance as some features may not be fully supported on.
</strong>
</div>
{:else if dateExpired && dateExpired !== 'none'}
Expand Down
6 changes: 4 additions & 2 deletions src/routes/_wish/wish-result/_meteor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
});
videoContent.addEventListener('error', () => {
const message = $t('wish.result.meteorFailed');
const statusCode = videoContent.error.message;
const message = `${$t('wish.result.meteorFailed')} "${statusCode}" - ${videoContent.src}`;
pushToast({ message });
console.error('Failed to load the Falling Star Animation', videoContent.error);
console.error(`Failed to load the Falling Star Animation`);
return meteorEnd();
});
});
Expand Down

0 comments on commit e6cb515

Please sign in to comment.