Configuring the SDK screens
Configuring the SDK screens
Each of the SDK's view controllers are created using either RequestUi
or ZDKHelpCenterUi
. They can be configured using Configuration
objects. Each view controller can start at least one other view controller, and multi-controller flows are possible. For example, the HelpCenterOverviewController
can start ArticleViewController
, RequestListController
and RequestController
-- and each of these can in turn start instances of each other. You can provide your configurations upfront to ensure that the SDK looks and behaves the way you want it to, regardless of which controller you started or where the user went from there. When using the Configuration
class in version 5.0.0 or higher of the Support SDK, you need to import SDKConfigurations
like so:
Swift
import SDKConfigurations
Objective-c
#import <SDKConfigurations/SDKConfigurations-Swift.h>
Creating a Configuration
The SDK is divided into two main areas, ticketing and help center. Configurations for ticketing can be created using RequestUiConfiguration
. Configurations for the help center can be created using HelpCenterUiConfiguration
. These objects conform to Configuration
, an array of which can be passed when starting any of the SDK's view controllers.
let config = RequestUiConfiguration()
config.subject = "iOS Ticket"
config.tags = ["ios", "mobile"]
Starting a View Controller with Configurations
You can use these Configuration
objects when calling the build
functions of RequestUi
and ZDKHelpCenterUi
.
These take an optional list of Configuration
s . This allows you to start one Support SDK controller and include a configuration for any number of other Support SDK view controller classes. Example:
let config1 = ...;
let config2 = ...;
let config3 = ...;
let configs = [config1, config2, config3]
let requestController = RequestUi.buildRequestUi(with: configs)
You can then present the view controller however you want. However, it must be contained in a UINavigation controller.
Using multiple Configurations
The SDK supports configuring each controller once for each entry point to the SDK. Each call to
build
on either RequestUi
or ZDKHelpCenterUi
can be considered an entry point.
For example, you can configure RequestController
and pass its Configuration
when starting HelpCenterOverviewController
.
That configuration will be used for any instance of RequestController
started subsequently,
regardless of whether it is started by HelpCenterOverviewController
, ArticleController
or
RequestListController
.
It's not possible to configure multiple versions of Configuration
for the same
view controller, to be used depending on how the user got there. The SDK will iterate through the
collection and use the first appropriate Configuration
that it finds.
let config1 = ...; // Instance of RequestUiConfig
let config2 = ...; // Instance of RequestUiConfig
let config3 = ...; // Instance of RequestUiConfig
let helpCenter = ZDKHelpCenterUi.buildHelpCenterOverview(withConfigs: [config1, config2, config3]) // This is effectively the same as the line below.
let helpCenter = ZDKHelpCenterUi.buildHelpCenterOverview(withConfigs: [config1]);
It is possible to configure multiple versions of Configuration
for the same view controller if you are
using them for different entry points to the SDK.
let config1 = ...; // Instance of RequestUiConfig
let config2 = ...; // Instance of RequestUiConfig
let config3 = ...; // Instance of RequestUiConfig
let helpCenter1 = ZDKHelpCenterUi.buildHelpCenterOverview(withConfigs: [config1])
let requestList = RequestUi.buildRequestList(with: [config2])
let articleUi = ZDKHelpCenterUi.buildHelpCenterArticle(withArticleId: 123, andConfigs: [config3])