Skip to content

[#48] As a developer, I can request permission in Compose#63

Open
thawzintoe-ptut wants to merge 1 commit intodevelopfrom
feature/48-as-a-developer-i-can-request-permission-in-compose
Open

[#48] As a developer, I can request permission in Compose#63
thawzintoe-ptut wants to merge 1 commit intodevelopfrom
feature/48-as-a-developer-i-can-request-permission-in-compose

Conversation

@thawzintoe-ptut
Copy link

#48

What happened 👀

This PR adds Jetpack Compose support to the library and introduces permission handling utilities for Compose apps.

Changes:

  • Added Compose dependencies (Compose BOM, Runtime, Runtime Saveable)
  • Added Accompanist Permissions library
  • Created PermissionExt.kt with three main utilities:
    • PermissionsHandler - Data class to manage permission state
    • rememberPermissionHandler() - Composable to handle single permissions
    • HandlePermissionsRequest() - Composable wrapper for permission flows
  • Included permanent denial detection logic
  • Added comprehensive unit tests for PermissionsHandler data class
  • Updated Gradle dependencies and enabled Compose compiler plugin

Insight 📝

Why this approach:

The permission utilities wrap Accompanist's permission APIs with a cleaner interface. The key addition is permanent denial detection - tracking when users select "Don't ask again" on Android. This state isn't directly provided by the system, so we track the transition from showing rationale to not showing rationale while the permission remains denied.

Implementation details:

  1. rememberPermanentDenialTracking() uses rememberSaveable to persist state across configuration changes and detects the rationale → no rationale transition
  2. PermissionsHandler is an @Immutable data class for predictable Compose recomposition
  3. The openSettings function uses the existing getAppSettingsIntent() extension from ContextExt.kt

Related:

Proof Of Work 📹

Note

I didn't add POC codes in this PR.

Screen_recording_20260113_094931.webm

@thawzintoe-ptut thawzintoe-ptut self-assigned this Jan 13, 2026
@thawzintoe-ptut thawzintoe-ptut marked this pull request as ready for review January 13, 2026 02:52
@github-actions
Copy link

2 Warnings
⚠️ Uh oh! PermissionExt.kt is under 95% coverage!
⚠️ Uh oh! Your project is under 80% coverage!

Kover report for Android Common Extensions

🧛 Android Common Extensions Unit Tests Code Coverage: 41.93%

Coverage of Modified Files:

File Coverage
PermissionExt.kt 14.00%

Modified Files Not Found In Coverage Report:

PermissionExtTest.kt
build.gradle.kts
libs.versions.toml

Codebase cunningly covered by count Shroud 🧛

Generated by 🚫 Danger

@RkNaing
Copy link
Contributor

RkNaing commented Jan 13, 2026

Hi @thawzintoe-ptut 👋 , IMHO, it would be nice to place the implementation under package co.nimblehq.common.compose.permission. CC: @hoangnguyen92dn 🙇

co.nimblehq.common
├── compose
│   └── permission
│
└── extensions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants