Closed prompteus closed 6 years ago
What's 'enableSleepAwake'?
And if you want to add something to the readme, please feel free to submit a PR.
My mistake, I've used bad method name here, so I updated the issue. I meant allowSleepAgain.
Yeah, I thought that order would be pretty obvious. But the plugin could perhaps harden against 'bad' usage patterns.
Which platforms do you see this crash on?
Feel free to submit a PR if you think a mention is required.
I use react - CRA + cordova. I have settings whether to keep the screen on, but the settings affects only one particular view, app should allow screen sleep elsewhere. So when the view enters the screen, it checks the settings and conditionally calls keepsAwake accordingly. When the view leaves the screen, it calls allowSleepAgain without checking whether keepAwake was called or not. I expected that nothing would happen if called "pointlessly", same as setting for example a flag on android pointlessly doesn't throw.
I will submit a PR when I get to it.
Exactly, that's what I meant with "the plugin could perhaps harden against 'bad' usage patterns". Happy to merge your PR!
Thanks. I've just requested it.
Perfect, that'll do for now.
According to my experience (ios devices) allowSleepAgain causes app crash if keepAwake wasn't called in advance. I do not think this behaviour has to change, but I think it should be mentioned in Readme.