diff --git a/packages/detect-iab/package.json b/packages/detect-iab/package.json index 3997335..01f88e8 100644 --- a/packages/detect-iab/package.json +++ b/packages/detect-iab/package.json @@ -31,7 +31,6 @@ "@ethersproject/providers": "^5.6.8", "@qubic-js/detect-inapp": "^1.4.1", "clsx": "^1.1.1", - "detectincognitojs": "^1.3.0", "jss": "^10.9.0", "jss-preset-default": "^10.9.0", "preact": "^10.8.2" diff --git a/packages/detect-iab/src/LeaveIncognitoBrowserModal.tsx b/packages/detect-iab/src/LeaveIncognitoBrowserModal.tsx deleted file mode 100644 index df3247c..0000000 --- a/packages/detect-iab/src/LeaveIncognitoBrowserModal.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { memo, useMemo } from 'preact/compat'; - -import { LEAVE_INCOGNITO_MODAL_ID } from './constant'; -import { getLocaleStrings } from './locale'; -import { classes } from './styles'; -import Hint from './Hint'; -import { doubleBrowserIcons } from './icons/DoubleBrowserIcons'; - -const localeStrings = getLocaleStrings(); - -interface ModalProps { - browserName: string; -} - -const isiPhone = typeof window !== 'undefined' ? /iPhone|iPod/i.test(navigator.userAgent) : false; - -const LeaveIncognitoBrowserModal = memo(props => { - const { browserName } = props; - - const arrowPosition = useMemo(() => { - // in iOS, Built in QR Code app will open web in private browsing mode - // iPhone | iPad - // QRCode App | Open in Safari on Bottom | Open in Safari on Top - // Safari | Open Tabs on Bottom | Open Tabs on Top - if (browserName !== 'Safari') return null; - if (isiPhone) { - return 'bottom'; - } - return 'top'; - }, [browserName]); - - return ( -
-
-
- browser - {localeStrings.alertIncognitoSentence1} - {localeStrings.alertIncognitoSentence2} -
- {browserName === 'Safari' && {localeStrings.openInSafariInNormal}} -
-
- ); -}); -export default LeaveIncognitoBrowserModal; diff --git a/packages/detect-iab/src/constant.ts b/packages/detect-iab/src/constant.ts index 6465ebe..00d72f6 100644 --- a/packages/detect-iab/src/constant.ts +++ b/packages/detect-iab/src/constant.ts @@ -1,2 +1 @@ export const LEAVE_IAB_MODAL_ID = 'qubic-connect-leave-iab-modal'; -export const LEAVE_INCOGNITO_MODAL_ID = 'qubic-connect-leave-incognito-modal'; diff --git a/packages/detect-iab/src/index.tsx b/packages/detect-iab/src/index.tsx index e24c603..37cc0e6 100644 --- a/packages/detect-iab/src/index.tsx +++ b/packages/detect-iab/src/index.tsx @@ -1,20 +1,9 @@ import InApp from '@qubic-js/detect-inapp'; import { render } from 'preact'; -import { detectIncognito } from 'detectincognitojs'; -import { LEAVE_IAB_MODAL_ID, LEAVE_INCOGNITO_MODAL_ID } from './constant'; +import { LEAVE_IAB_MODAL_ID } from './constant'; import LeaveInAppBrowserModal, { ShowBlockerOptions } from './LeaveInAppBrowserModal'; -import LeaveIncognitoBrowserModal from './LeaveIncognitoBrowserModal'; export async function showBlockerWhenIab(options?: ShowBlockerOptions): Promise { - const incognitoResult = typeof window !== 'undefined' ? await detectIncognito() : null; - - if (incognitoResult && incognitoResult.isPrivate && !document.getElementById(LEAVE_INCOGNITO_MODAL_ID)) { - const createdRootDiv = document.createElement('div'); - document.body.appendChild(createdRootDiv); - - render(, createdRootDiv); - return; - } const inapp = new InApp(navigator.userAgent || navigator.vendor || (window as any).opera); if (inapp.isInApp && !document.getElementById(LEAVE_IAB_MODAL_ID)) { diff --git a/packages/detect-iab/src/locale.ts b/packages/detect-iab/src/locale.ts index e26932d..1600864 100644 --- a/packages/detect-iab/src/locale.ts +++ b/packages/detect-iab/src/locale.ts @@ -1,8 +1,7 @@ const en = { alertIabSentence1: 'You are using an in-app browser.', - alertIabSentence2: 'Some functions will be affected. To have a better experience, tap “⋯” and choose “open in system browser”.', - alertIncognitoSentence1: 'You are now in private browsing mode', - alertIncognitoSentence2: 'To have a better experience, open the website in normal browsing mode.', + alertIabSentence2: + 'Some functions will be affected. To have a better experience, tap “⋯” and choose “open in system browser”.', hintPart1: 'Tap "', hintPart2: '" and choose "', hintPart3: '".', @@ -19,8 +18,6 @@ const en = { const zhTW = { alertIabSentence1: '您正在使用其他應用程式的瀏覽器', alertIabSentence2: '可能會影響部分功能,為了享有更完整的服務,請點擊「⋯」,並選擇「 以瀏覽器開啟」。', - alertIncognitoSentence1: '您正在使用私密瀏覽模式', - alertIncognitoSentence2: '為了享有更完整的服務,請在瀏覽器以一般模式開啟網頁', hintPart1: '點擊「', hintPart2: '」,並選擇「', hintPart3: '」', diff --git a/yarn.lock b/yarn.lock index 170d715..18cbf1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6742,11 +6742,6 @@ detect-port-alt@^1.1.6: address "^1.0.1" debug "^2.6.0" -detectincognitojs@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/detectincognitojs/-/detectincognitojs-1.3.0.tgz#6a1338f395c03e06f59e3cf42453e95c96980531" - integrity sha512-/uAMG+6Ipa8izluYQ45HqARjeYgtJLLBvpAiX1Zd3zWJ1MhEne6FDSjkkLaC3pdNeHfT3qhpvFRqB6dwLbdnng== - detective@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/detective/-/detective-5.2.1.tgz#6af01eeda11015acb0e73f933242b70f24f91034"