Skip to content

Commit

Permalink
[C-2337] Remove reachability mobile web (#3090)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson authored Mar 24, 2023
1 parent 4ad5cd2 commit 962a6df
Show file tree
Hide file tree
Showing 15 changed files with 292 additions and 506 deletions.
2 changes: 0 additions & 2 deletions packages/common/src/store/account/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export const getUserId = (state: CommonState) => state.account.userId
export const getAccountStatus = (state: CommonState) => state.account.status
export const getUserPlaylistOrder = (state: CommonState) =>
state.account.orderedPlaylists
export const getConnectivityFailure = (state: CommonState) =>
state.account.connectivityFailure
export const getNeedsAccountRecovery = (state: CommonState) =>
state.account.needsAccountRecovery
export const getAccountToCache = (state: CommonState) => ({
Expand Down
12 changes: 8 additions & 4 deletions packages/web/scripts/workers-site/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getAssetFromKV, mapRequestToAsset } from '@cloudflare/kv-asset-handler'

const DEBUG = false

addEventListener('fetch', event => {
addEventListener('fetch', (event) => {
try {
event.respondWith(handleEvent(event))
} catch (e) {
Expand Down Expand Up @@ -39,11 +39,15 @@ async function handleEvent(event) {

const userAgent = event.request.headers.get('User-Agent') || ''

const is204 = pathname === '/204'
if (is204) {
return new Response(undefined, { status: 204 })
}

const isBot = checkIsBot(userAgent)
const isEmbed = pathname.startsWith('/embed')
const is204 = pathname === '/204'

if (isBot || isEmbed || is204) {
if (isBot || isEmbed) {
const destinationURL = GA + pathname + search + hash
const newRequest = new Request(destinationURL, event.request)
newRequest.headers.set('host', GA)
Expand All @@ -61,7 +65,7 @@ async function handleEvent(event) {

const options = {}
// Always map requests to `/`
options.mapRequestToAsset = request => {
options.mapRequestToAsset = (request) => {
const url = new URL(request.url)
url.pathname = `/`
return mapRequestToAsset(new Request(url, request))
Expand Down
3 changes: 0 additions & 3 deletions packages/web/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ import './index.css'
type AudiusAppProps = {
setReady: () => void
isReady: boolean
setConnectivityFailure: (failure: boolean) => void
shouldShowPopover: boolean
}

const AudiusApp = ({
setReady,
isReady,
setConnectivityFailure,
shouldShowPopover
}: AudiusAppProps) => {
return (
Expand All @@ -55,7 +53,6 @@ const AudiusApp = ({
setReady={setReady}
isReady={isReady}
mainContentRef={mainContentRef}
setConnectivityFailure={setConnectivityFailure}
shouldShowPopover={shouldShowPopover}
/>
</CoinbasePayButtonProvider>
Expand Down

This file was deleted.

91 changes: 44 additions & 47 deletions packages/web/src/components/notification/NotificationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { useDispatch, useSelector } from 'react-redux'
import loadingSpinner from 'assets/animations/loadingSpinner.json'
import MobilePageContainer from 'components/mobile-page-container/MobilePageContainer'
import NavContext, { LeftPreset } from 'components/nav/store/context'
import NetworkConnectivityMonitor from 'components/network-connectivity/NetworkConnectivityMonitor'

import { EmptyNotifications } from './EmptyNotifications'
import { Notification } from './Notification'
Expand Down Expand Up @@ -70,52 +69,50 @@ export const NotificationPage = () => {
}, [dispatch, notificationUnviewedCount])

return (
<NetworkConnectivityMonitor pageDidLoad={status !== Status.LOADING}>
<MobilePageContainer
title={messages.documentTitle}
description={messages.description}
backgroundClassName={styles.background}
fullHeight
>
<div className={styles.notificationContainer}>
{notifications.length > 0 ? (
<InfiniteScroll
pageStart={0}
loadMore={loadMore}
hasMore={true}
useWindow={true}
initialLoad={false}
threshold={SCROLL_THRESHOLD}
>
<div className={styles.content}>
{notifications
.filter(({ isHidden }: any) => !isHidden)
.map((notification: Notifications) => {
return (
<Notification
key={notification.id}
notification={notification}
/>
)
})}
{status === Status.LOADING && (
<div className={styles.spinnerContainer} key={'loading'}>
<Lottie
options={{
loop: true,
autoplay: true,
animationData: loadingSpinner
}}
<MobilePageContainer
title={messages.documentTitle}
description={messages.description}
backgroundClassName={styles.background}
fullHeight
>
<div className={styles.notificationContainer}>
{notifications.length > 0 ? (
<InfiniteScroll
pageStart={0}
loadMore={loadMore}
hasMore={true}
useWindow={true}
initialLoad={false}
threshold={SCROLL_THRESHOLD}
>
<div className={styles.content}>
{notifications
.filter(({ isHidden }: any) => !isHidden)
.map((notification: Notifications) => {
return (
<Notification
key={notification.id}
notification={notification}
/>
</div>
)}
</div>
</InfiniteScroll>
) : (
<EmptyNotifications />
)}
</div>
</MobilePageContainer>
</NetworkConnectivityMonitor>
)
})}
{status === Status.LOADING && (
<div className={styles.spinnerContainer} key={'loading'}>
<Lottie
options={{
loop: true,
autoplay: true,
animationData: loadingSpinner
}}
/>
</div>
)}
</div>
</InfiniteScroll>
) : (
<EmptyNotifications />
)}
</div>
</MobilePageContainer>
)
}
23 changes: 0 additions & 23 deletions packages/web/src/components/reachability-bar/ReachabilityBar.tsx

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/web/src/pages/App.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ type AppProps = {
setReady: () => void
isReady: boolean
mainContentRef: MutableRefObject<HTMLDivElement | undefined>
setConnectivityFailure: (failure: boolean) => void
shouldShowPopover: boolean
}

Expand Down
Loading

0 comments on commit 962a6df

Please sign in to comment.