Latest 0.1.0
Homepage https://github.com/circuit/circuit-ios-sdk
License Apache 2.0
Platforms ios 10.0
Dependencies SocketRocket
Frameworks JavaScriptCore
Authors

Version
License
Platform

Circuit iOS SDK

Introduction

Welcome to the Circuit iOS SDK. You can use the provided SDK to build a text or media mobile application for iOS.

Prerequisites

Installation

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

pod 'CircuitSDK'

Example

You can find the sample application in the iOS Sample App directory. If you try to run the application, you won’t be able to logon. You must add your client id and client secret and install pods. In the terminal navigate to the CircuitKit folder and run the following command:

pod install

This will install the pods and create a CircuitKit.xcworkspace, open that file instaead of the CircuitKit.xcodeproj. In the Sample/Resources folder open AppDelegate.swift, here you can add your client id and client secret. Press the run button

Authorization

If you do not have any client credentials first sign up for a developer account here

Once your account is approved navigate to Circuit App Registration and follow the instructions to obtain the credentials

Once you receive them you are ready to run the sample application and create your own.

Here are some snippets to get you started.

initializeSDK

It’s a good idea to initialize the SDK when the application launches,
this can be done in the AppDelegate file.

Application scope should be a comma delimited string that can contain any of
the following

SCOPE
ALL
READ_USER_PROFILE
WRITE_USER_PROFILE
READ_CONVERSATIONS
WRITE_CONVERSATIONS
READ_USER
CALLS

We use a framework called AppAuth to help with OAuth 2.0 authentication.

AppAuth takes your client id and client secret and returns to you an access token,
you can the use this access token to logon.

See AppAuth-iOS for examples using AppAuth

Remember to set your redirectURI you created when registering your application,
this redirectURI tells AppAuth how to get back to your application after
authentication has completed.

[client initializeSDK:@"ADD CLIENT_ID"
oAuthClientSecret:@"ADD CLIENT SECRET"
oAuthScope:@"ADD OAUTH SCOPE"];
CKTClient().initializeSDK("ADD CLIENT ID",
oAuthClientSecret:"ADD CLIENT SECRET",
oAuthScope:"ADD OAUTH SCOPE")

Event Handling

Event handling is already setup in the SDK. All you have to do to provide
event handling to your application is add some observers where you want to listen
to specific events.

Event Type Description
CKTNotificationBasicSearchResults string Asynchronous search results for startUserSearch or startBasicSearch
CKTNotificationCallEnded string Fired when a call is terminated
CKTNotificationCallIncoming string Fired when an incoming call is received. I.e. client is alerting
CKTNotificationCallStatus string Fired when the call state, or any other call attribute of a local or remote call changes. Use the isRemote property to determine if the call is local or remote. A call is considered remote when a) the call is active on another device, or b) a group call is not joined yet
CKTNotificationConnectionStateChanged string Fired when the connection state changes
CKTNotificationConversationCreated string Fired when a new conversation is created for this user. This can be a brand new conversation, or being added to a conversation
CKTNotificationConversationUpdated string Fired when an existing conversation is updated
CKTNotificationItemAdded string Fired when a new conversation item is received. Note that the sender of an item will also receive this event
CKTNotificationItemUpdated string Fired when an existing conversation item is updated
CKTNotificationReconnectFailed string Fired when automatic reconnecting to the server fails
CKTNotificationRenewToken string Fired when token has been renewed after session expiry. Error included on failure
CKTNotificationSessionExpires string Fired when session expires
CKTNotificationUserPresenceChanged string Fired when the presence of a subscribed user changes
CKTNotificationUserSettingsChanged string Fired when one or more user settings for the logged on user change
CKTNotificationUserUpdated string Fired when the local user is updated. E.g. I change the jobTitle on my mobile device

Adding Observers

[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(itemAddedToConversation)
name:CKTNotificationItemAdded object:nil];
NSNotificationCenter.defaultCenter()
.addObserver(self,
selector:#selector(itemAddedToConversation),
name:CKTNotificationItemAdded, object: nil)

To listen for events you need to add observers to your application logic. You
do this using Apple’s Notification Center if you have never used NSNotificationCenter
you can find more information on it here

In the example we are watching for an event called CKTNotificationItemAdded which when triggered
will fire a method called itemAddedToConversation

Terms of Use

By downloading and running this project, you agree to the license terms of the third party application software, Unify products, and components to be installed.

The third party software and products are provided to you by third parties. You are responsible for reading and accepting the relevant license terms for all software that will be installed. Unify grants you no rights to third party software.

License

Unless otherwise mentioned, the samples are released under the Apache license.

Copyright 2017 Unify Software and Solutions GmbH & Co.KG.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Help us improve the SDK

Help us improve out samples by sending us a pull-request or opening a GitHub Issue.

Copyright (c) Unify, Inc. All rights reserved. Licensed under the Apache license. See LICENSE file in the project root for full license information.

Latest podspec

{
    "name": "CircuitSDK",
    "version": "0.1.0",
    "summary": "Circuit iOS SDK to build a text or media mobile application for iOS",
    "description": "'The iOS SDK is the Circuit client, exposing a clear abstracted API for Circuit PaaS.n The iOS SDK is built upon the Circuit JS SDK.'",
    "homepage": "https://github.com/circuit/circuit-ios-sdk",
    "license": {
        "type": "Apache 2.0",
        "file": "LICENSE"
    },
    "authors": {
        "Unify Inc.": "https://www.unify.com"
    },
    "source": {
        "git": "https://github.com/circuit/circuit-ios-sdk.git",
        "tag": "0.1.0"
    },
    "social_media_url": "https://twitter.com/unifyco",
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "Source/Classes/**/*",
    "public_header_files": "Source/Classes/**/*.h",
    "resource_bundles": {
        "CircuitSDK": [
            "Source/scripts/**"
        ]
    },
    "frameworks": "JavaScriptCore",
    "dependencies": {
        "SocketRocket": [
            "~> 0.4.2"
        ]
    }
}

Pin It on Pinterest

Share This