iOS-SOCKS-Server icon indicating copy to clipboard operation
iOS-SOCKS-Server copied to clipboard

Add pseudo-fullscreen mode for OLED displays

Open mihir-io opened this issue 3 years ago • 5 comments

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:

  • When the side pane that has the full screen button is open, as stuff is printed out in the console, the focus will shift over to the console. Once you enter full screen mode, this isn't an issue.
    • Changing logging from DEBUG to ERROR 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.
  • When charging, the battery icon in the top-right will still show. If the phone is horizontal, or if the phone isn't charging, it won't appear.
  • The home bar at the bottom still appears. As a workaround, you can enable "Guided Access" mode.
    • This hides the home bar but prevents you from exiting the app until you triple-click the power button again to disable it.

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 photo_2021-12-26_13-17-50

The fullscreen view in portrait mode while charging photo_2021-12-26_13-18-02

Tested on iPhone 7 and 13 Pro.

mihir-io avatar Dec 26 '21 18:12 mihir-io

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

regulad avatar Sep 16 '24 22:09 regulad

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.

regulad avatar Sep 16 '24 22:09 regulad

Didn't want to clobber your PR or steal your thunder. Feel free force push your branch to mine!

regulad avatar Sep 16 '24 22:09 regulad

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

mihir-io avatar Sep 19 '24 20:09 mihir-io

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

regulad avatar Sep 20 '24 14:09 regulad