ConfigBuilder

@available(iOS 12.0, *)
public class ConfigBuilder

A builder that constructs Kaleyra Video SDK Config objects.

This object helps you creating Config objects guiding you in this process with a fluent interface. The only required parameters are the appID, the environment and the region values. You must provide those values in the builder initialiser, then you can use the builder methods to enable or disable tools and other SDK features.

  try ConfigBuilder(appID: "my app id", environment: .production, region: .europe)
        .callKit { callkit in
                   callkit.enabled { providerBuilder in
                                      providerBuilder.supportedHandles([.generic])
                                                     .ringtoneSound("ringtone.mp3")
                                                     .icon(UIImage(named: "callkit-icon")!)
                   }
        }
        .voip { voip in
                voip.automatic(pushRegistryDelegate: self)
        }
        .tools { tools in
                 tools.chat()
                      .whiteboard(uploadEnabled: true)
                      .fileshare()
                      .inAppScreenSharing()
                      .broadcastScreenSharing(appGroupIdentifier: "group.com.acme.Acme",
                                              broadcastExtensionBundleIdentifier: "com.acme.Acme.BroadcastExtension")
        }
        .disableDirectIncomingCalls()
        .hijackAudioRoute(.always)
        .build()

By default the builder will use some default values if you don’t override them by calling one of its methods. Here’s a list of the default values:

  • CallKit is enabled
  • VoIP notifications are NOT handled automatically, you must handle them yourself
  • All tools are disabled
  • Camera configuration has cameraPosition set to front
  • The SDK will listen for direct incoming calls coming from the WebSocket connection
  • TheSpeakerHijackingStrategy is SpeakerHijackingStrategy.videoForeground.

    Remark

    This builder is suited and available only for Swift code. If your application is written in Objective-c, you should use the BDKConfigBuilder instead.
  • Creates a new instance of the builder that will help you out building a Kaleyra Video Config object.

    You are required to provide a appID, environment, region triplet identifying your app in the Kaleyra Video platform. Beware, the appID is bound to an environment and a region, if you provide a wrong environment or region value the Kaleyra Video won’t be able to connect to the back-end.

    Important

    You cannot setup one app to connect to Europe region and another one to India region, they won’t talk to each other.

    Declaration

    Swift

    public init(appID: String,
                environment: Bandyer.Environment,
                region: Bandyer.Region)

    Parameters

    appID

    The appID identifying your app in the Kaleyra Video platform.

    environment

    Kaleyra Video back-end environment where the SDK will connect to (e.g production, sandbox).

    region

    The global region where user’s data will be conserved and managed.

CallKit

  • A method that will let you specify CallKit configuration values.

    Call this method when you want to override CallKit configuration default values using an inline build closure. The closure will provide a CallKitConfigurationBuilder you may use to enable or disable the SDK CallKit support by calling one of its methods.

     let config = try ConfigBuilder(appID: "my app id", environment: .production, region: .europe)
                      .callKit { callkit in
                                  callkit.enabled { providerConfig in
                                                      providerConfig
                                                       .supportedHandles([.phoneNumber, .emailAddress])
                                                       .ringtoneSound("my ringtone.mp3")
                                                       .icon(UIImage(named: "callkit.png")!)
                                              }
                      }.build()
    

    The CallKitConfigurationBuilder builder provided in the closure will store the CallKit configuration values you provide and it will eventually apply them to the final Config object when the ConfigBuilder.build method is invoked.

    Remark

    Calling this method several times discards the previously provided values

    Declaration

    Swift

    public func callKit(_ build: (CallKitConfigurationBuilder) throws -> Void) rethrows -> ConfigBuilder

    Parameters

    build

    A non escaping closure you provide to build the CallKit configuration using the builder provided as closure argument.

    Return Value

    self after storing the configuration values you provided.

  • A method that will let you specify CallKit configuration values.

    Call this method when you want to override CallKit configuration default values providing a CallKitConfigurationBuilder. The CallKitConfigurationBuilder builder provided will store the CallKit configuration values you provide and it will eventually apply them to the final Config object when the ConfigBuilder.build method is invoked.

    Declaration

    Swift

    public func callKit(_ builder: CallKitConfigurationBuilder) -> ConfigBuilder

    Parameters

    builder

    The CallKitConfigurationBuilder object you want to use for configuring CallKit.

    Return Value

    self after storing the CallKitConfigurationBuilder object.

VoIP

  • A method that will let you specify VoIP push configuration values.

    Call this method when you want to setup how the Kaleyra Video SDK should manage VoIP push notifications using an inline build closure. The closure will provide a VoIPPushConfigurationBuilder you may use to select which strategy the SDK should use for handling VoIP notifications by calling one of its methods.

     let config = try ConfigBuilder(appID: "my app id", environment: .production, region: .europe)
                      .voip { voip in
                              voip.automatic(pushRegistryDelegate: self)
                      }.build()
    

    The VoIPPushConfigurationBuilder builder provided in the closure will store the configuration values you provide and it will eventually apply them to the final Config object when the ConfigBuilder.build method is invoked.

    Remark

    Calling this method several times discards the previously provided values

    Declaration

    Swift

    public func voip(_ build: (VoIPPushConfigurationBuilder) throws -> Void) rethrows -> ConfigBuilder

    Parameters

    build

    A non escaping closure you provide to build the VoIP configuration using the builder provided as closure argument.

    Return Value

    self after storing the configuration values you provided.

  • A method that will let you specify VoIP push configuration values.

    Call this method when you want to setup how the Kaleyra Video SDK should manage VoIP push notifications. Call this method when you want to setup how the Kaleyra Video SDK should manage VoIP push notifications providing a VoIPPushConfigurationBuilder. The VoIPPushConfigurationBuilder builder provided will store the VoIP configuration values you provide and it will eventually apply them to the final Config object when the ConfigBuilder.build method is invoked.

    Declaration

    Swift

    public func voip(_ builder: VoIPPushConfigurationBuilder) -> ConfigBuilder

    Parameters

    builder

    The VoIPPushConfigurationBuilder object you want to use for configuring how the SDK will handle VoIP notifications.

    Return Value

    self after storing the configuration values you provided.

