-
Notifications
You must be signed in to change notification settings - Fork 35
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 pseudo-fullscreen mode for OLED displays #9
base: master
Are you sure you want to change the base?
Conversation
Helps reduce battery drain and burn-in
fs_view = ui.View() | ||
fs_view.name = "Full screen" | ||
fs_view.background_color = 'black' | ||
fs_view.present(style='popover', hide_title_bar=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also the option of adding orientations=['landscape']
as a parameter of fs_view.present()
to force landscape mode, so that it always hides the battery indicator even while charging. Kinda hacky, but I've tested it and it does work.
I looked into playing a silent audio file for my use-case, but this seems a far more robust way to keep the app running. LGTM |
I rebased these changes against the latest branch and added the landscape fix in my branch here: https://github.com/regulad/iOS-SOCKS-Server/tree/feature/fullscreen I also applied Black since you had some single quoted strings. |
Didn't want to clobber your PR or steal your thunder. Feel free force push your branch to mine! |
@regulad I won't have access to my usual machine with Git for a few days. If you want to, feel free to go ahead and force push the branch -- I'm not worried about credit or anything. Otherwise I'll try to get to it sometime next week. |
I don't have write access. I'll just open a new PR. |
This PR addresses issue #8 and adds a popover pane that can essentially 'black out' the display, which for OLED-based iPhones means that the screen doesn't emit any light, and therefore saves battery life.
The way it works is to add a separate pane adjacent to the console window that has a single button to enable full-screen mode. Clicking that button will add a sub-view that opens the popover to black out the screen. By swiping down on the popover, you can close the popover and exit the pseudo-fullscreen mode while keeping the proxy server running. To enter full screen again, simply click the button from the side pane.
There are a couple caveats with this approach, that I'm planning to look into more for the future:
DEBUG
toERROR
can reduce the rate that it changes focus over. And is probably very slightly better for performance/battery life anyways, if you don't need it to log every connection/request.I think if I switched to the Scene library instead of the UI one, it might be possible to remove the battery charging icon in portrait mode. The home bar is probably there to stay outside of using guided access mode.
Photos:
The side pane with the "enter full screen" button, adjacent to the console
The fullscreen view in portrait mode while charging
Tested on iPhone 7 and 13 Pro.