Introduction¶
Jetpack Compose allows you to build native UI. It is designed to simplify UI development on Android, allowing you to invest less time in code development. It includes a toolkit and a suite of useful Kotlin APIs.
The SAP BTP SDK for Android version 5.1 introduces new versions of the flows and onboarding screen components, which are implemented with Jetpack Compose to simplify your development efforts.
The compose version has the same functionality as the view-based flows component, which makes the onboarding process much easier and allows you to focus more on the business logic of the client code after onboarding. From a technical perspective, the compose flows component has many enhancements that make it more robust, including simplified APIs to make integration easier.
For developers who are familiar with the view-based flows component, the compose version makes use of the same concepts. For example, FlowContext
is needed to start a flow, FlowOptions
is needed to customize the flow, you use FlowActionHandler
to inject your own logic during the onboarding or restore process, and FlowStateListener
to listen to the states. UserSecureStoreDelegate
is also available after the onboarding or restore flows, so that the client code can query or save data into the user's secure store with it. If you migrate your existing app developed using the view-based flows component to the compose version, the app will still be able to function without losing a user's data.
For developers who are new to the flows component, FlowOptions
lets you customize the onboarding process, for example, selecting which authentication method to use, WebView
or Chrome CustomsTab
, whether to use the predefined EULA screen in the SDK or provide your own, etc. FlowActionHandler
lets you provide your own logic for the onboarding process, for example, how to use the user information on the sign-in screen, inserting custom steps at certain points in the process, etc. FlowStateListener
lets you observe the states during the onboarding process to, for instance, initialize your online OData when AppConfig
is ready. You can put your own FlowOptions
, FlowActionHandler
and FlowStateListener
into your FlowContext
to start a flow.
Installation¶
To use the compose flows component, include the following dependency in your build.gradle
:
dependencies {
implementation group: 'com.sap.cloud.android', name: 'flows-compose', version: sdkVersion
}
Flow Types¶
The compose flows component currently supports the following scenarios (flow types) for implementing onboarding flows, as described below:
sealed class FlowType(val name: String) {
object Onboarding : FlowType(ONBOARDING.name)
object ForgotPasscode : FlowType(FORGET_PASSCODE.name)
object CreateAccount : FlowType(CREATE_ACCOUNT.name)
object Reset : FlowType(RESET.name)
object Restore : FlowType(RESTORE.name)
object ChangePasscode : FlowType(CHANGE_PASSCODE.name)
object TimeoutUnlock : FlowType(TIMEOUT_UNLOCK.name)
object Logout : FlowType(LOGOUT.name)
object DeleteRegistration : FlowType(DELETE_REGISTRATION.name)
}
Note
The FlowType
class has some other flow types that are not listed here, for example, Activation
and Authentication
are used internally by the Onboarding
flow and transparent to the client code.
Some flow types listed here are also used internally and the client code does not need to call them explicitly, for example, CreateAccount
, ForgotPasscode
, and TimeoutUnlock
.
The functionality of each flow type is the same as the view-based flow. See the overview of the new flows for details.