GrantFlow
class GrantFlow
A DSL builder for orchestrating sequential multi-permission flows.
While GrantGroupHandler requests permissions concurrently in a batch, GrantFlow allows you to define complex, step-by-step logic where the outcome of one permission dictates the next step.
Usage Example
val permissionFlow = grantFlow {
val cameraStatus = cameraHandler.requestSuspend(
rationaleMessage = "Camera is needed first."
)
if (cameraStatus == GrantStatus.GRANTED) {
// Only ask for Location if Camera was granted
locationHandler.requestSuspend(
rationaleMessage = "Now we need location to tag your photos."
)
}
}
// Later, execute the flow
scope.launch {
permissionFlow.execute()
}Content copied to clipboard