Tools

  • A method that will let you enable the Kaleyra Video collaboration tools.

    Call this method when you want to setup the Kaleyra Video SDK tools using an inline build closure. The closure will provide a ToolsConfigurationBuilder you may use to select which SDK tools should be enabled by calling one of its methods.

     let config = try ConfigBuilder(appID: "my app id", environment: .production, region: .europe)
                      .tools { tools in
                               tools.chat()
                                    .inAppScreenSharing()
                                    .whiteboard(uploadEnabled: true)
                       }.build()
    

    The ToolsConfigurationBuilder builder provided in the closure will store the configuration values you provide and it will eventually apply them to the final Config object when the ConfigBuilder.build method is invoked.

    Remark

    Calling this method several times discards the previously provided values

    Declaration

    Swift

    public func tools(_ build: (ToolsConfigurationBuilder) throws -> Void) rethrows -> ConfigBuilder

    Parameters

    build

    A non escaping closure you provide to setup the Kaleyra Video SDK tools using the builder provided as closure argument.

    Return Value

    self after storing the configuration values you provided.

  • A method that will let you enable the Kaleyra Video collaboration tools.

    Call this method when you want to setup the Kaleyra Video SDK tools using a ToolsConfigurationBuilder builder. The ToolsConfigurationBuilder builder provided will store the tools configuration values you provide and it will eventually apply them to the final Config object when the ConfigBuilder.build method is invoked.

    Declaration

    Swift

    public func tools(_ builder: ToolsConfigurationBuilder) -> ConfigBuilder

    Parameters

    builder

    The ToolsConfigurationBuilder object you want to use for configuring the SDK tools.

    Return Value

    self after storing the configuration values you provided.

Camera Configuration

  • A method that will let you create the camera configuration used by the Kaleyra Video SDK.

    Call this method when you want to setup the Kaleyra Video SDK camera configuration using an inline build closure. The closure will provide a CameraConfigurationBuilder you may use to select which camera configuration you desire.

     let config = try ConfigBuilder(appID: "my app id", environment: .production, region: .europe)
                      .camera { camera in
                          camera.withCameraPosition(.back)
                       }.build()
    

    The CameraConfigurationBuilder builder provided in the closure will store the configuration values you provide and it will eventually apply them to the final Config object when the ConfigBuilder.build method is invoked.

    Remark

    Calling this method several times discards the previously provided values

    Declaration

    Swift

    public func camera(_ build: (CameraConfigurationBuilder) throws -> Void) rethrows -> ConfigBuilder

    Parameters

    build

    A non escaping closure you provide to setup the Kaleyra Video SDK camera configuration using the builder provided as closure argument.

    Return Value

    self after storing the configuration values you provided.

  • A method that will let you create the camera configuration used by the Kaleyra Video SDK.

    Call this method when you want to setup the Kaleyra Video SDK camera configuration using a CameraConfigurationBuilder builder. The CameraConfigurationBuilder builder provided will store the camera configuration values you provide and it will eventually apply them to the final Config object when the ConfigBuilder.build method is invoked.

    Declaration

    Swift

    public func camera(_ camera: CameraConfigurationBuilder) -> ConfigBuilder

    Parameters

    builder

    The CameraConfigurationBuilder object you want to use for configuring the SDK camera configuration.

    Return Value

    self after storing the configuration values you provided.

Speaker audio route

  • A method that will let you specify the strategy the Kaleyra Video will use to override the audio output to the speaker when a call starts.

    The option provided will be used only when the app is running on devices mounting an ear speaker and a loud speaker (iPhones). On devices not supporting ear speaker (iPads) this option has no effect.

     let config = try ConfigBuilder(appID: "my app id", environment: .production, region: .europe)
                               .hijackAudioRoute(.always)
                               .build()
    

    Remark

    Calling this method several times discards the previously provided values

    Declaration

    Swift

    public func hijackAudioRoute(_ strategy: SpeakerHijackingStrategy) -> ConfigBuilder

    Parameters

    strategy

    The SpeakerHijackingStrategy you want to use.

    Return Value

    self after setting the SpeakerHijackingStrategyvalue.

Incoming calls

  • A method that will let you disable incoming calls coming from the WebSocket connection. Call this method when you want to prevent the SDK from receiving incoming calls from the WebSocket connection.

    Declaration

    Swift

    public func disableDirectIncomingCalls() -> ConfigBuilder

    Return Value

    self after disabling direct incoming calls.

  • Call this method when you have finished setting up the tools and the features of the Kaleyra Video SDK and you want to create a Config object.

    Throws

    Throws an error when a configuration object cannot be created

    Declaration

    Swift

    public func build() throws -> Config

    Return Value

    A Config object holding the configuration values you provided to the builder