Skip to content

Commit

Permalink
Expose some API in snackbar public header
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 598975602
  • Loading branch information
Nobody authored and material-automation committed Jan 16, 2024
1 parent 8a2b62a commit 06c1448
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
23 changes: 23 additions & 0 deletions components/Snackbar/src/MDCSnackbarMessageView.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@
#import "MaterialElevation.h"
#import "MaterialShadowElevations.h"

@class MDCSnackbarManager;
@class MDCSnackbarMessage;
@class MDCSnackbarMessageAction;

/**
Called by the Snackbar message view when the user interacts with the Snackbar view.
@c userInitiated indicates whether or not the handler is being called due to direct user
interaction. @c action, if non-nil, indicates that the user chose to execute a specific action.
*/
typedef void (^MDCSnackbarMessageDismissHandler)(BOOL userInitiated,
MDCSnackbarMessageAction *_Nullable action);

// TODO(b/238930139): Remove usage of this deprecated API.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
Expand Down Expand Up @@ -133,6 +146,16 @@
*/
@property(nonatomic, assign) BOOL enableDismissalAccessibilityAffordance;

/**
Creates a Snackbar view to display @c message.
The view will call @c handler when the user has interacted with the Snackbar view in such a way
that it needs to be dismissed prior to its timer-based dismissal time.
*/
- (_Nonnull instancetype)initWithMessage:(MDCSnackbarMessage *_Nullable)message
dismissHandler:(MDCSnackbarMessageDismissHandler _Nullable)handler
snackbarManager:(MDCSnackbarManager *_Nonnull)manager;

/**
Returns the button title color for a particular control state.
Expand Down
21 changes: 0 additions & 21 deletions components/Snackbar/src/private/MDCSnackbarMessageViewInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,8 @@

#import "../MDCSnackbarMessageView.h"

@class MDCSnackbarManager;
@class MDCSnackbarMessage;
@class MDCSnackbarMessageAction;

/**
Called by the Snackbar message view when the user interacts with the Snackbar view.
@c userInitiated indicates whether or not the handler is being called due to direct user
interaction. @c action, if non-nil, indicates that the user chose to execute a specific action.
*/
typedef void (^MDCSnackbarMessageDismissHandler)(BOOL userInitiated,
MDCSnackbarMessageAction *_Nullable action);

@interface MDCSnackbarMessageView ()

/**
Expand Down Expand Up @@ -54,16 +43,6 @@ typedef void (^MDCSnackbarMessageDismissHandler)(BOOL userInitiated,
*/
@property(nonatomic) BOOL anchoredToScreenBottom;

/**
Creates a Snackbar view to display @c message.
The view will call @c handler when the user has interacted with the Snackbar view in such a way
that it needs to be dismissed prior to its timer-based dismissal time.
*/
- (_Nonnull instancetype)initWithMessage:(MDCSnackbarMessage *_Nullable)message
dismissHandler:(MDCSnackbarMessageDismissHandler _Nullable)handler
snackbarManager:(MDCSnackbarManager *_Nonnull)manager;

/**
Dismisses the message view.
Expand Down

0 comments on commit 06c1448

Please sign in to comment.