/ios-sdk

Talkative iOS SDK

Primary LanguageSwift

Talkative

Version Platform

General info

Talkative ios client implementation.

Installation

Install with CocoaPods

Add Talkative by following entry to your Podfile.

pod 'Talkative'

Then run pod install.

In any file you'd like to use Talkative in, don't forget to import the framework with import Talkative.

Set your credentials

Set your credetials like below preferably in the AppDelegate.swift before starting the interaction with the service.

TalkativeManager.shared.config = TalkativeConfig.defaultConfig(companyId: "Your Company ID",
                                                                queueId: "Preferred queue ID",
                                                                region: "Region")

Usage

After installation, using talkative is very simple and you can access to all the states with methods below.

Checking online status

    TalkativeManager.shared.onlineCheck { status in
        var statusInfo = ""
        switch status {
        case .chatAndVideo:
            statusInfo = "Chat and Video available"
        case .chatOnly:
            statusInfo = "Only Chat is available"
        case .videoOnly:
            statusInfo = "Only Video is available"
        case .offline:
            statusInfo = "Currently Offline"
        case .error(let err):
            statusInfo = "There's an error \(err)"
        }
    }

Starting interaction if the system is online

    TalkativeManager.shared.startInteractionWithCheck(type: .chat)

Starting interaction immediately without check

    TalkativeManager.shared.startInteractionImmediately(type: .chat) 

If you want to be notified about states before starting the interaction set your delegated class which conform to TalkativeServerDelegate protocol

    TalkativeManager.shared.serviceDelegate = self

Possible conditions.

    extension ViewController: TalkativeServerDelegate {
        func onReady() {
            print("webview is ready")
        }
        
        func onInteractionStart() {
            print("chat can start")
        }
        
        func onInteractionFinished() {
            print("chat finished")
        }
        
        func onQosFail(reason: QosFail) {
            print("Error: \(reason.localizedDescription)")
        }
    }

You can check example app for more detail.