blob: 6fe535bd12fe5808364ad3ea2987cbd9280f7bd1 [file] [log] [blame]
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_ALERT_VIEW_UI_BUNDLED_ALERT_CONSUMER_H_
#define IOS_CHROME_BROWSER_ALERT_VIEW_UI_BUNDLED_ALERT_CONSUMER_H_
#import <Foundation/Foundation.h>
@class AlertAction;
@class TextFieldConfiguration;
// AlertConsumer defines methods to set the contents of an alert.
@protocol AlertConsumer <NSObject>
// Sets the title of the alert.
- (void)setTitle:(NSString*)title;
// Sets the message of the alert.
- (void)setMessage:(NSString*)message;
// Sets the text field configurations for this alert. One text field will be
// created for each `TextFieldConfiguration`.
- (void)setTextFieldConfigurations:
(NSArray<TextFieldConfiguration*>*)textFieldConfigurations;
// Sets the name of the Lottie light-mode `imageLottieName` and
// `imageDarkModeLottieName` for this alert.
- (void)setImageLottieName:(NSString*)imageLottieName
darkModeLottieName:(NSString*)imageDarkModeLottieName;
// Sets the actions for this alert. The double array of actions would be
// represented visually with each sub-array being a row of buttons, unless the
// sum of the button text widths cannot fit into a single row.
- (void)setActions:(NSArray<NSArray<AlertAction*>*>*)actions;
// Sets the accessibility identifier for the alert view.
- (void)setAlertAccessibilityIdentifier:(NSString*)identifier;
// Sets whether the activity indicator should be visible in the alert view.
- (void)setShouldShowActivityIndicator:(BOOL)shouldShowActivityIndicator;
// Sets whether the action buttons should initially be disabled.
- (void)setActionButtonsAreInitiallyDisabled:
(BOOL)actionButtonsAreInitiallyDisabled;
// Define the possible states for the progress indicator.
typedef NS_ENUM(NSInteger, ProgressIndicatorState) {
ProgressIndicatorStateNone =
0, // Nothing is shown (or the space is collapsed)
ProgressIndicatorStateActivity, // The spinner is shown
ProgressIndicatorStateSuccess, // The checkmark is shown
};
// Sets the states for the progress indicator.
- (void)setProgressState:(ProgressIndicatorState)progressState;
// The accessibility label for the confirmation checkmark.
// This label is applied and announced by VoiceOver when `progressState` is
// set to `ProgressIndicatorStateSuccess`.
@property(nonatomic, copy) NSString* confirmationAccessibilityLabel;
@end
#endif // IOS_CHROME_BROWSER_ALERT_VIEW_UI_BUNDLED_ALERT_CONSUMER_H_