infinitered / infinitered/rmq

Include childModalViewControllers when checking rmq.app.current_view_controller

Open
#314 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
305
Forks
51
PR merge metrics
No merged PRs in 30d

Description

I know the topic of detecting the _current_ view controller is a hairy one (I had my fair share of it).
But would it be possible to extend `rmq.app.current_view_controller` and in that respect `rmq.view_controller` to check and respect if a view has an active `childModalViewController`?

As it is right it's not possible to use `presentViewController` with any of both methods _if a there is currently a modal view controller on screen_.

I know it sounds strange but one real world use case would be displaying a `UIAlertController` from a modal view. I came across this while debugging a missing alert box from RedAlert.
Turns out `rmq.view_controller` is the culprit as it doesn't traverse down my modal VC resulting in an error like this:

```
Warning: Attempt to present on whose view is not in the window hierarchy!
```

`StartScreen` in this case is the VC below my current modal screen.
There's currently an [open issue](https://github.com/GantMan/RedAlert/issues/22) on this for RedAlert but IMHO the real fix belongs in RMQ.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the implementations of rmq.app.current_view_controller and rmq.view_controller, then reproduce the modal-view case described in the issue with a UIAlertController. Done means both methods account for an active childModalViewController so presenting from the modal view no longer targets StartScreen below it.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.