### Context
In working on #5296 I noticed a lot of the test had repeated code that can be pulled into a `setup` function. Additionally some of the test were missing _Given_, _When_, and _Then_ statements so those were added. This change hopefully makes this code more readable to future maintainers. I also noticed some of the test had extra work in the _Given_ that wasn't necessary so I removed that.
### The problem
Repeated steps in the _Given_ section of the test
### The fix
Implement the `setup` and `teardown` functions as well as add missing _Given_, _When_, and _Then_ comments.
### Related bugs
This isn't related to any bugs this is just something that I saw that could be improved.
Adding semantic emphasis to Dialog actions which allows conditional theming of buttons. The MDCDailogScheme now has a button scheme which can be used to theme buttons according to their action's assigned emphasis.
Issue: b/117608629
Design Review document (go/gmdc-ios-dialogs-design-doc).
### Context
In working on #5296 and #5301 I used `CGFloat` instead of `MDCShadowElevation`. We have the `MDCShadowElevation` data type strictly for this exact use case and I missed that. This goes back and fixes those changes to match all other components. This shouldn't cause any changes in behavior but screenshots are added to make sure. Clients should be unaffected by this change even if they were using a custom elevation.
```objc
dialog.elevation = 2;
```
Will work the same as before.
### The problem
MDCAlertController (and all related classes) used `CGFloat` instead of `MDCShadowElevation`.
### The fix
Replace `MDCShadowElevation` with `CGFloat`.
| Before | After |
| - | - |
|||
Switching MDCAlertController buttons from MDCFlatButton, which is being deprecated, to MDCButton.
Issue: b/117543195
TAP test: CL/217698229
Also see: #4739
Adding scrimColor property to MDCAlertController, which controls the background color when the alert is presented by a MDCDialogPresentationController.
Issues: b/116845327, b/117173678.
Context
We recently added an API for a DialogThemer but we are yet to update the README.
The problem
We are missing docs for the new API
The fix
Update the readme to have the new themer API
Related issues
b/116306933
### Context
I believe the scrim color didn't match what the value should be, possibly design changed this value and we didn't get that updated. I noticed this when trying to theme the scrim color with the color themer.
### The problem
The scrim color doesn't match internal document
### The fix
Update the value to desired default scrim color
### Screenshot
| Before | After |
| - | - |
|||
I can't see a difference in the screenshots I think it's because the values are so close.
### Context
We recently added an `elevation` property to MDCAlertController.
### The problem
The alertScheme didn't set the elevation if an MDCAlertController was themed.
### The fix
This applies the elevation a client sets to their scheme to the AlertController, if no elevation is set then it defaults to the MDCShadowElevationDialog value which is 24dp.
### Related PR
This is the PR that added the elevation property.
#5296
### Related bug
b/117168419
Adding the API to customize the color of MDCAlertController's background scrim, and to apply the color during theming. Also includes tests & an example.
Issue: #5279
Issue: b/116845327
Updating AlertController API to customize the tintColor of the alert's titleIcon. Includes tests and examples.
issue: #5174
issue: Update MDC API to customize MDCAlertController title🐛
Adding a title icon property to MDCAlertController.
The title icon is an image that is shown above the dialog title, and is automatically aligned with the title, supporting all NSTextAlignment alignment options (center, natural, left, right, etc).
Includes tests and examples using the new property.
Issue: #5174
Issue: Update MDC API to customize MDCAlertController title🐛
Exposing a corner radius property on MDCAlertController.
Setting the Alert's corner radius updates its view's corner radius, as well as propagate the radius to the presentation controller so it can correctly render the tracking/shadow layer.
Issue: #4964
Issue: b/113257098
Revert "[Dialogs] Remove use of MDCFlatButton for MDCButton and MDCTextButtonThemer (#4739)"
This reverts commit 84d5dfbb83d0118ff26921318df8cc549d919809.
This commit resulted in undesired behavior for a client, this change reverts to the old desired behavior.
Removes the need to copy-paste stanzas from other files anymore as we'll rely on #4478 to generate the correct stanza for us instead.
This was an automated change generated by running a find-and-replace regular expression:
```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at
http://www\.apache\.org/licenses/LICENSE-2\.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```
```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at
http://www\.apache\.org/licenses/LICENSE-2\.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```
```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at
http://www\.apache\.org/licenses/LICENSE-2\.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```
```
// Copyright $1-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
Removes the need to copy-paste stanzas from other files anymore as we'll rely on https://github.com/material-components/material-components-ios/pull/4478 to generate the correct stanza for us instead.
This was an automated change generated by running a find-and-replace regular expression:
### Find
```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at
http://www\.apache\.org/licenses/LICENSE-2\.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```
```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at
http://www\.apache\.org/licenses/LICENSE-2\.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```
### Replace
```
// Copyright $1-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
To improve support for UI testing, `accessibilityIdentifier` values
should be attached to the action buttons of MDCAlertController views.
Instead of exposing the views and the buttons, an
`accessibilityIdentifier` property can be assigned to the MDCAlertAction
directly using the UIAccessibilityIdentification protocol.
Closes#4916
We can now make use of @available throughout our codebase.
We support Xcode 9 and up, which includes the iOS 11 SDK. This means we can remove any guards for SDKs prior to iOS 11.
This was cleaned up by running a global find-and-replace with the following regular expression:
```
Find:#if defined\(__IPHONE_11_0\) && \(__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0\)\n(.+if \(@available\(iOS 11.0, \*\)\) \{(?:.|\n)*?)(?:#else(?:.|\n)*?)?\n#endif
Replace:$1
```
With some additional cleanup for stragglers that didn't match this pattern. Note that else clauses were intentionally dropped.
Closes https://github.com/material-components/material-components-ios/issues/4909
Many of our Swift examples are either missing imports or are importing all of
MaterialComponents. Both of these will cause failures during internal builds.
This change further formalizes our pattern of annotating APIs that will be or are deprecated using class categories. Moving an API into such a category has the benefit of being picked up by the API diff toolchain and elevated into our release notes as a result.
Remove all instances of MDCFlatButton within [Dialogs] component
Replace with MDCTextButtonThemer and MDCButton
MDCFlatButton is the old API and MDCTextButtonThemer/MDCButton are the modern APIs.
Closes#3914
Update buttons within Dialog to have a minimum 48x48 touch area.
Also, update example to make sure in an case where there is a large number of buttons, make sure that their is enough room in the scroll view.
Closes#3664
As part of our readme generator, components can now opt in to displaying badges in their readme.
The badges are generated from https://shields.io/ and are focused on an individual component. We're currently generating the following badges:
- Open bug count.
* Setting Properties on Alert controller will not force the view to load.
* Changed to the old approach on how to handle custom view and setting its properties.
* alertview check for alert title was missing.
* Unit tests Added.
https://github.com/material-components/material-components-ios/pull/4238