Skip to content

alimashuri/qiscus-sdk-ios

Repository files navigation

Qiscus SDK CocoaPods Compatible

Qiscus SDK is a lightweight and powerful chat library. Qiscus SDK will allow you to easily integrating Qiscus engine with your apps to make cool chatting application.

Features

  • Text Message and Emoji 👍
  • Upload Image and File
    • Galery
    • Camera
    • iCloud
  • Custom Baloon Color
  • Local Storage
  • Push Notification

Requirements

  • iOS 9.0+
  • Xcode 8.0+
  • Swift 3.0+

Instalation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required.

Podfile file :

target 'SampleSDK' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for SampleSDK
  pod "Qiscus"

end

Usage

Initiate Qiscus SDK in your project

To initiate Qiscus SDK, you need to import Qiscus and then add this in your code (AppDelegate, didFinishLaunchingWithOptions)

Qiscus.setup(withAppId: YOUR_APP_ID, 
        userEmail: CURRENT_USER_EMAIL, 
        userKey: CURRENT_USER_PASSWORD, 
        username: CURRENT_USER_USERNAME, 
        avatarURL: CURRENT_USER_AVATAR_URL, 
        delegate: self, 
        secureURl: true
  )

Request access to get new Qiscus APP_ID

For example :

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        
        let viewController = ViewController()
        let navigationController = UINavigationController(rootViewController: viewController)
        
        
        Qiscus.setup(withAppId: "DRAGONFLY",
                     userEmail: "[email protected]",
                     userKey: "password",
                     username: "Evan 3",
                     avatarURL: "https://qiscuss3.s3.amazonaws.com/uploads/36976206a8b1fd2778938dbcd72b6624/qiscus-dp.png",
                     delegate: self, secureURl: false)
        
        self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
        window?.rootViewController = navigationController
        window?.makeKeyAndVisible()
        
        
        return true
    }

Start Chat with Target

Start chat with target is very easy, all you need is just call Qiscus.chat(withUsers: ["TARGET_EMAIL"], target: self) in your code

For example in your ViewController :

import UIKit
import Qiscus

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let button = UIButton(frame: CGRectMake(100,100,100,40))
        button.setTitle("Chat", forState: .Normal)
        button.backgroundColor = UIColor.redColor()
        self.view.addSubview(button)
        
        button.addTarget(self, action: #selector(ViewController.goToChat), forControlEvents: .TouchUpInside)
    }
    
    func goToChat(){
        print("go to chat")
        Qiscus.chat(withUsers: ["[email protected]"], target: self)
        
    }
}

Custom Style of Chat Interface

you can explore customisation of chat interface by calling method style

For Example :

  Qiscus.style.color.leftBaloonColor = UIColor.blueColor()
  Qiscus.style.color.rightBaloonColor = UIColor.greenColor()

Check sample apps -> DragonFly

License

Qiscus-SDK-IOS is released under the MIT license. See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published