Installation
Description
In this section, you can find all the information related to the integration of:
Professional List | Chat | My Health | Videocall |
---|---|---|---|
Requirements
Please make sure you are using the last Xcode compatible with our SDK
Swift | Xcode | MeetingDoctors | iOS | Status |
---|---|---|---|---|
5.7 | 15.3 | 6.2.x+ | 13.0+ | Supported |
5.7 | 15.3 | 7.1.x+ | 13.0+ | Supported |
In order to check the last updates please check our Release Notes.
Swift Package Manager
To install the MeetingDoctors library you must first include MeetingDoctors package.
Steps:
- Open Xcode then select Project > Package Dependencies > "+"
- Add repo url:
https://github.com/Meeting-Doctors/meetingdoctors-sdk-spm
Access permissions
Access to camera or photo gallery always requires explicit permission from the user. See Apple Documentation
Your app must provide an explanation for its use of capture devices using the NSCameraUsageDescription and NSPhotoLibraryUsageDescription Info.plist key. iOS displays this explanation when initially asking the user for permission to attach an element in the current conversation.
Attempting to attach a gallery photo or start a camera session without an usage description will raise an exception.
Integration
To use the library is necessary to import it in our AppDelegate:
import MeetingDoctorsSDK
Next, as soon as we receive a notification from the system telling that our application is already active, we must configure the framework by providing the client's API key configuration:
class func initialize(_ application: UIApplication = UIApplication.shared, with configuration: MeetingDoctorsSDK.MeetingDoctors.Configuration, options _: [UIApplication.LaunchOptionsKey : Any]?, completion: ((MeetingDoctorsSDK.MeetingDoctorsResult<MeetingDoctorsSDK.MeetingDoctorsInstallationType>) -> Void)? = nil) -> UUID?
Last method parameter defines asynchronous initialization result of type MeetingDoctorsInstallationType
. It does return framework and installation information responding to the protocol:
public protocol MeetingDoctorsInstallationType {
/// Unique intallation identifier for this device
var installationId: UUID { get }
/// UIDevice.current.systemVersion
var systemVersion: String { get }
/// MeetingDoctors Framework build version number
var frameworkVersion: String { get }
/// Device manufacturer name (i.e. x86_64, iPhone8,2, etc.)
var deviceModel: String { get }
}
To initialize MeetingDoctorsSDK, you need to create a configuration object:
- secret
- Environment API Key
- environment
- If set to
.production
, the SDK interacts with the production environment (default). - If set to
.staging
, the SDK will communicate with the staging environment.
- If set to
- videocallLongSoundFileName
- The sound file to be played when a professional is calling while the app is in the background. The file name must be the same as the one used for call notifications.
- videocallShortSoundFileName
- The sound file to be played when a professional is calling while the app is in the foreground. The file name must be the same as the one used for call notifications.
public struct Configuration {
public let secret: String
public let environment: EnvironmentType
public let videocallLongSoundFileName: String?
public let videocallShortSoundFileName: String?
}
Initialization returns an optional (@discardableResult
) synchronous installation identifier that will only be valid after initialize
call has succeeded once:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
[...]
if let clientSecret: String = “api_key” {
let configuration = MeetingDoctors.Configuration(secret: clientSecret)
if let uuid: UUID = MeetingDoctors.initialize(with: configuration, options: launchOptions) {
NSLog("[MeetingDoctorsApplicationPlugin] Synchronous installation identifier: '\(uuid.uuidString)'")
}
}
[...]
}
Without the initialization process, subsequent calls to the library will trigger error results.