Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pwa install on desktop #3889

Open
wants to merge 68 commits into
base: main
Choose a base branch
from
Open

feat: pwa install on desktop #3889

wants to merge 68 commits into from

Conversation

ilasw
Copy link
Contributor

@ilasw ilasw commented Nov 28, 2024

Changes

  • Only for desktop user that do not come from extension, if skipped installing, show additional PWA step;
  • For Firefox users this step will be available as last, if they have enabled PWA;
  • Added optional param in onClickNext for handling skipping specific step;
  • Added function for get browser name

Events

Did you introduce any new tracking events?

image

Experiment

Did you introduce any new experiments?

Name : onboarding_desktop_pwa
Available options: boolean (true/false)

Enrollment for users:

  • On desktop
  • AND not coming from extension
  • AND clicks on next button on the onboarding tag selection.
  • AND one of this:
    • is using [Chrome/Brave/Edge/Safari] AND have skipped installing extension
    • is coming from Firefox

Manual Testing

Caution

Please make sure existing components are not breaking/affected by this PR

Preview domain

https://feat-install-pwa-desktop.preview.app.daily.dev

Copy link

vercel bot commented Nov 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
daily-webapp ✅ Ready (Inspect) Visit Preview Jan 8, 2025 1:55pm
1 Skipped Deployment
Name Status Preview Updated (UTC)
storybook ⬜️ Ignored (Inspect) Jan 8, 2025 1:55pm

Copy link
Member

@sshanzel sshanzel left a comment

Choose a reason for hiding this comment

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

Looks amazing! Really appreciate the generic function to determine which browser is being used 🚀

Just kindly test it out since it has been a while since this was raised, to ensure it would run as intended.

Copy link
Contributor

@rebelchris rebelchris left a comment

Choose a reason for hiding this comment

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

Very minor points so approving for now, but do check.

import type { BrowserName } from '../../../lib/func';
import { getCurrentBrowserName, isPWA } from '../../../lib/func';

interface IBeforeInstallPromptEvent extends Event {
Copy link
Contributor

Choose a reason for hiding this comment

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

We never really use the I prefix naming (non trivial but would avoid it moving forward)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BeforeInstallPromptEvent is the original type name for this so I'm using a different name avoiding future collision. But I'm renaming in order to remove the prefix ✔️

Comment on lines 14 to 22
let installEvent: IBeforeInstallPromptEvent | null = null;
globalThis?.addEventListener?.(
'beforeinstallprompt',
(e: IBeforeInstallPromptEvent) => {
e.preventDefault();
installEvent = e;
},
{ once: true },
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sure you tested it on the browsers that need it, if it works it's fine with me

isLaptop &&
!isCurrentPWA &&
canUserInstallDesktop &&
activeScreen !== OnboardingStep.InstallDesktop &&
Copy link
Contributor

Choose a reason for hiding this comment

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

It's hard to see but doesn't this now prompt it as the first screen?
Also steps beyond this might re-show it now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tested and this works as intended.
At this point of the function there is no chance to get evaluated before last step ✔️

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