GrantManager

interface GrantManager

Core interface for grant management.

This is the ONLY interface that ViewModels and feature modules should depend on. Implementation details are hidden behind this abstraction.

Design Pattern: Wrapper/Adapter Pattern Benefits:

  • Easy to swap underlying implementation

  • No coupling between business logic and platform-specific code

  • Simplified testing (mock this interface)

See also

DefaultGrantManager

for the default implementation

for ViewModel usage patterns

Inheritors

Functions

Link copied to clipboard
abstract suspend fun checkStatus(grant: GrantPermission): GrantStatus

Checks the current status of a permission WITHOUT showing any UI.

Link copied to clipboard
abstract fun openSettings()

Opens the app's settings page where user can manually enable grants.

Link copied to clipboard
abstract suspend fun request(grant: GrantPermission): GrantStatus

Requests a permission from the user.

abstract suspend fun request(grants: List<GrantPermission>): Map<GrantPermission, GrantStatus>

Request multiple grants from the system at once.

Link copied to clipboard
abstract fun setLauncher(launcher: GrantLauncher)

Set the launcher for permission requests. This must be called from the host activity or fragment.