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: firefox extension permission ui #3864

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

feat: firefox extension permission ui #3864

wants to merge 19 commits into from

Conversation

sshanzel
Copy link
Member

@sshanzel sshanzel commented Nov 21, 2024

Changes

  • Check whether the extension is Firefox.
    • If so, we check cache whether the user has accepted the permission popup.
    • If not, show the prompt.

Events

Did you introduce any new tracking events?

Experiment

Did you introduce any new experiments?

Manual Testing

Caution

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

MI-613

Preview domain

https://mi-631.preview.app.daily.dev

Copy link

vercel bot commented Nov 21, 2024

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

Name Status Preview Updated (UTC)
daily-webapp ✅ Ready (Inspect) Visit Preview Nov 25, 2024 2:39pm
1 Skipped Deployment
Name Status Preview Updated (UTC)
storybook ⬜️ Ignored (Inspect) Nov 25, 2024 2:39pm

Copy link
Contributor

@AmarTrebinjac AmarTrebinjac left a comment

Choose a reason for hiding this comment

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

Looking good! 👏🏼

Left a few comments for consideration 😊

export const checkIsFirefox = (): boolean =>
typeof globalThis?.navigator !== 'undefined' &&
/firefox/i.test(globalThis?.navigator.userAgent);

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we maybe add "firefox" to the UserAgent enum and use checkIsBrowser instead?

Copy link
Member Author

@sshanzel sshanzel Nov 22, 2024

Choose a reason for hiding this comment

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

Yeah, I thought of it at first but decided to use the one specifically for Firefox. Maybe yeah it is better to keep them on the same function by lowercasing the values from the userAgent.

You can{' '}
<button type="button" className="text-text-link" onClick={onGoBack}>
go back
</button>{' '}
Copy link
Contributor

@AmarTrebinjac AmarTrebinjac Nov 21, 2024

Choose a reason for hiding this comment

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

Are these intentional or just the linter? if you wrap "you can" and "and accept the required permissions." in spans, then just having a regular space between the elements will separate the words naturally. But it should also work to just have a regular space without any wrapping or {' '}

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, intentional by the linter :lolsob: , they get joined together without it. Not normally a fan adding a wrap without any additional attributes, but I'm open to it 👀

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.

Don't we want to do all this in extension only maybe?
As they are the only ones complaining, not specific firefox

packages/extension/src/newtab/App.tsx Show resolved Hide resolved
@@ -106,6 +117,7 @@ function InternalApp(): ReactElement {
const isPageReady =
(growthbook?.ready && router?.isReady && isAuthReady) || isTesting;
const shouldRedirectOnboarding = !user && isPageReady && !isTesting;
const isFirefox = checkIsBrowser(UserAgent.Firefox);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't you use the existing one?
isFirefoxExtension?

I think in this new flow we don't auto spool webapp right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Otherwise remember nensi also added some more extended browser detection one time.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. Makes sense, we can actually use that to simplify.

<FirefoxPermissionItem
className="mt-2"
title="Ads pixel tracking"
description="Enable pixel tracking for fewer, non-intrusive ads, helping us in keeping the experience free and relevant."
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe raise with product if they don't want to add people can also buy plus and no ads are shown here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. Let me check.

@@ -95,10 +95,11 @@ export const sortAlphabeticallyByProperty =
export enum UserAgent {
Chrome = 'Chrome',
Edge = 'Edg', // intended to be Edg, not Edge
Firefox = 'Firefox', // intended to be Edg, not Edge
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment shouldn't be here.

/>
<div className="flex w-full max-w-[35rem] flex-col items-center gap-4">
<span className="h-36 max-w-[16.25rem]">
<img src={cloudinaryGenericErrorDark} alt="You declined (FML)" />
Copy link
Member

Choose a reason for hiding this comment

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

(FML) 😂

>
You can{' '}
<button type="button" className="text-text-link" onClick={onGoBack}>
go back
Copy link
Member

Choose a reason for hiding this comment

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

Since the user has already declined, maybe we should also show a link to the webapp as an alternative?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I can also raise it to the product team 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

Added! 🚀

Comment on lines +84 to +86
if (isFirefox && permission !== FirefoxPermissionType.Accepted) {
return;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@idoshamun we are now stopping the send of analytics until it is accepted, only of course for Firefox.

Copy link
Member

Choose a reason for hiding this comment

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

we just need to make sure this doesn't apply to the firefox browser. just the extension

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.

5 participants