settings.gradle.kts
file:app/build.gradle.kts
file:FlowxSdkApi
singleton instance, which exposes the following methods:
Name | Description | Definition |
---|---|---|
init | Initializes the FlowX SDK. Must be called in your applicationβs onCreate() | fun init(context: Context, config: SdkConfig, accessTokenProvider: FlowxSdkApi.Companion.AccessTokenProvider? = null, customComponentsProvider: CustomComponentsProvider? = null) |
setAccessTokenProvider | Updates the access token provider (i.e. a functional interface) inside the renderer | fun setAccessTokenProvider(accessTokenProvider: FlowxSdkApi.Companion.AccessTokenProvider) |
setupTheme | Sets up the theme to be used when rendering a process | fun setupTheme(themeUuid: String, fallbackThemeJsonFileAssetsPath: String? = null, @MainThread onCompletion: () -> Unit) |
changeLanguage | Changes the current language | fun changeLanguage(language: String) |
startProcess | Starts a FlowX process instance, by returning a @Composable function where the process is rendered. | fun startProcess(processName: String, params: JSONObject = JSONObject(), isModal: Boolean = false, closeModalFunc: ((processName: String) -> Unit)? = null): @Composable () -> Unit |
continueProcess | Continues an existing FlowX process instance, by returning a @Composable function where the process is rendered. | fun continueProcess(processUuid: String, isModal: Boolean = false, closeModalFunc: ((processName: String) -> Unit)? = null): @Composable () -> Unit |
executeAction | Runs an action from a custom component | fun executeAction(action: CustomComponentAction, params: JSONObject? = null) |
getMediaResourceUrl | Extracts a media item URL needed to populate the UI of a custom component | fun getMediaResourceUrl(key: String): String? |
replaceSubstitutionTag | Extracts a substitution tag value needed to populate the UI of a custom component | fun replaceSubstitutionTag(key: String): String |
init
method in your projectβs application class onCreate()
method:
Name | Description | Type | Requirement |
---|---|---|---|
context | Android application Context | Context | Mandatory |
config | SDK configuration parameters | ai.flowx.android.sdk.process.model.SdkConfig | Mandatory |
accessTokenProvider | Functional interface provider for passing the access token | ai.flowx.android.sdk.FlowxSdkApi.Companion.AccessTokenProvder? | Optional. Defaults to null . |
customComponentsProvider | Provider for the @Composable /View custom components | ai.flowx.android.sdk.component.custom.CustomComponentsProvider? | Optional. Defaults to null . |
customStepperHeaderProvider | Provider for the @Composable custom stepper header view | ai.flowx.android.sdk.component.custom.CustomStepperHeaderProvider? | Optional. Defaults to null . |
access token
is explained in the authentication section.custom components
implementation is explained in its own section.custom view for the header
of the Stepper component is detailed in its own section.
SdkConfig
data for the config
parameter above are:
Name | Description | Type | Requirement |
---|---|---|---|
baseUrl | URL to connect to the FlowX back-end environment | String | Mandatory |
imageBaseUrl | URL to connect to the FlowX Media Library module of the CMS | String | Mandatory |
enginePath | URL path segment used to identify the process engine service | String | Mandatory |
language | The language used for retrieving enumerations and substitution tags | String | Optional. Defaults to en . |
validators | Custom validators for form elements | Map<String, (String) -> Boolean>? | Optional. |
custom validators
map is a collection of lambda functions, referenced by name (i.e. the value of the key
in this map), each returning a Boolean
based on the String
which needs to be validated.
For a custom validator to be evaluated for a form field, its name must be specified in the form field process definition.
"exact_25_in_length"
should be specified in the process definition.ai.flowx.android.sdk.FlowxSdkApi.Companion.AccessTokenProvider
type, which is actually a functional interface defined like this:
setAccessTokenProvider
method again.access token provider
was set.suspend
-ing setupTheme(...)
method over the singleton instance of the SDK:
Name | Description | Type | Requirement |
---|---|---|---|
themeUuid | UUID string of the theme configured in FlowX Designer | String | Mandatory. Can be empty |
fallbackThemeJsonFileAssetsPath | Android asset relative path to the corresponding JSON file to be used as fallback, in case fetching the theme fails and there is no cached version available | String? | Optional. Defaults to null |
onCompletion | @MainThread invoked closure, called when setting up the theme completes | () -> Unit | Mandatory |
themeUuid
parameter value is empty (""
), no theme will be fetched, and the mechanism will rely only on the fallback file, if set.fallbackThemeJsonFileAssetsPath
parameter value is null
, there will be no fallback mechanism set in place, meaning if fetching the theme fails, the redered process will have no style applied over itβs displayed components.fallbackThemeJsonFileAssetsPath
always search for files under your projectβs assets/
directory, meaning the example parameter value is translated to file://android_asset/theme/a_fallback_theme.json
before being evaluated.changeLanguage
function:
Name | Description | Type | Requirement |
---|---|---|---|
language | The code for the new language | String | Mandatory |
startProcess
function:
Name | Description | Type | Requirement |
---|---|---|---|
processName | The name of the process | String | Mandatory |
params | The starting params for the process, if any | JSONObject | Optional. If omitted, if defaults to JSONObject() |
isModal | Flag indicating whether the process can be closed at anytime by tapping the top-right close button | Boolean | Optional. It defaults to false . |
closeModalFunc | Lambda function where you should handle closing the process when isModal flag is true | ((processName: String) -> Unit)? | Optional. It defaults to null . |
@Composable
returned from the SDK (i.e. it occupies the whole activity screen space).continueProcess
function:
Name | Description | Type | Requirement |
---|---|---|---|
processUuid | The UUID string of the process | String | Mandatory |
isModal | Flag indicating whether the process can be closed at anytime by tapping the top-right close button | Boolean | Optional. It defaults to false . |
closeModalFunc | Lambda function where you should handle closing the process when isModal flag is true | ((processName: String) -> Unit)? | Optional. It defaults to null . |
@Composable
returned from the SDK (i.e. it occupies the whole activity screen space).componentIdentifier
configured in the UI designer.data
to populate the view and actions
available to execute, as described below.
To handle custom components, an implementation of the CustomComponentsProvider
interface should be passed as a parameter when initializing the SDK:
CustomComposableComponent
interface:
CustomComposable
object is an interface defined like this:
data
parameter received in the populateUi(data: Any?)
could be:Boolean
String
java.lang.Number
org.json.JSONObject
org.json.JSONArray
CustomViewComponent
interface:
CustomView
object is an interface defined like this:
data
parameter received in the populateUi(data: Any?)
could be:Boolean
String
java.lang.Number
org.json.JSONObject
org.json.JSONArray
actions
parameter of the populateUi(actions: Map<String, CustomComponentAction>)
method.executeAction
method:
Name | Description | Type | Requirement |
---|---|---|---|
action | Action object extracted from the actions received in the custom component | ai.flowx.android.sdk.component.custom.CustomComponentAction | Mandatory |
params | Parameters needed to execute the action | JSONObject? | Optional. It defaults to null |
key
.
It returns:
key
is valid and foundkey
is valid, but not found@@
)key
.
It returns the URL
string of the media resource, or null
, if not found.
data
to populate its UI, as described below.
To provide a custom header for the Stepper, an implementation of the CustomStepperHeaderProvider
interface should be passed as a parameter when initializing the SDK:
CustomComposableStepperHeader
interface:
ComposableStepperHeader
object is an interface defined like this:
data
parameter received as function argument is an interface defined like this: