snapdrop icon indicating copy to clipboard operation
snapdrop copied to clipboard

Add wake-lock

Open Myzel394 opened this issue 3 years ago • 3 comments

closes #412

Myzel394 avatar Feb 20 '22 10:02 Myzel394

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.

Myzel394 avatar Feb 22 '22 15:02 Myzel394

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

Bellisario avatar Feb 22 '22 15:02 Bellisario

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

Myzel394 avatar Mar 08 '22 10:03 Myzel394

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

schlagmichdoch avatar Jan 17 '23 13:01 schlagmichdoch

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

Myzel394 avatar Jan 17 '23 13:01 Myzel394

@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 🦾

schlagmichdoch avatar Jan 18 '23 20:01 schlagmichdoch

@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 avatar Jan 18 '23 20:01 Myzel394

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

Myzel394 avatar Jan 19 '23 16:01 Myzel394