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
String
representing 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
config
property.Declaration
Swift
public class func initialize(with config: ASAPPConfig)
Parameters
config
An
ASAPPConfig
instance 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
userInfo
A user info dictionary containing notification metadata
Return Value
A
UIViewController
ifASAPP.config
andASAPP.user
are 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
intent
A dictionary containing intent data
Return Value
A
UIViewController
ifASAPP.config
andASAPP.user
are 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
userInfo
A user info dictionary containing notification metadata
Return Value
A
UIViewController
ifASAPP.config
andASAPP.user
are 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
intent
A dictionary containing intent data
Return Value
A
UIViewController
ifASAPP.config
andASAPP.user
are 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
UIViewController
ifASAPP.config
andASAPP.user
are 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
UIViewController
ifASAPP.config
andASAPP.user
are set; otherwise returnsnil
.
-
Whether the SDK should request camera access when necessary. Setting this will override any remote configuration settings. Setting this to
false
will 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
shouldRequestCameraAuthorization
for 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
false
will 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
shouldRequestPhotoLibraryAuthorization
for 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
deviceToken
The 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
uuid
An 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
failure
A
FailureHandler
that 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
Void
closure 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
Void
closure 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
success
A
ChatStatusHandler
that receives the number of unread ASAPP push notifications and the live chat status.failure
A
FailureHandler
that 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]?) -> Bool
Parameters
userInfo
A 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
data
A dictionary with intent data. e.g.
["Code": "EXAMPLE_INTENT"]