SCSActionManager
@interface SCSActionManager : NSObject
The SCSActionManager class controls the handling and display of the action buttons that are overlaid on the various Snap-ins SDK interface elements to allow the user to initiate various actions, such as:
- Creating a new case.
- Initiating a knowledge article search.
- Starting a Live Agent chat session.
- Initiating an SOS support session.
These built-in actions are managed through the action manager class, and can be customized through the use of it and the associated protocols available. Furthermore, the SCSActionManagerDelegate
protocol can be used to interact with, and customize, the handling of these actions.
Each action button that is displayed is represented by UIView
instances that conform to the SCSActionItem
protocol. Each of these items are displayed within a UIViewController
instance that conforms to the SCSActionItemController
protocol. Built-in defaults are provided that implement these behaviors, and can be used to extend or customize functionality. Furthermore, the default action button is exposed as the SCSActionButton
class, and can be used to introduce additional actions along side the built-in defaults, while still maintaining the same visual appearance.
-
Delegate property for interacting with, and customizing, the action manager.
Declaration
Objective-C
@property (nonatomic, weak) NSObject<SCSActionManagerDelegate> *_Nullable delegate;
Swift
weak var delegate: SCSActionManagerDelegate? { get set }
-
Indicates that the set of available action items may have changed, and informs the
SCSActionManager
that it should reevaluate its set of available options.Declaration
Objective-C
- (void)setNeedsUpdateActionItems;
Swift
func setNeedsUpdateActionItems()
-
Reference to the current action display controller.
Declaration
Objective-C
@property (nonatomic, strong, readonly, nullable) UIViewController<SCSActionItemContainer> *actionItemContainer;
-
Indicates whether or not the action item container is visible.
Under normal circumstances the action container will automatically show and hide based on whether or not the current display supports it. This behavior can be extended or customized within the
-[SCSActionManagerDelegate actionManager:shouldShowContainerForViewController:]
delegate method. When all remaining ServiceSDK UI elements have been dismissed, the action container will automatically be cleaned up and removed from the view hierarchy. However, if thecontainerVisible
property is set directly, this default behavior is opted out, allowing the container to remain visible after the ServiceSDK elements have been dismissed.Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isContainerVisible) BOOL containerVisible;
Swift
var isContainerVisible: Bool { get set }
-
Animated setter for controlling the action item container visibility.
See
containerVisible
Declaration
Objective-C
- (void)setContainerVisible:(BOOL)visible animated:(BOOL)animated;
Swift
func setContainerVisible(_ visible: Bool, animated: Bool)
Parameters
visible
YES
if the action container should be visible, orNO
to make the container hidden.animated
Indicates whether or not the container visibility change should be animated.
-
Indicates whether or not an action with the given name is currently visible.
Declaration
Objective-C
- (BOOL)isActionItemWithNameVisible:(nonnull SCSAction)actionName;
Swift
func isActionItemVisible(_ actionName: SCSAction) -> Bool
Parameters
actionName
Action name.
Return Value
YES
if the action is visible. -
Shows or hides an action with the given name.
If the
-[SCServiceCloudDelegate serviceCloud:shouldShowActionWithName:]
delegate method is implemented, the result of that method is respected regardless of which value is supplied to this method.Declaration
Objective-C
- (void)setActionItemWithName:(nonnull SCSAction)name visible:(BOOL)visible animated:(BOOL)animated;
Swift
func setActionItemVisible(name: SCSAction, visible: Bool, animated: Bool)
Parameters
visible
YES
If the action should be visible, orNO
if the action should be hidden.name
Action name.
animated
YES
If the action’s view should be animated. -
Performs the action associated with the action name for the supplied action item.
Declaration
Objective-C
- (void)performActionWithName:(nonnull SCSAction)actionName actionItem:(nullable UIView<SCSActionItem> *)actionItem;
Parameters
actionName
Name of the action to perform.
actionItem
Action item for which the action needs to be performed.