Skip to content

Commit

Permalink
Add option to use legacy auto-dismissal behavior
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 597555199
  • Loading branch information
Janette James authored and material-automation committed Jan 11, 2024
1 parent ad97f59 commit 7c9f210
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/Snackbar/src/MDCSnackbarMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ extern NSString *__nonnull const MDCSnackbarMessageBoldAttributeName;
*/
@property(nonatomic) BOOL automaticallyDismisses;

/**
Allows the snackbar to auto-dismiss even if it has an action. Default is NO.
This property has no effect on snackbars without an action. Using the legacy behavior for snackbars
with an action is not GAR-compliant (go/GAR-mobile#timeout).
*/
@property(nonatomic) BOOL usesLegacyDismissalBehavior;

/**
MDCSnackbarManager.defaultManager will display the snackbar message in this view.
Expand Down
1 change: 1 addition & 0 deletions components/Snackbar/src/MDCSnackbarMessage.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ - (instancetype)copyWithZone:(__unused NSZone *)zone {
copy.automaticallyDismisses = self.automaticallyDismisses;
copy.presentationHostViewOverride = self.presentationHostViewOverride;
copy.shouldDismissOnOverlayTap = self.shouldDismissOnOverlayTap;
copy.usesLegacyDismissalBehavior = self.usesLegacyDismissalBehavior;

// Unfortunately there's not really a concept of 'copying' a block (in the same way you would copy
// a string, for example). A block's pointer is immutable once it is created and copied to the
Expand Down

0 comments on commit 7c9f210

Please sign in to comment.