VerloopSDK 0.1.2

VerloopSDK 0.1.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jun 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Prashant.



  • By
  • Verloop

VerloopSDK

Installation

VerloopSDK is available through CocoaPods. To install it, simply add the following line to your Podfile:

    pod "VerloopSDK"

Then, run the following command:

    $pod install

Usage

  1. Initialise Verloop in application:didFinishLaunchingWithOptions.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    let notificationSettings = UIUserNotificationSettings(types: [UIUserNotificationType.badge, UIUserNotificationType.sound, UIUserNotificationType.alert], categories: nil)
    application.registerUserNotificationSettings(notificationSettings)


    let config = VerloopConfig.init(subDomain: "name.stage", token: "test");
    config.name = "testName"
    config.email = "testEmail"
    config.msisdn = "testNumber"
    Verloop.sharedInstance.register(withConfig: config);
    return true
}
  1. Update the device token in application:didRegisterForRemoteNotificationsWithDeviceToken
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})
    Verloop.sharedInstance.updateDeviceToken(withDeviceToken: deviceTokenString);
}
  1. Handle notification
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
    if Verloop.sharedInstance.isVerloopNotif(wihtNotif: userInfo) {
        Verloop.sharedInstance.handleNotif(withNotif: userInfo)
    }
}
  1. Start live chat
    Verloop.sharedInstance.showConversation()

Author

Verloop, [email protected]

License

VerloopSDK is available under the MIT license. See the LICENSE file for more info.