ASAPP
@objc(ASAPP)
@objcMembers
public class ASAPP : NSObject
The ASAPP class holds references to its various configurable properties and allows you
to call various functions. No instances of ASAPP are to be created.
-
A
Stringrepresenting the SDK version in x.y.z format.Declaration
Swift
public static var clientVersion: String { get }
-
The delegate, whose methods are called to allow you to respond to various events.
Declaration
Swift
public weak static var delegate: ASAPPDelegate? -
Set by calling
ASAPP.initialize(with:), typically in theAppDelegate.Declaration
Swift
private(set) public static var config: ASAPPConfig! { get } -
The current user.
Declaration
Swift
public static var user: ASAPPUser! { get set } -
The SDK can be styled to fit your brand.
Declaration
Swift
public static var styles: ASAPPStyles -
Strings displayed by the SDK can be customized.
Declaration
Swift
public static var strings: ASAPPStrings -
Certain views displayed by the SDK can be customized.
Declaration
Swift
public static var views: ASAPPViews -
Verbosity of the debugging log. Defaults to
.errors.Declaration
Swift
public static var debugLogLevel: ASAPPLogLevel
-
Sets the
configproperty.Declaration
Swift
public class func initialize(with config: ASAPPConfig)Parameters
configAn
ASAPPConfiginstance used to configure the SDK.
-
Creates a chat view controller, ready to be pushed onto a navigation stack.
Declaration
Swift
public class func createChatViewControllerForPushing(fromNotificationWith userInfo: [AnyHashable : Any]?) -> UIViewController?Parameters
userInfoA user info dictionary containing notification metadata
Return Value
A
UIViewControllerifASAPP.configandASAPP.userare set; otherwise returnsnil. -
Creates a chat view controller, ready to be pushed onto a navigation stack. Starts a conversation with the provided intent.
Declaration
Swift
public class func createChatViewControllerForPushing(withIntent intent: [String : Any]) -> UIViewController?Parameters
intentA dictionary containing intent data
Return Value
A
UIViewControllerifASAPP.configandASAPP.userare set; otherwise returnsnil. -
Creates a chat view controller in a navigation controller, ready to be presented modally.
Declaration
Swift
public class func createChatViewControllerForPresenting(fromNotificationWith userInfo: [AnyHashable : Any]?) -> UIViewController?Parameters
userInfoA user info dictionary containing notification metadata
Return Value
A
UIViewControllerifASAPP.configandASAPP.userare set; otherwise returnsnil. -
Creates a chat view controller in a navigation controller, ready to be presented modally. Starts a conversation with the provided intent.
Declaration
Swift
public class func createChatViewControllerForPresenting(withIntent intent: [String : Any]) -> UIViewController?Parameters
intentA dictionary containing intent data
Return Value
A
UIViewControllerifASAPP.configandASAPP.userare set; otherwise returnsnil. -
Creates a chat view controller in a navigation controller, ready to be presented modally. Use this method only when opening chat from the Chat Instead menu.
Declaration
Swift
public class func createChatViewControllerForPresentingFromChatInstead() -> UIViewController?Return Value
A
UIViewControllerifASAPP.configandASAPP.userare set; otherwise returnsnil. -
Creates a chat view controller, ready to be pushed onto a navigation stack. Use this method only when opening chat from the Chat Instead menu. SDK channel.
Declaration
Swift
public class func createChatViewControllerForPushingFromChatInstead() -> UIViewController?Return Value
A
UIViewControllerifASAPP.configandASAPP.userare set; otherwise returnsnil.
-
Whether the SDK should request camera access when necessary. Setting this will override any remote configuration settings. Setting this to
falsewill prevent the SDK from displaying the option to take a photo with the camera.Declaration
Swift
@nonobjc public static var shouldRequestCameraAuthorization: Bool? -
Only used for Objective-C compatibility. See
shouldRequestCameraAuthorizationfor functionality.Declaration
Swift
@objc public static var objcShouldRequestCameraAuthorization: NSNumber? -
Whether the SDK should request photo library access when necessary. Setting this will override any remote configuration settings. Setting this to
falsewill prevent the SDK from displaying the option to choose a photo from the photo library.Declaration
Swift
@nonobjc public static var shouldRequestPhotoLibraryAuthorization: Bool? -
Only used for Objective-C compatibility. See
shouldRequestPhotoLibraryAuthorizationfor functionality.Declaration
Swift
@objc public static var objcShouldRequestPhotoLibraryAuthorization: NSNumber?
-
Whether the SDK should request notification authorization. An ASAPP-provided custom UI is shown before triggering the OS level alert.
Declaration
Swift
public static var shouldRequestNotificationAuthorization: Bool -
Called when the user denies notification authorization.
Declaration
Swift
public static var notificationAuthorizationDenied: (() -> Void)? -
Enables ASAPP push notifications for this device. The device token is saved in memory for later use when registering.
Declaration
Swift
public class func enablePushNotifications(with deviceToken: Data)Parameters
deviceTokenThe token provided by APNS in
didRegisterForRemoteNotificationsWithDeviceToken(_:) -
Enables ASAPP push notifications for this device. The UUID is saved in memory for later use when registering.
Declaration
Swift
@objc(enablePushNotificationsWithUUID:) public class func enablePushNotifications(with uuid: String)Parameters
uuidAn arbitrary string used by a separate push notification system to uniquely identify the device.
-
Disables ASAPP push notifications for this device. The device is then deleted from local storage. If no error was returned then disabling has succeeded. Be sure to call this before changing or clearing
ASAPP.user.Declaration
Swift
public class func disablePushNotifications(failure: @escaping FailureHandler)Parameters
failureA
FailureHandlerthat receives an error if one occurs -
Skips to the bottom of the chat such that the latest message is visible.
Declaration
Swift
public class func skipToBottom() -
A
Voidclosure type that takes anInt, the number of unread messages; and aBool, whether the user is in a live chat.Declaration
Swift
public typealias ChatStatusHandler = ((_ unread: Int, _ isLiveChat: Bool) -> Void) -
A
Voidclosure type that takes anASAPPError, if an error occurs.Declaration
Swift
public typealias FailureHandler = ((_ error: ASAPPError) -> Void) -
Gets the number of messages the user received while offline as well as whether user is currently in a live chat.
Declaration
Swift
public class func getChatStatus(success: @escaping ChatStatusHandler, failure: @escaping FailureHandler)Parameters
successA
ChatStatusHandlerthat receives the number of unread ASAPP push notifications and the live chat status.failureA
FailureHandlerthat receives an error if one occurs -
Should be called to detect an ASAPP notification before calling
createChatViewControllerForPresenting(fromNotificationWith:appCallbackHandler:).Declaration
Swift
public class func canHandleNotification(with userInfo: [AnyHashable : Any]?) -> BoolParameters
userInfoA user info dictionary containing notification metadata
Return Value
Whether the SDK can handle a notification.
-
Clears the session saved on disk.
Declaration
Swift
public class func clearSavedSession() -
Sets the intent on the current chat view controller. This is meant to be called only when a chat view controller already exists. If there is no ChatViewController please use one of the
createChatViewControllerFor...functions.Declaration
Swift
public static func setIntent(_ data: [String : Any])Parameters
dataA dictionary with intent data. e.g.
["Code": "EXAMPLE_INTENT"]
ASAPP Class Reference