objc2_sensitive_content_analysis/generated/
SCSensitivityAnalyzer.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-graphics")]
7use objc2_core_graphics::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// SensitivityAnalysis Policy on device, represents type of interventions when enabled
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/sensitivecontentanalysis/scsensitivityanalysispolicy?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct SCSensitivityAnalysisPolicy(pub NSInteger);
19impl SCSensitivityAnalysisPolicy {
20    /// No feature enabled that is requiring Sensitive Analysis on device, analysis will be disabled
21    #[doc(alias = "SCSensitivityAnalysisPolicyDisabled")]
22    pub const Disabled: Self = Self(0);
23    /// Sensitive Analysis is enabled on device through "Sensitive Content Warning" in Settings.
24    /// It is expected that brief/inline UI, like simple "show" button.
25    #[doc(alias = "SCSensitivityAnalysisPolicySimpleInterventions")]
26    pub const SimpleInterventions: Self = Self(1);
27    /// Sensitive Analysis is enabled for kids or teens in ScreenTime through "Communications Safety" feature.
28    /// It's expected to have more descriptive UI for the user, explaining potential risks.
29    #[doc(alias = "SCSensitivityAnalysisPolicyDescriptiveInterventions")]
30    pub const DescriptiveInterventions: Self = Self(2);
31}
32
33unsafe impl Encode for SCSensitivityAnalysisPolicy {
34    const ENCODING: Encoding = NSInteger::ENCODING;
35}
36
37unsafe impl RefEncode for SCSensitivityAnalysisPolicy {
38    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
39}
40
41extern_class!(
42    /// Main class for content sensitivity analysis
43    ///
44    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensitivecontentanalysis/scsensitivityanalyzer?language=objc)
45    #[unsafe(super(NSObject))]
46    #[derive(Debug, PartialEq, Eq, Hash)]
47    pub struct SCSensitivityAnalyzer;
48);
49
50unsafe impl Send for SCSensitivityAnalyzer {}
51
52unsafe impl Sync for SCSensitivityAnalyzer {}
53
54extern_conformance!(
55    unsafe impl NSObjectProtocol for SCSensitivityAnalyzer {}
56);
57
58impl SCSensitivityAnalyzer {
59    extern_methods!(
60        #[unsafe(method(init))]
61        #[unsafe(method_family = init)]
62        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
63
64        /// Current SCSensitivityAnalysisPolicy set on device. Can be used to determine whether analysis is available or not
65        #[unsafe(method(analysisPolicy))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn analysisPolicy(&self) -> SCSensitivityAnalysisPolicy;
68
69        #[cfg(all(feature = "SCSensitivityAnalysis", feature = "block2"))]
70        /// Analyze sensitivity of Image File on disk (only local fileURL)
71        ///
72        /// Parameter `fileURL`: Image file location on disk
73        ///
74        /// Parameter `completionHandler`: Block to be called on completion (callback is called on unspecified queue)
75        #[unsafe(method(analyzeImageFile:completionHandler:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn analyzeImageFile_completionHandler(
78            &self,
79            file_url: &NSURL,
80            completion_handler: &block2::DynBlock<dyn Fn(*mut SCSensitivityAnalysis, *mut NSError)>,
81        );
82
83        #[cfg(all(
84            feature = "SCSensitivityAnalysis",
85            feature = "block2",
86            feature = "objc2-core-graphics"
87        ))]
88        /// Analyze sensitivity of CGImage in memory
89        ///
90        /// Parameter `image`: CGImage reference
91        ///
92        /// Parameter `completionHandler`: Block to be called on completion (callback is called on unspecified queue)
93        #[unsafe(method(analyzeCGImage:completionHandler:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn analyzeCGImage_completionHandler(
96            &self,
97            image: &CGImage,
98            completion_handler: &block2::DynBlock<dyn Fn(*mut SCSensitivityAnalysis, *mut NSError)>,
99        );
100
101        #[cfg(all(feature = "SCSensitivityAnalysis", feature = "block2"))]
102        /// Analyze sensitivity of Video File on disk.
103        ///
104        /// Parameter `fileURL`: Video file location on disk
105        ///
106        /// Parameter `completionHandler`: Block to be called on completion (callback is called on unspecified queue)
107        ///
108        /// Returns: An NSProgress instance for tracking video file analysis progress
109        #[unsafe(method(analyzeVideoFile:completionHandler:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn analyzeVideoFile_completionHandler(
112            &self,
113            file_url: &NSURL,
114            completion_handler: &block2::DynBlock<dyn Fn(*mut SCSensitivityAnalysis, *mut NSError)>,
115        ) -> Retained<NSProgress>;
116    );
117}
118
119/// Methods declared on superclass `NSObject`.
120impl SCSensitivityAnalyzer {
121    extern_methods!(
122        #[unsafe(method(new))]
123        #[unsafe(method_family = new)]
124        pub unsafe fn new() -> Retained<Self>;
125    );
126}