Skip to content

Conversation

@Thenlie
Copy link
Collaborator

@Thenlie Thenlie commented Mar 20, 2025

This PR creates a banner to indicate to Android users that they can install a native app.

  • The "here" text links to the play store.
  • The "X" button will dismiss the banner and prevent it from showing again, unless local storage is cleared.
  • This will only ever show on android web devices based on userAgent.

Pretty bare-bones right now. Happy to add more to this if needed.

IMG_6492

Apologies for the terrible screenshot XD


export default function AndroidUpgradeNotification() {
const [alertVisible, setAlertVisible] = useState(true);
const androidUpgradeNotificationDismissed = localStorage.getItem(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this synchronous and okay to use in the render function? if so, just pass !androidUpgradeNotificationDismissed into the useState default and you can drop the useEffect below :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may break because of SSR. if so you can make this component imported dynamically so it only renders on the client

import dynamic from 'next/dynamic'
 
const DynamicHeader = dynamic(() => import('../components/header'), {
  ssr: false,
})

@switz switz merged commit 6f19030 into master Mar 20, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants