Skip to content

Commit 672a406

Browse files
committed
Merge branch 'release-candidate' into stable
2 parents 9f98163 + d6d3cbe commit 672a406

34 files changed

+474
-74
lines changed

CHANGELOG.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,56 @@
1+
# 121.0.0
2+
3+
In this major release, we added a `scrollViewBounce` property and a `adjustHeightForSafeAreaInsets` property to BottomSheets, added a `shouldAutorotateOverride` property, a `preferredInterfaceOrientationForPresentationOverride` property, a `supportedInterfaceOrientationsOverride` property, and a `modalTransitionStyleOverride` property to MDCAlertController, and converted `progressTintColors` property on MDCProgressView to use light weight generics.
4+
5+
## Breaking changes
6+
7+
### ProgressView
8+
9+
MDCProgressView's property `progressTintColors` started using light weight generics so values pass in need to be typed correctly.
10+
11+
## New features
12+
13+
### BottomSheet
14+
15+
Bottom sheets have new propertie that turn off the overscroll and safe area insets.
16+
17+
### Dialogs
18+
19+
Added a `shouldAutorotateOverride` property, a `preferredInterfaceOrientationForPresentationOverride` property, a `supportedInterfaceOrientationsOverride` property, and a `modalTransitionStyleOverride` property to MDCAlertController.
20+
21+
### ProgressView
22+
23+
Converted `progressTintColors` property on MDCProgressView to use light weight generics.
24+
25+
## Component changes
26+
27+
### BottomSheet
28+
29+
* [Add BOOL property for whether or not the height of the bottom sheet should adjust for safe area insets.](https://github.com/material-components/material-components-ios/commit/1fefeaf03268b9126dfaea00907a9bb5362560e5) (Alyssa Weiss)
30+
* [Add flag that turns off simulated bouncing when there isn't a tracking scroll view](https://github.com/material-components/material-components-ios/commit/1b985100ec89ed142981bd8f3d51b247f88e6f0c) (Andrew Overton)
31+
32+
### Buttons
33+
34+
* [Add documentation for Enums.](https://github.com/material-components/material-components-ios/commit/c727b890df3c0766706ad8000649f7733cdef997) (Cody Weaver)
35+
36+
### Chips
37+
38+
* [Add docs for MDCChipField](https://github.com/material-components/material-components-ios/commit/3f7cc9f51cf9ea9287b3e817bc730eaac31bd87e) (Andrew Overton)
39+
40+
### Dialogs
41+
42+
* [Adding customized interface orientations and transition style support to the alert dialog.](https://github.com/material-components/material-components-ios/commit/a9b6ca12b5cba778176b7cb129e866b8669ac8bc) (Nobody)
43+
44+
### List
45+
46+
* [Use isKindOfClass to ensure there is support for all MDCShadowLayer's subclasses.](https://github.com/material-components/material-components-ios/commit/d5bba14e9a51405ee2ed868fd630d852c49d0c6e) (Yarden Eitan)
47+
48+
### ProgressView
49+
50+
* [Add Objective-C generics to MDCProgressView](https://github.com/material-components/material-components-ios/commit/1b70fd6ad949c143d7225e3719c912fce8181719) (Andrew Overton)
51+
52+
---
53+
154
# 120.0.0
255

356
In this major release, we deleted the `elevationOverlayColor` property from MDCSemanticColorScheme, added a `placeholderColor` property to MDCTextControls, added a `shapedBorderColor` property and a `shapedBorderWidth` property to MDCShapedView, and made multiple bug fixes.

MaterialComponents.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load 'scripts/generated/icons.rb'
22

33
Pod::Spec.new do |mdc|
44
mdc.name = "MaterialComponents"
5-
mdc.version = "120.0.0"
5+
mdc.version = "121.0.0"
66
mdc.authors = "The Material Components authors."
77
mdc.summary = "A collection of stand-alone production-ready UI libraries focused on design details."
88
mdc.homepage = "https://github.com/material-components/material-components-ios"

MaterialComponentsEarlGreyTests.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "MaterialComponentsEarlGreyTests"
3-
s.version = "120.0.0"
3+
s.version = "121.0.0"
44
s.authors = "The Material Components authors."
55
s.summary = "This spec is an aggregate of all the Material Components EarlGrey tests."
66
s.description = "This spec is made for use in the MDC Catalog."

MaterialComponentsExamples.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "MaterialComponentsExamples"
3-
s.version = "120.0.0"
3+
s.version = "121.0.0"
44
s.authors = "The Material Components authors."
55
s.summary = "This spec is an aggregate of all the Material Components examples."
66
s.description = "This spec is made for use in the MDC Catalog. Used in conjunction with CatalogByConvention we create our Material Catalog."

MaterialComponentsSnapshotTests.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ end
5353

5454
Pod::Spec.new do |s|
5555
s.name = "MaterialComponentsSnapshotTests"
56-
s.version = "120.0.0"
56+
s.version = "121.0.0"
5757
s.authors = "The Material Components authors."
5858
s.summary = "This spec is an aggregate of all the Material Components snapshot tests."
5959
s.homepage = "https://github.com/material-components/material-components-ios"

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
120.0.0
1+
121.0.0

catalog/MDCCatalog/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>120.0.0</string>
18+
<string>121.0.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>120.0.0</string>
22+
<string>121.0.0</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>UIAppFonts</key>

catalog/MDCDragons/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>120.0.0</string>
18+
<string>121.0.0</string>
1919
<key>CFBundleVersion</key>
20-
<string>120.0.0</string>
20+
<string>121.0.0</string>
2121
<key>LSRequiresIPhoneOS</key>
2222
<true/>
2323
<key>UILaunchStoryboardName</key>

catalog/MaterialCatalog/MaterialCatalog.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "MaterialCatalog"
3-
s.version = "120.0.0"
3+
s.version = "121.0.0"
44
s.summary = "Helper Objective-C classes for the MDC catalog."
55
s.description = "This spec is made for use in the MDC Catalog."
66
s.homepage = "https://github.com/material-components/material-components-ios"

components/BottomSheet/src/MDCBottomSheetController.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@
121121
*/
122122
@property(nonatomic, assign) MDCShadowElevation elevation;
123123

124+
/**
125+
Whether or not the height of the bottom sheet should adjust to include extra height for any bottom
126+
safe area insets. If, for example, this is set to @c YES, and the preferred content size height is
127+
100 and the screen has a bottom safe area inset of 10, the total height of the displayed bottom
128+
sheet height would be 110. If set to @c NO, the height would be 100.
129+
130+
Defaults to @c YES.
131+
*/
132+
@property(nonatomic, assign) BOOL adjustHeightForSafeAreaInsets;
133+
124134
/**
125135
Bottom sheet controllers must be created with @c initWithContentViewController:.
126136
*/

components/BottomSheet/src/MDCBottomSheetController.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
#import "MDCBottomSheetPresentationController.h"
1919
#import "MDCBottomSheetPresentationControllerDelegate.h"
2020
#import "MDCBottomSheetTransitionController.h"
21+
#import "MDCSheetState.h"
2122
#import "UIViewController+MaterialBottomSheet.h"
23+
#import "MaterialElevation.h"
24+
#import "MaterialShadowElevations.h"
25+
#import "MaterialShapes.h"
2226
#import "MaterialMath.h"
2327

2428
static const CGFloat kElevationSpreadMaskAffordance = 50.0f;
@@ -48,6 +52,7 @@ - (nonnull instancetype)initWithContentViewController:
4852
_transitionController = [[MDCBottomSheetTransitionController alloc] init];
4953
_transitionController.dismissOnBackgroundTap = YES;
5054
_transitionController.dismissOnDraggingDownSheet = YES;
55+
_transitionController.adjustHeightForSafeAreaInsets = YES;
5156
super.transitioningDelegate = _transitionController;
5257
super.modalPresentationStyle = UIModalPresentationCustom;
5358
_shapeGenerators = [NSMutableDictionary dictionary];
@@ -269,6 +274,14 @@ - (UIColor *)scrimColor {
269274
return _transitionController.scrimColor;
270275
}
271276

277+
- (void)setAdjustHeightForSafeAreaInsets:(BOOL)adjustHeightForSafeAreaInsets {
278+
_transitionController.adjustHeightForSafeAreaInsets = adjustHeightForSafeAreaInsets;
279+
}
280+
281+
- (BOOL)adjustHeightForSafeAreaInsets {
282+
return _transitionController.adjustHeightForSafeAreaInsets;
283+
}
284+
272285
- (void)setIsScrimAccessibilityElement:(BOOL)isScrimAccessibilityElement {
273286
_transitionController.isScrimAccessibilityElement = isScrimAccessibilityElement;
274287
}

components/BottomSheet/src/MDCBottomSheetPresentationController.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@
3535
*/
3636
@property(nonatomic, weak, nullable) UIScrollView *trackingScrollView;
3737

38+
/**
39+
When @c trackingScrollView is @c nil and this property is @ YES, the bottom sheet simulates the @c
40+
UIScrollView bouncing effect. When @c trackingScrollView is @c nil and this property is set to @c
41+
NO, the simulated bouncing effect is turned off. When @c trackingScrollView is NOT @c nil, this
42+
property doesn't do anything.
43+
44+
Defaults to @c YES.
45+
*/
46+
@property(nonatomic, assign) BOOL simulateScrollViewBounce;
47+
3848
/**
3949
When set to false, the bottom sheet controller can't be dismissed by tapping outside of sheet area.
4050
*/
@@ -68,6 +78,16 @@
6878
*/
6979
@property(nonatomic, assign) CGFloat preferredSheetHeight;
7080

81+
/**
82+
Whether or not the height of the bottom sheet should adjust to include extra height for any bottom
83+
safe area insets. If, for example, this is set to @c YES, and the preferredSheetHeight is
84+
100 and the screen has a bottom safe area inset of 10, the total height of the displayed bottom
85+
sheet height would be 110. If set to @c NO, the height would be 100.
86+
87+
Defaults to @c YES.
88+
*/
89+
@property(nonatomic, assign) BOOL adjustHeightForSafeAreaInsets;
90+
7191
/**
7292
Customize the color of the background scrim.
7393

components/BottomSheet/src/MDCBottomSheetPresentationController.m

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ @implementation MDCBottomSheetPresentationController {
6868

6969
@synthesize delegate;
7070

71+
- (instancetype)initWithPresentedViewController:(UIViewController *)presentedViewController
72+
presentingViewController:(UIViewController *)presentingViewController {
73+
self = [super initWithPresentedViewController:presentedViewController
74+
presentingViewController:presentingViewController];
75+
if (self) {
76+
_adjustHeightForSafeAreaInsets = YES;
77+
_simulateScrollViewBounce = YES;
78+
}
79+
return self;
80+
}
81+
7182
- (UIView *)presentedView {
7283
return self.sheetView;
7384
}
@@ -122,10 +133,12 @@ - (void)presentationTransitionWillBegin {
122133
}
123134
self.sheetView = [[MDCSheetContainerView alloc] initWithFrame:sheetFrame
124135
contentView:self.presentedViewController.view
125-
scrollView:scrollView];
136+
scrollView:scrollView
137+
simulateScrollViewBounce:self.simulateScrollViewBounce];
126138
self.sheetView.delegate = self;
127139
self.sheetView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
128140
self.sheetView.dismissOnDraggingDownSheet = self.dismissOnDraggingDownSheet;
141+
self.sheetView.adjustHeightForSafeAreaInsets = self.adjustHeightForSafeAreaInsets;
129142

130143
[containerView addSubview:_dimmingView];
131144
[containerView addSubview:self.sheetView];
@@ -301,6 +314,13 @@ - (void)setPreferredSheetHeight:(CGFloat)preferredSheetHeight {
301314
[self updatePreferredSheetHeight];
302315
}
303316

317+
- (void)setAdjustHeightForSafeAreaInsets:(BOOL)adjustHeightForSafeAreaInsets {
318+
_adjustHeightForSafeAreaInsets = adjustHeightForSafeAreaInsets;
319+
if (_sheetView) {
320+
_sheetView.adjustHeightForSafeAreaInsets = adjustHeightForSafeAreaInsets;
321+
}
322+
}
323+
304324
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
305325
[super traitCollectionDidChange:previousTraitCollection];
306326

components/BottomSheet/src/MDCBottomSheetTransitionController.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@
6363
*/
6464
@property(nonatomic, assign) CGFloat preferredSheetHeight;
6565

66+
/**
67+
Whether or not the height of the bottom sheet should adjust to include extra height for any bottom
68+
safe area insets. If, for example, this is set to @c YES, and the preferred content size height is
69+
100 and the screen has a bottom safe area inset of 10, the total height of the displayed bottom
70+
sheet height would be 110. If set to @c NO, the height would be 100.
71+
72+
Defaults to @c YES.
73+
*/
74+
@property(nonatomic, assign) BOOL adjustHeightForSafeAreaInsets;
75+
6676
@end
6777

6878
@interface MDCBottomSheetTransitionController (ScrimAccessibility)

components/BottomSheet/src/MDCBottomSheetTransitionController.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ - (instancetype)init {
4242
self = [super init];
4343
if (self) {
4444
_scrimAccessibilityTraits = UIAccessibilityTraitButton;
45+
_adjustHeightForSafeAreaInsets = YES;
4546
}
4647
return self;
4748
}
@@ -62,6 +63,7 @@ - (instancetype)init {
6263
presentationController.scrimAccessibilityHint = _scrimAccessibilityHint;
6364
presentationController.scrimAccessibilityLabel = _scrimAccessibilityLabel;
6465
presentationController.preferredSheetHeight = _preferredSheetHeight;
66+
presentationController.adjustHeightForSafeAreaInsets = _adjustHeightForSafeAreaInsets;
6567
_currentPresentationController = presentationController;
6668
return presentationController;
6769
}
@@ -170,6 +172,11 @@ - (UIColor *)scrimColor {
170172
return _scrimColor;
171173
}
172174

175+
- (void)setAdjustHeightForSafeAreaInsets:(BOOL)adjustHeightForSafeAreaInsets {
176+
_adjustHeightForSafeAreaInsets = adjustHeightForSafeAreaInsets;
177+
_currentPresentationController.adjustHeightForSafeAreaInsets = adjustHeightForSafeAreaInsets;
178+
}
179+
173180
- (void)setIsScrimAccessibilityElement:(BOOL)isScrimAccessibilityElement {
174181
_isScrimAccessibilityElement = isScrimAccessibilityElement;
175182
_currentPresentationController.isScrimAccessibilityElement = isScrimAccessibilityElement;

components/BottomSheet/src/private/MDCDraggableView.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
*/
2424
@property(nonatomic, strong, readonly, nullable) UIScrollView *scrollView;
2525

26+
/**
27+
When @c scrollView is @c nil , the draggable view simulates the @c UIScrollView bouncing effect.
28+
When this property is set to @c NO, the simulated bouncing effect is turned off. When @c
29+
scrollView is not @c nil, this property doesn't do anything.
30+
*/
31+
@property(nonatomic, assign) BOOL simulateScrollViewBounce;
32+
2633
/**
2734
* Delegate for handling drag events.
2835
*/

components/BottomSheet/src/private/MDCDraggableView.m

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#import "MDCDraggableView.h"
1616

1717
#import "MDCDraggableViewDelegate.h"
18+
#import "MDCKeyboardWatcher.h"
1819

1920
static void CancelGestureRecognizer(UIGestureRecognizer *gesture) {
2021
if (gesture.enabled) {
@@ -28,6 +29,7 @@ static void CancelGestureRecognizer(UIGestureRecognizer *gesture) {
2829
@interface MDCDraggableView () <UIGestureRecognizerDelegate>
2930
@property(nonatomic) UIPanGestureRecognizer *dragRecognizer;
3031
@property(nonatomic, strong) UIScrollView *scrollView;
32+
@property(nonatomic, assign) CGFloat mostRecentMinY;
3133
@end
3234

3335
@implementation MDCDraggableView
@@ -50,30 +52,39 @@ - (instancetype)initWithFrame:(CGRect)frame scrollView:(UIScrollView *)scrollVie
5052
#pragma mark - Gesture handling
5153

5254
- (void)didPan:(UIPanGestureRecognizer *)recognizer {
53-
CGPoint point = [recognizer translationInView:self.superview];
54-
55-
// Ensure that dragging the sheet past the maximum height results in an exponential decay on the
56-
// translation. This gives the same effect as when you overscroll a scrollview.
57-
CGFloat newHeight = CGRectGetMaxY(self.superview.bounds) - CGRectGetMinY(self.frame);
58-
if (newHeight > [self.delegate maximumHeightForDraggableView:self]) {
59-
point.y -= point.y / (CGFloat)1.2;
55+
if (recognizer.state == UIGestureRecognizerStateBegan) {
56+
self.mostRecentMinY = CGRectGetMinY(self.frame);
57+
[self.delegate draggableViewBeganDragging:self];
58+
return;
6059
}
6160

62-
self.center = CGPointMake(self.center.x, self.center.y + point.y);
63-
[recognizer setTranslation:CGPointZero inView:self.superview];
64-
6561
CGPoint velocity = [recognizer velocityInView:self.superview];
6662
velocity.x = 0;
63+
CGPoint translation = [recognizer translationInView:self.superview];
64+
CGFloat maxHeight = [self.delegate maximumHeightForDraggableView:self];
65+
CGFloat minimumStableMinY = CGRectGetHeight(self.superview.bounds) - maxHeight -
66+
[MDCKeyboardWatcher sharedKeyboardWatcher].visibleKeyboardHeight;
67+
CGFloat newMinY = self.mostRecentMinY + translation.y;
68+
69+
if (newMinY < minimumStableMinY) {
70+
if ((self.scrollView == nil) && !self.simulateScrollViewBounce) {
71+
velocity = CGPointZero;
72+
newMinY = minimumStableMinY;
73+
} else {
74+
// Ensure that dragging the sheet past the maximum height results in an exponential decay on
75+
// the translation. This gives the same effect as when you overscroll a scrollview.
76+
newMinY = minimumStableMinY + (translation.y - (translation.y / 1.2f));
77+
}
78+
}
79+
CGRect newFrame = CGRectMake(CGRectGetMinX(self.frame), newMinY, CGRectGetWidth(self.frame),
80+
CGRectGetHeight(self.frame));
6781

68-
if (recognizer.state == UIGestureRecognizerStateBegan) {
69-
[self.delegate draggableViewBeganDragging:self];
82+
if (recognizer.state == UIGestureRecognizerStateChanged) {
83+
self.frame = newFrame;
84+
[self.delegate draggableView:self didPanToOffset:CGRectGetMinY(self.frame)];
7085
} else if (recognizer.state == UIGestureRecognizerStateEnded) {
7186
[self.delegate draggableView:self draggingEndedWithVelocity:velocity];
7287
}
73-
if (recognizer.state == UIGestureRecognizerStateBegan ||
74-
recognizer.state == UIGestureRecognizerStateChanged) {
75-
[self.delegate draggableView:self didPanToOffset:CGRectGetMinY(self.frame)];
76-
}
7788
}
7889

7990
#pragma mark - UIGestureRecognizerDelegate

0 commit comments

Comments
 (0)