Permission management for Dala plugins.
Provides a unified interface for requesting and checking permissions across iOS and Android. Maps permission atoms to platform-specific permission strings and handles runtime request flows.
Supported Permissions
:camera— Camera access:microphone— Microphone access:bluetooth— Bluetooth access:location— Location services:storage— File/storage access:photos— Photo library access:contacts— Contacts access:notifications— Push notifications
Usage
# Request a permission at runtime
Dala.Permissions.request(socket, :camera)
# Check if a permission is granted
Dala.Permissions.check(:camera)
# Get all supported permissions
Dala.Permissions.supported_permissions()
Summary
Functions
Returns the Android permission string.
Checks if a permission is currently granted. Returns :granted or :denied.
Returns the iOS plist key for a permission.
Returns the platform-specific permission string.
Requests a permission. Sends {:permission_result, permission, result} to pid.
Checks if a permission is supported.
Returns all supported permissions.
Validates permissions, returning :ok or {:error, {:unsupported, [permissions]}}.
Types
Functions
@spec android_permission(permission()) :: String.t() | nil
Returns the Android permission string.
@spec check(permission()) :: :granted | :denied
Checks if a permission is currently granted. Returns :granted or :denied.
@spec ios_plist_key(permission()) :: String.t() | nil
Returns the iOS plist key for a permission.
@spec permission_string(permission()) :: String.t()
Returns the platform-specific permission string.
@spec request(pid(), permission()) :: :ok | {:error, term()}
Requests a permission. Sends {:permission_result, permission, result} to pid.
@spec supported?(permission()) :: boolean()
Checks if a permission is supported.
@spec supported_permissions() :: [permission()]
Returns all supported permissions.
@spec validate_permissions([permission()]) :: :ok | {:error, term()}
Validates permissions, returning :ok or {:error, {:unsupported, [permissions]}}.