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 wake-lock #413

Closed
wants to merge 4 commits into from
Closed

Add wake-lock #413

wants to merge 4 commits into from

Conversation

Myzel394
Copy link

closes #412

Copy link
Contributor

@Bellisario Bellisario left a comment

Choose a reason for hiding this comment

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

Very good work, but I think nosleep.min.js file should be added to the service worker, so the browser doesn't need to fetch it every time Snapdrop loads.

@Myzel394
Copy link
Author

Afaik the service worker is in a different thread than the webpage. So if we would add it, it would stop the service worker's thread from going to sleep and not the webpage's one. But I'm not sure, correct me if I'm wrong.

@Bellisario
Copy link
Contributor

Bellisario commented Feb 22, 2022

Afaik the service worker is in a different thread than the webpage. So if we would add it, it would stop the service worker's thread from going to sleep and not the webpage's one. But I'm not sure, correct me if I'm wrong.

Sorry about my bad explain.
I intended that the service worker, actually, is caching about all resources of the page (like all scripts, see code below) after the first load (and, so, service work install), in this way, when you load Snapdrop, it loads from a local saved (and cached) resource that permits a faster page load.
I just was suggesting to add also this resource, too, so, the user can experience a faster Snapdrop.

P.S.: to explain me more, let me saying this... I didn't intended to add the script into the service worker but just add it's file entry, as other files below. I don't know if I'm explaining...

https://github.com/RobinLinus/snapdrop/blob/bd3d13d48a754121b53aa91034579466937ff2e3/client/service-worker.js#L1-L12

Copy link
Contributor

@Bellisario Bellisario left a comment

Choose a reason for hiding this comment

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

Good job @Myzel394, now it's perfect!

@RobinLinus, could you approve these changes? Thanks!

@Myzel394
Copy link
Author

Myzel394 commented Mar 8, 2022

@RobinLinus Could you take a look at this PR please?

@schlagmichdoch
Copy link
Contributor

Have you tested your code? It does not work for me. The Documentation reads:

This function call must be wrapped in a user input event handler e.g. a mouse or touch handler

I guess you would have to call it on click / touch events. That would mean, only the sending part could successfully enable this with the current implementation. I plan to change this with #560

@Myzel394
Copy link
Author

@schlagmichdoch If I remember correctly it worked for me on Android using Firefox, Brave and Chrome

@schlagmichdoch
Copy link
Contributor

@Myzel394 I tested on iOS only, but nice that it works on Android!
After putting it in a click handler it is now working on iOS as well 🦾

@Myzel394
Copy link
Author

@schlagmichdoch yes iOS is always a pain in the ass. Could you show how you added the click handler? I'm personally not going to spend any time on Apple. Wenn du anders denkst, na dann schlag mich doch :D

@Myzel394
Copy link
Author

Very good, seems like @RobinLinus isn't maintaining this project anymore, so I'd suggest to move over to your implementation instead.

@Myzel394 Myzel394 closed this Jan 19, 2023
@SnapDrop SnapDrop deleted a comment from schlagmichdoch Feb 17, 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.

Implement wake lock?
3 participants