Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel committed Sep 30, 2024
1 parent c5b87a1 commit 8993d33
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions components/v2/CTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type CTAProps = {
}

const CTA = ({ linkTitle, deepLink }: CTAProps) => {
console.log('CTA deepLink', deepLink)
const intl = useIntl()
return (
<div className="bg-white p-6 border border-blue-600">
Expand Down
35 changes: 18 additions & 17 deletions pages/v2/[linkId].tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
import OONIRunHero from 'components/OONIRunHero'
import OONIRunHeroMinimal from 'components/OONIRunHeroMinimal'
import CTA from 'components/v2/CTA'
// import CTA from 'components/v2/CTA'
import DescriptorView from 'components/v2/DescriptorView'
import MetaTags from 'components/v2/MetaTags'
import PublicDescriptorView from 'components/v2/PublicDescriptorView'
import mobileApp from 'config/mobileApp'
import { getRunLink } from 'lib/api'
import type { GetServerSideProps } from 'next'
import dynamic from 'next/dynamic'
import type { ParsedUrlQuery } from 'node:querystring'
import { useMemo } from 'react'
import { useIntl } from 'react-intl'
import { getIntentURIv2, getUniversalQuery } from 'utils/links'
import OONI404 from '/public/static/images/OONI_404.svg'

const useragent = require('useragent/index.js')
const CTA = dynamic(() => import('components/v2/CTA'), {
ssr: false,
})

const installLink = 'https://ooni.org/install'
const useragent = require('useragent/index.js')

type Props = {
deepLink: string
iOSDeepLink: string
withWindowLocation: boolean
storeLink: string
installLink: string
userAgent: string
universalLink: string
title: string
Expand Down Expand Up @@ -112,7 +115,6 @@ export const getServerSideProps: GetServerSideProps<Props> = async ({
iOSDeepLink,
withWindowLocation,
storeLink,
installLink,
userAgent: JSON.stringify(ua),
universalLink,
title,
Expand All @@ -131,7 +133,6 @@ const Nettest = ({
iOSDeepLink,
withWindowLocation,
storeLink,
installLink,
universalLink,
title,
description,
Expand All @@ -140,13 +141,17 @@ const Nettest = ({
error,
}: Props) => {
const intl = useIntl()
const isIOS =
typeof window !== 'undefined' // TODO: remove after iOS testing
? JSON.parse(userAgent)?.os?.family === 'iOS' && // TODO: remove after iOS testing
window.location.hostname !== 'run.test.ooni.org' // TODO: remove after iOS testing
: JSON.parse(userAgent)?.os?.family === 'iOS'
const displayDeepLink = isIOS ? iOSDeepLink : deepLink
const isIOS = false
// typeof window !== 'undefined' // TODO: remove after iOS testing
// ? JSON.parse(userAgent)?.os?.family === 'iOS' && // TODO: remove after iOS testing
// window.location.hostname !== 'run.test.ooni.org' // TODO: remove after iOS testing
// : JSON.parse(userAgent)?.os?.family === 'iOS'
const displayDeepLink = useMemo(
() => (isIOS ? iOSDeepLink : deepLink),
[isIOS, deepLink, iOSDeepLink],
)
console.log('isIOS', isIOS)
console.log('displayDeepLink', displayDeepLink)
const windowScript = `window.onload = function() {
document.getElementById('l').src = '${displayDeepLink}';
setTimeout(function() {
Expand Down Expand Up @@ -182,11 +187,7 @@ const Nettest = ({
) : (
<div className="bg-gray-50">
<div className="container px-4 lg:px-8 py-8">
<CTA
linkTitle={runLink?.name}
deepLink={displayDeepLink}
// installLink={installLink}
/>
<CTA linkTitle={runLink?.name} deepLink={displayDeepLink} />
<div className="mt-8">
<PublicDescriptorView
descriptor={runLink}
Expand Down

0 comments on commit 8993d33

Please sign in to comment.