Skip to content

feat: popup premium ui controls [#1680]

Marwan Zibaoui requested to merge popup-2024-premium-ui into ee-371-popup-premium

This MR implements the premium version of the new UI popup.

I did my best to make the review easy by having a good commit history so I would recommend to look at it by going at it commit by commit and being aware of the changes that have been made in the previous MR !1060 (merged)

To review this MR it's important to understand how the two premium features are working:

  • Automatically accepting cookie banners
  • Removing extra annoyances like auto-playing videos

Under the hood they are actually filter list subscriptions, just like EasyList. There is no specific implementations of these features in the extension, instead we need to have the EWE SDK subscribe/unsubscribe to those lists.

The existing checkboxes for enabling these features in the options page are already hooked up to listeners that will make it so the UI refreshes if the subscriptions are added or removed. I have not touched the option page for implementing these changes.

However the way things are implemented in the options UI are very convoluted and quite difficult to follow. So I opted to instead extend the existing api.premium namespace to include the following functions:

  • getPremiumSubscriptionsState which will return an object { cookies: boolean, annoyances: boolean } so we can query the current state of the subscriptions
  • add(premiumSubscription: "cookie" | "annoyances") which will add a subscription
  • remove(premiumSubscription: "cookie" | "annoyances") which will remove a subscription

If you're not aware of how the ABP API works: the functions are meant to be used in content scripts or page scripts. They can then send a message to the background process where we can intercept and answer these messages using the port module.

Each function is adding a new message type and these are all handled in the src/premium-subscriptions/background/premium-subscriptions.ts file.

Edited by Marwan Zibaoui

Merge request reports