Skip to content

GYANTINC/gyant-ios-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Gyant iOS SDK

Logo

release

About

GYANT combines messaging, AI, and medical experts to radically improve the diagnosis and treatment of non-urgent conditions. GYANT makes treatment faster, more effective & more delightful. Our purpose is to transform healthcare from the outside in — to create a new care standard for everyone.

Requirements

  • iOS 10+
  • Xcode 11.2.1+

Setup using CocoaPods

Add Gyant repo:

pod repo add gyant-podspecs [email protected]:GYANTINC/gyant-podspecs.git

Add Gyant Specs source to your Podfile in the following order:

source '[email protected]:GYANTINC/gyant-podspecs.git'
source 'https://github.com/CocoaPods/Specs.git'

Make sure gyant-podspecs source is the first one

Add GyantChatSDK pod to your app target.

pod 'GyantChatSDK', '~> 1.1.1'

Install the pod.

pod install

Disable Bitcode

GyantChatSDK does not offer bitcode compatibility for now.

Make sure to disable bitcode in your build settings:

Disable Bitcode

Add NSLocationWhenInUseUsageDescription

Adding the NSLocationWhenInUseUsageDescription key in Info.plist is required to enable the app to access the user location. The user location is required in some user flows like Find a Clinic, etc.

Add NSLocationWhenInUseUsageDescription

Getting Started with Swift

  1. Import the GyantChatSDK framework in the application delegate.

    import GyantChatSDK
  2. Start the SDK by adding the following code snippet in the application:didFinishLaunchingWithOptions: application delegate method.

    GyantChat.start(withClientID: "<YOUR-CLIENT-ID>",
                    patientData: nil,
                    theme: nil,
                    isDev: true)

    To change the chat view appearance:

    let botPalette = ["primaryColor1":"ff0000"]
    let providerPalette = ["primaryColor1":"00ff00"]
    let theme = ["bot": botPalette, "provider": providerPalette]
    GyantChat.start(withClientID: "<YOUR-CLIENT-ID>",
                    patientData: nil,
                    theme: theme,
                    isDev: true)

    For more details about theme configuration read here.

    To provide additional patient information:

    let patientData = GyantChatPatientData()
    patientData.patientId = "<YOUR-PATIENT-ID>"
    patientData.gender = "male" // male or female
    patientData.visitReason = "fever"
    patientData.dateOfBirth = "2001-03-26T20:28:32.383+0000"
    
    GyantChat.start(withClientID: "<YOUR-CLIENT-ID>",
                    patientData: patientData,
                    theme: nil,
                    isDev: true)

    Note: The isDev parameter must be changed to false before submitting the app to production.

  3. Present the chat view by adding the following code snipped in any view controller.

    let chatVC = GyantChat.createChatViewController()!
    self.present(chatVC, animated: true, completion: nil)
  4. [Optional] GyantChatDelegate

    Set the delegate.

    GyantChat.setDelegate(self)

    Implement push notifications registration method. This method is called when during the flow the bot asks the user to enable push notifications. Depending on the existing app requirements this can just retrieve the already registered token or trigger the complete iOS registration process.

    func gyantRegister(forNotifications completion: @escaping TokenCompletionHandler) {
        completion("<DEVICE-TOKEN>")
    }

    This method is called for every message received from the server. The message parameter could be empty for special messages like carousels, images, etc.

    func gyantDidReceiveMessage(_ message: String) {
        // Your code here
    }

    This method is called for every new diagnosis from the server. The diagnosis parameter will contain the diagnosis information.

    func gyantDidReceiveDiagnosis(_ diagnosis: [AnyHashable : Any]) {
        // Your code here
    }
  5. (Optional) Change the patient data after initializing the SDK.

    GyantChat.changePatientData(...)

All the fields available in GyantChatPatientData are optional.

Field Description
patientId Patient ID on the client’s side and can be any string/format. Max. lenght is 4096
name Patient full name
firstName Patient first name
lastName Patient last name
gender Patient gender, e.g: male or female.
phone Patient phone number
dateOfBirth Patient date of birth. Can use UTC, e.g. 2019-03-26T20:28:32.383+0000
visitReason Patient visit reason if known

Include the SDK for iOS in an Existing Application

The samples included with the SDK for iOS are standalone projects that are already set up for you. You can also integrate the SDK for iOS with your own existing project.

Theme Configuration

To allow a more seamless integration into existing apps, the SDK supports color customization. Currently, two different palletes are available: bot and provider. The bot palette is used during chat bot conversations while the provider will be loaded when the user is talking to a human (doctor, nurse, etc).

For each palette the following RGB colors could be customized:

Name Description bot provider
primaryColor1
  • Background color
  • Auto-complete matches highlight text color
  • Hyperlink text color
ff4cb9f7 ff1f5075
primaryColor2 Clinic and Provider cards text color ff3ea9f5 ff3ea9f5
primaryColor3 n/a
primaryColor4
  • QuickResponses bubble background color
  • Input box background color
  • User bubble background color
ff79c7ff ff296a9c
secondaryColor1
  • Auto-complete list background color
  • Connecting indicator background color
  • Scroll to bottom button icon color
  • Send button enabled icon color
  • Input box cursor color
  • Undo button icon color
ffffffff ffffffff
secondaryColor2 Success notification background color ff4cd964 ff4cd964
secondaryColor3 Error notification background color fff55040 fff55040
secondaryColor4 Provider bubble background color ff62849e ff62849e
extraColor1
  • Card title text color
  • Connecting indicator text color
  • Auto-complete non-matches text color
  • Provider avatar placeholder initials text color
ff13324a ff0f77c6
extraColor2 Card subtitle text color ff767676 ff767676
extraColor3 Send button disabled icon color ffaaaaaa ffaaaaaa
extraColor4 Provider avatar placeholder background color.
extraColor5
  • Scroll to bottom button background color
  • Send button background color
ff13324a ff13324a

Copyright © 2019 GYANT.com, Inc. All rights reserved.