AlertController

An Alert is a dialog that presents users with information or collects
information from the user using inputs. An alert appears on top
of the app's content, and must be manually dismissed by the user before
they can resume interaction with the app. It can also optionally have a
title, subTitle and message.

You can pass all of the alert's options in the first argument of
the create method: create(opts). Otherwise the alert's instance
has methods to add options, such as setTitle() or addButton().

Alert Buttons

In the array of buttons, each button includes properties for its text,
and optionally a handler. If a handler returns false then the alert
will not automatically be dismissed when the button is clicked. All
buttons will show up in the order they have been added to the buttons
array, from left to right. Note: The right most button (the last one in
the array) is the main button.

Optionally, a role property can be added to a button, such as cancel.
If a cancel role is on one of the buttons, then if the alert is
dismissed by tapping the backdrop, then it will fire the handler from
the button with a cancel role.

Alert Inputs

Alerts can also include several different inputs whose data can be passed
back to the app. Inputs can be used as a simple way to prompt users for
information. Radios, checkboxes and text inputs are all accepted, but they
cannot be mixed. For example, an alert could have all radio button inputs,
or all checkbox inputs, but the same alert cannot mix radio and checkbox
inputs. Do note however, different types of "text"" inputs can be mixed,
such as url, email, text, etc. If you require a complex form UI
which doesn't fit within the guidelines of an alert then we recommend
building the form within a modal instead.

Dismissing And Async Navigation

After an alert has been dismissed, the app may need to also transition
to another page depending on the handler's logic. However, because multiple
transitions were fired at roughly the same time, it's difficult for the
nav controller to cleanly animate multiple transitions that may
have been kicked off asynchronously. This is further described in the
Nav Transition Promises section. For alerts,
this means it's best to wait for the alert to finish its transition
out before starting a new transition on the same nav controller.

In the example below, after the alert button has been clicked, its handler
waits on async operation to complete, then it uses pop to navigate
back a page in the same stack. The potential problem is that the async operation
may have been completed before the alert has even finished its transition
out. In this case, it's best to ensure the alert has finished its transition
out first, then start the next transition.

It's important to note that the handler returns false. A feature of
button handlers is that they automatically dismiss the alert when their button
was clicked, however, we'll need more control regarding the transition. Because
the handler returns false, then the alert does not automatically dismiss
itself. Instead, you now have complete control of when the alert has finished
transitioning, and the ability to wait for the alert to finish transitioning
out before starting a new transition.