Skip to content

Repository files navigation

AugmentedPermissions

API Maven Central Version Build GitHub License

Augmented Permissions is a higher-level permission API for Jetpack Compose, built on Accompanist Permissions.

Its primary motivation is closing a gap in both Android's stock permission API and Accompanist Permissions: neither provides an unambiguous way to react when launching a permission request is suppressed and no system dialog appears. Augmented Permissions addresses this by combining Android's rationale state with persisted request history. This allows a PermissionState to distinguish an initial request from one that has already been made and is now considered suppressed. Applications remain responsible for persisting the request history for each permission requirement through PermissionRequestHistory, keeping the library independent of any particular storage solution.

val permissionState = rememberPermissionState(
    permission = Manifest.permission.CAMERA,
    requestHistory = cameraPermissionHistory,
    onRequestSuppressed = { openAppSettings() }
)

permissionState.launchRequest()

Beyond suppression handling, Augmented Permissions provides a few additional conveniences:

  • a unified PermissionState for single and multiple permissions
  • a consistent isGranted, shouldShowRationale, and revokedPermissions API
  • isLaunchingSuppressed for inspecting suppression state directly
  • grantedFromRequest as a SharedFlow, allowing multiple consumers to independently react to permission-request results
  • no Accompanist types in the public API

Installation

Inline

dependencies {
    implementation("io.github.w2sv:augmented-permissions:<version>")
}

Version Catalog (libs.versions.toml)

[versions]
w2sv-augmented-permissions = "<version>"

[libraries]
w2sv-augmented-permissions = { module = "io.github.w2sv:augmented-permissions", version.ref = "w2sv-augmented-permissions" }

Then add the alias:

dependencies {
    implementation(libs.w2sv.augmented.permissions)
}

License

Licensed under the Apache License 2.0.

About

Augmented Jetpack Compose permission handling and API surface

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages