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

Add extension opt-in option to show update popup #541

Closed
wants to merge 19 commits into from

Conversation

cyrildtm
Copy link
Contributor

Add an opt-in option to display a new tab for changelog after each update.
Default is disabled, which means you won't see updates.
This comes after PR #537 with a temporary cherry pick. Tell me to rebase once that one is merged.
Improves #534
Part of #539

@cyrildtm cyrildtm changed the title Add extension option to show update popup Add extension opt-in option to show update popup Apr 18, 2022
cyrildtm pushed a commit to cyrildtm/return-youtube-dislike that referenced this pull request Apr 19, 2022
clean up unnecessary commented code

Show changelog only on installation

fixes Anarios#534

add changelog button in popup
@cyrildtm cyrildtm changed the title Add extension opt-in option to show update popup (Do not merge) Add extension opt-in option to show update popup Apr 25, 2022
@cyrildtm
Copy link
Contributor Author

Added Do Not Merge tag. Reason: Use of extConfig in background script may cause race condition. The service worker is supposed to load or initialize user options, instead of using it.
This is an ongoing discussion. Keep this PR, may be adapted by #537. Cherry pick if convenient. Close when #537 is resolved.

Solve problem Anarios#1:
Anarios#541 (comment)

Use of extConfig in background script may cause race condition. The service worker is supposed to load or initialize user options, instead of using it.

Solve problem Anarios#2:
Anarios#537 (comment)

Rare case # 1: without event listener or install reason check

Extension updates.
User notices opt-in option and switches on. Then closes browser.
User opens youtube or whatever tab that has extension background script called.
User receives an outdated update popup.
rephrase switch text
api is undefined
add scrollbar
add hover fade-in animation
@cyrildtm cyrildtm changed the title (Do not merge) Add extension opt-in option to show update popup Add extension opt-in option to show update popup Apr 26, 2022
@cyrildtm
Copy link
Contributor Author

cyrildtm commented Apr 26, 2022

Basically.... I saw v3.0 popup more than 20 times, just because I've got multiple accounts on multiple computers.

Capture

@Anarios
Copy link
Owner

Anarios commented Apr 27, 2022

3.0.1 is submited to the store for review.

@Anarios
Copy link
Owner

Anarios commented Apr 27, 2022

@cyrildtm, do you use chrome canary?

@cyrildtm
Copy link
Contributor Author

cyrildtm commented Apr 27, 2022

@cyrildtm, do you use chrome canary?

Yes I'm on 103.0.5027.0 for developing this extension.
Now I'm making one more fix. Will explain in a second.

EDIT: If you meant why I've got so many popups, no I'm still on 100, and some of my computers still have 99. I don't update that often and I hate my tabs disappear. With v3.0, every time each computer and each account gets an update, I see a popup.

@cyrildtm
Copy link
Contributor Author

An event listener for onInstalled is still a better solution. Here's an simple experiment:

in background js, add api.tabs.create({url: "about:blank"}); at the top level.

Wait until the service worker goes "inactive"; This can be easily observed when you have chrome://extensions/ open, while reading through this page explaining why service workers get terminated frequently.

Then, open extension settings and flip a switch. You will see a new tab.

Conclusion, background js (or service worker, whatever you call it) gets re-run frequently. It's quite a waste to read options. And why.

An event listener for onInstalled is still a better solution. Here's an simple experiment:

in background js, add api.tabs.create({url: "about:blank"}); at the top level.

Wait until the service worker goes "inactive"; This can be easily observed when you have chrome://extensions/ open, while reading through this page explaining why service workers get terminated frequently.

Then, open extension settings and flip a switch. You will see a new tab.

Conclusion, background js (or service worker, whatever you call it) gets re-run frequently. It's quite a waste to read options. And why.
@cyrildtm
Copy link
Contributor Author

And ....

This version will never get a popup 😃

@Anarios
Copy link
Owner

Anarios commented Apr 27, 2022

And ....

This version will never get a popup 😃

It gets a popup only on install, just as intended for now.

@Anarios
Copy link
Owner

Anarios commented Apr 27, 2022

It's quite a waste to read options.
Is it an expensive operation, though? I thought that it costs almost nothing.

@cyrildtm
Copy link
Contributor Author

It gets a popup only on install, just as intended for now.

I just noticed your words "for now". Okay, but we will need it to actually work in the future right?

it costs almost nothing.

A non-zero cost action is not nothing.
Currently we have seven options and therefore seven async gets to read the options, separately. One can justify "separately" with text clarity and async gets bunched anyway. This little feature causes another two async reads, which is +28%. Do it two million times. Not because we sacrifice efficiency for tidiness, but simply because we can. So yes, it is a waste.

Service worker gets killed and reinstated quite often, it's not like once every browser update. That's my understanding.

@Anarios
Copy link
Owner

Anarios commented Apr 27, 2022

Okay, but we will need it to actually work in the future right?

If there are ever changes big enough that everyone needs to be notified - then yeah. Right now I thought that showing it only on install is sufficient. I wanted to release the fix ASAP to not annoy people with Canary, so I went with the simplest solution of just disabling it.

This little feature causes another two async reads

Can be refactored into a single init function that reads all settings in one go.

Service worker gets killed and reinstated quite often

Every few minutes, if I'm not wrong.

@cyrildtm
Copy link
Contributor Author

cyrildtm commented Apr 27, 2022

Refactoring can solve everything together.
Will do the following when I get back time

  • Step back with this PR
  • Make a new PR to refactor all initialize and handle functions. Make sure to keep text clarity. (I wanted to streamline handle as well since if the other is gone then this looks weird being left behind)
  • Re-prettify popup.html, make it consistent with main website's style. We need a scroll bar for the switches now.

@cyrildtm cyrildtm marked this pull request as draft April 28, 2022 21:37
@cyrildtm
Copy link
Contributor Author

cyrildtm commented May 5, 2022

I just got a popup myself .. browser restart, no updates, extension is already 3.001.
.. and I just got another one, browser restart and update.

Let's fix this bug once for all. The code looks messy but let's hope it catches "most" of the rare cases users are complaining. Please keep the comments in source code to let people in the future know what's going on with this ugly logic.
@cyrildtm
Copy link
Contributor Author

cyrildtm commented May 8, 2022

Let's fix this bug once for all. The code looks messy but let's hope it catches "most" of the rare cases users are complaining.

I went a bit pedantic in the comments in source code. Please keep them to let people in the future know what's going on with this ugly logic.

@sy-b @Anarios Please take a look and comment. Remember people complaining on Github or Chrome Web Store represent ~0.1% of all extension users, who represent ~0.1% of all Youtube users. (I don't use Discord so I have no idea) Let's get over this.

See my bug report #597

@cyrildtm cyrildtm marked this pull request as ready for review May 8, 2022 02:07
cyrildtm added a commit to cyrildtm/return-youtube-dislike that referenced this pull request May 8, 2022
prettify popup

add scrollbar
add hover fade-in animation
cyrildtm added a commit to cyrildtm/return-youtube-dislike that referenced this pull request May 8, 2022
add hover labels for select list label

cherry pick Anarios#541 (prettify popup)

prettify popup

add scrollbar
add hover fade-in animation

Make popup scroll bar consistent with website

use black/red color scheme and half-rounded shape
cyrildtm added 2 commits May 10, 2022 11:29
OnInstalledReason has slightly different content for Firefox and Chrome
More people use Chrome than Firefox. Check for Chrome update first. Reduce global warming.
cyrildtm added 4 commits May 12, 2022 14:13
- really allow popup on install (previously ineffective)
- show debug messages in service worker console
In the bug-resolving case, we need to wait for the second layer of async storage get (for local) to finish before deciding to show the popup.
gergelypap pushed a commit to gergelypap/return-youtube-dislike that referenced this pull request Sep 28, 2023
prettify popup

add scrollbar
add hover fade-in animation
@Anarios
Copy link
Owner

Anarios commented Jun 16, 2024

I believe there were no more complaints on popups, I will be closing this for now.

@Anarios Anarios closed this Jun 16, 2024
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