Skip to content

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

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

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

Conversation

@thawzintoe-ptut
Copy link
Copy Markdown

#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
Copy Markdown

github-actions bot commented Jan 13, 2026

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.67%

Coverage of Modified Files:

File Coverage
PermissionExt.kt 13.46%

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
Copy Markdown
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

Copy link
Copy Markdown
Collaborator

@hoangnguyen92dn hoangnguyen92dn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thawzintoe-ptut Please add sample usage of permission in :app model, if the code changes requires adding a lot of file changes, you could open part 2 instead.

@thawzintoe-ptut thawzintoe-ptut force-pushed the feature/48-as-a-developer-i-can-request-permission-in-compose branch from 07638db to 65d0c97 Compare March 19, 2026 08:39
@thawzintoe-ptut thawzintoe-ptut changed the title [#48] As a developer, I can request permission in Compose [#48] [Part-1] As a developer, I can request permission in Compose Mar 19, 2026
@thawzintoe-ptut thawzintoe-ptut force-pushed the feature/48-as-a-developer-i-can-request-permission-in-compose branch from 65d0c97 to fbbd521 Compare March 19, 2026 08:50
@thawzintoe-ptut
Copy link
Copy Markdown
Author

updated fbbd521. FYI: I will create part-2 for simple usage permission. 🙏

@hoangnguyen92dn hoangnguyen92dn added this to the 0.3.0 milestone Mar 31, 2026
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.

3 participants