objc2-media-accessibility 0.3.2

Bindings to the MediaAccessibility framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-foundation")]
use objc2_foundation::*;

use crate::*;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/mamusichapticsmanageractivestatusdidchangenotification?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static MAMusicHapticsManagerActiveStatusDidChangeNotification: &'static NSNotificationName;
}

#[cfg(feature = "objc2")]
extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/mamusichapticsmanager?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct MAMusicHapticsManager;
);

#[cfg(feature = "objc2")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MAMusicHapticsManager {}
);

#[cfg(feature = "objc2")]
impl MAMusicHapticsManager {
    extern_methods!(
        #[unsafe(method(sharedManager))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharedManager() -> Retained<MAMusicHapticsManager>;

        /// Whether the user setting to indicate Music Haptics are currently active.
        ///
        /// Returns: A boolean result.
        #[unsafe(method(isActive))]
        #[unsafe(method_family = none)]
        pub unsafe fn isActive(&self) -> bool;

        #[cfg(all(feature = "block2", feature = "objc2-foundation"))]
        /// In an asynchronous completion handler, returns whether a specific media track with the supplied
        /// ISRC has an available haptic track.
        ///
        /// # Safety
        ///
        /// `completion_handler` block must be sendable.
        #[unsafe(method(checkHapticTrackAvailabilityForMediaMatchingCode:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn checkHapticTrackAvailabilityForMediaMatchingCode_completionHandler(
            &self,
            international_standard_recording_code: &NSString,
            completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
        );

        #[cfg(all(feature = "block2", feature = "objc2-foundation"))]
        /// Determine the status of haptic playback for the now playing track asynchronously. This will only be delivered for the app that is the active Now Playing app.
        #[unsafe(method(addStatusObserver:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addStatusObserver(
            &self,
            status_handler: &block2::DynBlock<dyn Fn(NonNull<NSString>, Bool)>,
        ) -> Option<Retained<ProtocolObject<dyn NSCopying>>>;

        #[cfg(feature = "objc2-foundation")]
        /// # Safety
        ///
        /// `registration_token` should be of the correct type.
        #[unsafe(method(removeStatusObserver:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeStatusObserver(
            &self,
            registration_token: &ProtocolObject<dyn NSCopying>,
        );

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}