This commit is contained in:
John Huang 2024-02-15 09:42:04 -08:00
parent 027c1ef8ec
commit 5d7863348a
No known key found for this signature in database
GPG Key ID: 7BEF1876FF3664D9
2 changed files with 8 additions and 32 deletions

View File

@ -9,7 +9,9 @@ type ElementProps = {
setIsOpen: (open: boolean) => void;
};
const appStoreUrl = document.querySelector('meta[name="smartbanner:button-url-apple"]')?.getAttribute('content');
// const appStoreUrl = "http://example.com"; for testing only
const MobileQrCode = ({
url,
}: {
@ -23,13 +25,9 @@ const MobileQrCode = ({
};
export const MobileDownloadDialog = ({ setIsOpen }: ElementProps) => {
const encryptionKey = "hello world!";
const content = (
<>
<MobileQrCode
url={encryptionKey}
/>
<MobileQrCode url={appStoreUrl!} />
</>
);

View File

@ -41,14 +41,6 @@ import { isTruthy } from '@/lib/isTruthy';
import { truncateAddress } from '@/lib/wallet';
import { MustBigNumber } from '@/lib/numbers';
function getOS() {
var uA = navigator.userAgent;
if ((/iPad|iPhone|iPod/.test(uA)) || (uA.includes('Mac') && 'ontouchend' in document)) return 'iOS';
var i, os = ['Windows', 'Android', 'Unix', 'Mac', 'Linux', 'BlackBerry'];
for (i = 0; i < os.length; i++) if (new RegExp(os[i],'i').test(uA)) return os[i];
}
export const AccountMenu = () => {
const stringGetter = useStringGetter();
const { mintscanBase } = useURLConfigs();
@ -68,11 +60,8 @@ export const AccountMenu = () => {
dispatch(openDialog({ type: DialogTypes.Onboarding }));
};
// const appStoreUrl = document.querySelector('meta[name="app-store-url"]')?.getAttribute('content');
// const googlePlayUrl = document.querySelector('meta[name="google-play-url"]')?.getAttribute('content');
const appStoreUrl = "http://example.com";
const googlePlayUrl = "http://example.com";
const os = getOS();
const appStoreUrl = document.querySelector('meta[name="smartbanner:button-url-apple"]')?.getAttribute('content');
// const appStoreUrl = "http://example.com"; for testing
return onboardingState === OnboardingState.Disconnected ? (
@ -204,25 +193,14 @@ export const AccountMenu = () => {
label: stringGetter({ key: STRING_KEYS.DISPLAY_SETTINGS }),
onSelect: () => dispatch(openDialog({ type: DialogTypes.DisplaySettings })),
},
...((appStoreUrl && os != 'Android') || (googlePlayUrl && os != 'iOS')
...(appStoreUrl
? [
{
value: 'MobileDownload',
icon: <Icon iconName={IconName.Qr} />,
label: "Download Mobile App",
onSelect: () => {
switch (os) {
case 'iOS':
window.open(appStoreUrl, '_blank');
break;
case 'Android':
window.open(googlePlayUrl, '_blank');
default:
dispatch(openDialog({ type: DialogTypes.MobileDownload }));
break;
}
dispatch(openDialog({ type: DialogTypes.MobileDownload }));
},
},
]