Package 

Class PermissionManager


  • 
    public final class PermissionManager
    
                        

    SPEC-421 — runtime permission manager for onboarding permission steps (Android mirror of the iOS PermissionManager).

    Two responsibilities:

    • status — read the current authorization via ContextCompat.checkSelfPermission. Applies the manifest guard: a type whose runtime permission is NOT declared in the host manifest returns PermissionStatus.UNAVAILABLE (we never launch → the request can't silently no-op). att has no Android equivalent (auto-granted no-op) and notification below API 33 is auto-granted (no runtime permission exists there).

    • request — fire the real OS prompt (via a ActivityResultLauncher bridge registered at composition by the caller) and return whether it was granted.

    The ActivityResultLauncher itself MUST be registered at composition (never lazily at button-tap, which throws IllegalStateException when RESUMED); the caller wires requestLauncher to it and completes the pending request via completePending.

    • Constructor Detail

      • PermissionManager

        PermissionManager(Context context)
    • Method Detail

      • getRequestLauncher

         final Function1<String, Unit> getRequestLauncher()

        Bridge to the composition-registered ActivityResultLauncher. Given a permission string, it launches the OS prompt; the result arrives asynchronously via completePending.

      • setRequestLauncher

         final Unit setRequestLauncher(Function1<String, Unit> requestLauncher)

        Bridge to the composition-registered ActivityResultLauncher. Given a permission string, it launches the OS prompt; the result arrives asynchronously via completePending.

      • request

         final Boolean request(String type)

        Fire the real OS prompt (via the composition-registered launcher) and return whether granted.

        • att → auto-granted no-op (returns true, no launch).

        • notification below API 33 → auto-granted (returns true, no launch).

        • unsupported / no launcher wired → false.

      • openAppSettings

         final Unit openAppSettings()

        Open the app's Settings details page so a permanently-denied permission can be flipped.