AirshipPermissionsManager

public protocol AirshipPermissionsManager : Sendable

Airship permissions manager.

Airship will provide the default handling for Permission.postNotifications. All other permissions will need to be configured by the app by providing a PermissionDelegate for the given permissions.

  • The set of permissions that have a configured delegate.

    Declaration

    Swift

    var configuredPermissions: Set<AirshipPermission> { get }
  • Returns an async stream with status updates for the given permission

    Declaration

    Swift

    func statusUpdate(
        for permission: AirshipPermission
    ) -> AsyncStream<AirshipPermissionStatus>

    Parameters

    permission

    The permission.

  • Sets a permission delegate.

    Note

    The delegate will be strongly retained.

    Declaration

    Swift

    func setDelegate(
        _ delegate: (any AirshipPermissionDelegate)?,
        permission: AirshipPermission
    )

    Parameters

    delegate

    The delegate.

    permission

    The permission.

  • Checks a permission status.

    Note

    If no delegate is set for the given permission this will always return .notDetermined.

    Declaration

    Swift

    @MainActor
    func checkPermissionStatus(
        _ permission: AirshipPermission
    ) async -> AirshipPermissionStatus

    Parameters

    permission

    The permission.

  • requestPermission(_:) Asynchronous

    Requests a permission.

    Note

    If no permission delegate is set for the given permission this will always return .notDetermined

    Declaration

    Swift

    @MainActor
    func requestPermission(
        _ permission: AirshipPermission
    ) async -> AirshipPermissionStatus

    Parameters

    permission

    The permission.

  • Requests a permission.

    Note

    If no permission delegate is set for the given permission this will always return .notDetermined

    Declaration

    Swift

    @MainActor
    func requestPermission(
        _ permission: AirshipPermission,
        enableAirshipUsageOnGrant: Bool
    ) async -> AirshipPermissionStatus

    Parameters

    permission

    The permission.

    enableAirshipUsageOnGrant

    true to allow any Airship features that need the permission to be enabled as well, e.g., enabling push privacy manager feature and user notifications if .displayNotifications is granted.

  • Requests a permission.

    Declaration

    Swift

    @MainActor
    func requestPermission(
        _ permission: AirshipPermission,
        enableAirshipUsageOnGrant: Bool,
        fallback: PromptPermissionFallback
    ) async -> AirshipPermissionResult

    Parameters

    permission

    The permission.

    enableAirshipUsageOnGrant

    true to allow any Airship features that need the permission to be enabled as well, e.g., enabling push privacy manager feature and user notifications if .displayNotifications is granted.

    fallback

    The fallback behavior if the permission is alreay denied.

    Return Value

    A AirshipPermissionResult with the starting and ending status If no permission delegate is set for the given permission the status will be .notDetermined