Configuring Colors, User Actions, and Offline Mode

Learn about color configuration, actions, and offline mode in iOS

To quickly brand your chat app, use the KBMSettings class to customize the color and text and message bubbles. Do this prior to initialization.

Add something like the following in the AppDelegate class. This example sets the conversation accent color. Useful styling settings include:

  • conversationAccentColor
  • userMessageTextColor
  • userMessageTextColor
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

     let settings = KBMSettings(integrationId: iosIntegrationID)
     settings.conversationAccentColor = YOUR_UICOLOR

}

Uploading items and attaching a location

The SDK supports uploading items from the Gallery, Camera, Documents and attaching Location. You can customize this by adding an additional line to settings.

settings.allowedMenuItems = [KBMMenuItemCamera,
                             KBMMenuItemGallery,
                             KBMMenuItemDocument,
                             KBMMenuItemLocation]

To enable Camera and/or Gallery on iOS, the application also needs the property list to include the following description keys.

Camera
NSCameraUsageDescription
NSPhotoLibraryAddUsageDescription

Gallery
NSPhotoLibraryUsageDescription

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	[other keys like CFBundleIdentifier, CFBundleName, CFBundleVersion, CFBundleShortVersionString, etc...]
	<key>NSCameraUsageDescription</key>
	<string>[Description user will see when camera permission request popup appears]</string>
	<key>NSPhotoLibraryAddUsageDescription</key>
	<string>[Description for adding photos to library via camera]</string>
	<key>NSPhotoLibraryUsageDescription</key>
	<string>[Description user will see when photo-library permission request popup appears]</string>
</dict>
</plist>

You can remove the ones you don't support.

Offline usage

SDK also supports offline usage which essentially queues the messages and sends them when the user is back online.

settings.allowOfflineUsage = true