My app has three states:
- A) connected to server
- B) connected to wifi, but no internet
- C) no connection
The first state is the default mode of operation of the app, and the other two (B & C) are presented as modal view controllers. On various reachability changes, the correct modal view should appear.
Unfortunately, in certain cases B & C both attempt to be presented at the same time, or B is currently presented and may be a millisecond away from closing, but C is already trying to show itself.
My hack of a solution is to basically create a semaphore with some delegates for each modal view- when a modal view opens, it sends a message via the delegate to go to the main view to turn a flag on. Then when the second modal view tries to open, it sees the first is on and waits until it is off. That seems like a ridiculous hack for me trying to make a very basic state machine.
Any thoughts?