-
Notifications
You must be signed in to change notification settings - Fork 380
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
Wakelock API iOS 16.4 browser mode vs Add to home screen mode #156
Comments
When I saw Safari upgrading to support Wakelock I was like 'AT LAST'. And then I saw it doesn't work in PWA at all, and on top of that it breaks the current NoSleep workaround so my app just broke for people overnight. That is just stupid. Thanks for letting the Safari team know! |
@pelord - this will disable the Wake Lock for both - in-browser and apps pinned to home screen, right? You could test against this as well to target just the PWAs:
|
You're right. In my specific use case, my users are strongly encouraged to "Install" the app... but, I will try it soon. Thanks for the hint.. |
I’m having the same issue, in-browser app works but as soon as I install it on my device, the wake lock is not acquired anymore. Any chance to incorporate the fix a new revision of the library? I know it’s not nice but if the native functionality is broken in PWA mode, we cannot rely on that. |
Still not fixed in iOS 17 |
Anything we can do to overcome the issue at least temporarily? |
The fix provided by @pelord works perfectly, so I would suggest to use it. When IOS will have a fix, then we will need to chance the regex to only match the bugged versions |
OK but that’s requiring a change in the library, isn’t it? I mean, I’ve to insert nosleep as code instead of installing it via yarn and apply this change on the nosleep code right? |
I think https://github.com/Uriopass/NoSleep.js is the most active/working for for this repo. Maybe we can submit a PR to that repo to add the fix of pelord. For Android this repository works fine on most browsers, but iOS seems to be a pain in the 🍰 ... |
I forked this repository and included the above fix (with @z-x's modification): https://github.com/zakj/no-sleep It's published on npm as |
Well done, I’m going to switch to your library immediately.I see you even implemented a check to use the old-fashioned way only in the installed PWA, so on a regular browser it should use the native api right?On 13 Oct 2023, at 07:41, Zak Johnson ***@***.***> wrote:
I forked this repository and included the above fix (with @z-x's modification): https://github.com/zakj/no-sleep
It's published on npm as @zakj/no-sleep. I couldn't resist some refactoring so buyer beware, but it's working for me.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
Hey thanks for the improvement in the lib. So this should fix the issue with browsers in IOs 16 ? or I misunderstood? |
Yep, it's working for me. |
Expected Behavior
NoSleep is suposed to handle iOS 16.4
Actual Behavior
When using the Wake Lock API, on Safari, in a browser mode, the Wake Lock API work properly.
On the same website, opened after have done "Add to home screen", the Wake Lock API don't work properly. The Wake Lock API seem to not be able to be acquired.
An issue has been reported to WebKit https://bugs.webkit.org/show_bug.cgi?id=205104
How Do We Reproduce?
Here the test page: https://pelord.github.io/wakeLockApiAddHomeScreen/
To test the Wake Lock API, you have to toggle the ZZZ button.
Unchecked ZZZ = Wake Lock API released
Checked ZZZ = Wake Lock API acquired
I'll try do propose a PR soon.
The text was updated successfully, but these errors were encountered: