AirshipPermissionsManager

@objc(UAPermissionsManager)
public final class AirshipPermissionsManager : NSObject, @unchecked 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.

  • Returns an async stream with status updates for the given permission

    Declaration

    Swift

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

    Parameters

    permission

    The permission.

  • Sets a permission delegate.

    Note

    The delegate will be strongly retained.

    Declaration

    Swift

    @objc
    public func setDelegate(
        _ delegate: 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
    public func checkPermissionStatus(
        _ permission: AirshipPermission
    ) async -> AirshipPermissionStatus

    Parameters

    permission

    The permission.

    completionHandler

    The completion handler.

  • requestPermission(_:) Asynchronous

    Requests a permission.

    Note

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

    Declaration

    Swift

    @objc
    @MainActor
    public 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

    @objc
    @MainActor
    public 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.

    completionHandler

    The completion handler.

  • Requests a permission.

    Declaration

    Swift

    @MainActor
    public 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