inseven / opolua

A compiled-OPL interpreter for iOS written in Lua
https://opolua.org
MIT License
12 stars 0 forks source link

Can't interact with the top half of the device screen in landscape #206

Closed jbmorley closed 2 years ago

jbmorley commented 2 years ago

It seems like the navigation bar hit area is sometimes (?) extending below the bottom of the navigation bar and intercepting touches sent to the top portion of the device screen when in landscape. This is easiest to reproduce when tapping into a program when the device is already in landscape.

@tomsci captured this screenshot in the UI debugger:

image

(Thanks to Signal for the high quality rendition.)

jbmorley commented 2 years ago

I've spent a bunch of time clicking around in the simulator and I can only seem to repro this iff I launch a program immediately from the 'All Programs' view. If I navigate to a different view (pop to library, drill down), I don't see the issue [ever?] again. Interestingly, it doesn't seem to be dependent on orientation of the program view controller when it's launched (it'll always be wrong in landscape if you immediately run a program from 'All Programs'), and it doesn't occur if you do 'All Programs' -> 'Library' -> 'All Programs' -> Program 🤦🏻‍♂️.

jbmorley commented 2 years ago

On a hunch (the height of this ghost bar is exactly the same as a navigation bar + search field), I removed the search controller from 'All Programs' and everything works perfectly. Of course we no longer have search. Investigating, ...

jbmorley commented 2 years ago

OK. So there's something very weird going on here. The issue seems to occur when AllProgramsViewController appears with the search bar visible. That only seems to happen the first time the All Programs view is loaded. I'm pretty sure the search field is never meant to work that way so there's a bug here, or I've not twiddled some setting I need to twiddle. I had a theory that this was occurring because the search controller was being set while the collection view was empty (perhaps some weird interaction with the new UICollectionViewDiffableDataSource), so I deferred the search controller assignment until after a first non-empty load of the collection view contents--that works perfectly ensuring the search bar doesn't appear, and the ProgramViewController then doesn't exhibit this behaviour, but navigating back to 'All Programs' then causes the search bar to magically appear and we're back where we started. 🤦🏻‍♂️

jbmorley commented 2 years ago

More. It seems like this is down to the lifecycle of the UISplitViewController (of course it is 😮‍💨). For some reason, the same code run during initial setup isn't behaving the same way as it is later when switching sections.

jbmorley commented 2 years ago

Well this is an utter trash fire. 🗑🔥

jbmorley commented 2 years ago

I've refactored a bunch of things to allow us to better manage the lifecycle of the split view, but I can't seem to find any point in the lifecycle to the the initial setup (expect after the view is visible) that leaves us with a working toolbar. Given that, I'm leaning towards removing search from v1.

jbmorley commented 2 years ago

Fixed in 5e63172fc999b616cf26271c5a8a14e08898f0a5 (by removing search from the app).