objc2_local_authentication_embedded_ui/generated/
LAAuthenticationView.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-app-kit")]
6#[cfg(target_os = "macos")]
7use objc2_app_kit::*;
8use objc2_foundation::*;
9use objc2_local_authentication::*;
10
11use crate::*;
12
13extern_class!(
14    /// Compact authentication view providing authentication similar to
15    /// `LAContext`evaluatePolicy API.
16    ///
17    /// This view is non-textual, it displays only a compact icon hinting
18    /// users to use Touch ID or Watch to authenticate. The reason for the
19    /// authentication must be apparent from the surrounding UI to avoid confusion and
20    /// security risks.
21    ///
22    /// See also [Apple's documentation](https://developer.apple.com/documentation/localauthenticationembeddedui/laauthenticationview?language=objc)
23    #[unsafe(super(NSView, NSResponder, NSObject))]
24    #[derive(Debug, PartialEq, Eq, Hash)]
25    #[cfg(feature = "objc2-app-kit")]
26    #[cfg(target_os = "macos")]
27    pub struct LAAuthenticationView;
28);
29
30#[cfg(feature = "objc2-app-kit")]
31#[cfg(target_os = "macos")]
32extern_conformance!(
33    unsafe impl NSAccessibility for LAAuthenticationView {}
34);
35
36#[cfg(feature = "objc2-app-kit")]
37#[cfg(target_os = "macos")]
38extern_conformance!(
39    unsafe impl NSAccessibilityElementProtocol for LAAuthenticationView {}
40);
41
42#[cfg(feature = "objc2-app-kit")]
43#[cfg(target_os = "macos")]
44extern_conformance!(
45    unsafe impl NSAnimatablePropertyContainer for LAAuthenticationView {}
46);
47
48#[cfg(feature = "objc2-app-kit")]
49#[cfg(target_os = "macos")]
50extern_conformance!(
51    unsafe impl NSAppearanceCustomization for LAAuthenticationView {}
52);
53
54#[cfg(feature = "objc2-app-kit")]
55#[cfg(target_os = "macos")]
56extern_conformance!(
57    unsafe impl NSCoding for LAAuthenticationView {}
58);
59
60#[cfg(feature = "objc2-app-kit")]
61#[cfg(target_os = "macos")]
62extern_conformance!(
63    unsafe impl NSDraggingDestination for LAAuthenticationView {}
64);
65
66#[cfg(feature = "objc2-app-kit")]
67#[cfg(target_os = "macos")]
68extern_conformance!(
69    unsafe impl NSObjectProtocol for LAAuthenticationView {}
70);
71
72#[cfg(feature = "objc2-app-kit")]
73#[cfg(target_os = "macos")]
74extern_conformance!(
75    unsafe impl NSUserInterfaceItemIdentification for LAAuthenticationView {}
76);
77
78#[cfg(feature = "objc2-app-kit")]
79#[cfg(target_os = "macos")]
80impl LAAuthenticationView {
81    extern_methods!(
82        #[unsafe(method(initWithFrame:))]
83        #[unsafe(method_family = init)]
84        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
85
86        /// # Safety
87        ///
88        /// `coder` possibly has further requirements.
89        #[unsafe(method(initWithCoder:))]
90        #[unsafe(method_family = init)]
91        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
92
93        /// Creates a new view and pairs it with the specified authentication context.
94        ///
95        /// The authentication is controlled using the provided authentication
96        /// context. When `evaluatePolicy` or `evaluateAccessControl` is called on this
97        /// context, the UI will be presented using this view rather than using the standard
98        /// authentication alert.
99        /// Since the view is designed for authentication with Touch ID or Watch
100        /// the only supported policies for calling `evaluatePolicy` on the context are
101        /// - `LAPolicyDeviceOwnerAuthenticationWithBiometrics`
102        /// - `LAPolicyDeviceOwnerAuthenticationWithCompanion`
103        /// - `LAPolicyDeviceOwnerAuthenticationWitchBiometricsOrCompanion`
104        /// - `LAPolicyDeviceOwnerAuthentication` (This one is supported just for convenience. If neither biometric nor watch authentication is available, the evaluation of the policy fails)
105        ///
106        /// Parameter `context`: `LAContext`instance to control the authentication.
107        #[unsafe(method(initWithContext:))]
108        #[unsafe(method_family = init)]
109        pub unsafe fn initWithContext(this: Allocated<Self>, context: &LAContext)
110            -> Retained<Self>;
111
112        /// Creates a new view and pairs it with the specified authentication context.
113        ///
114        /// The authentication is controlled using the provided authentication
115        /// context. When `evaluatePolicy` or `evaluateAccessControl` is called on this
116        /// context, the UI will be presented using this view rather than using the standard
117        /// authentication alert.
118        /// Since the view is designed for authentication with Touch ID or Watch
119        /// the only supported policies for calling `evaluatePolicy` on the context are
120        /// - `LAPolicyDeviceOwnerAuthenticationWithBiometrics`
121        /// - `LAPolicyDeviceOwnerAuthenticationWithCompanion`
122        /// - `LAPolicyDeviceOwnerAuthenticationWitchBiometricsOrCompanion`
123        /// - `LAPolicyDeviceOwnerAuthentication` (This one is supported just for convenience. If neither biometric nor watch authentication is available, the evaluation of the policy fails)
124        ///
125        /// Parameter `context`: `LAContext`instance to control the authentication.
126        ///
127        /// Parameter `controlSize`: Preferred size of
128        /// `LAAuthenticationView`provided using
129        /// `NSControlSize`
130        #[unsafe(method(initWithContext:controlSize:))]
131        #[unsafe(method_family = init)]
132        pub unsafe fn initWithContext_controlSize(
133            this: Allocated<Self>,
134            context: &LAContext,
135            control_size: NSControlSize,
136        ) -> Retained<Self>;
137
138        /// `LAContext`instance passed to the initializer.
139        #[unsafe(method(context))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn context(&self) -> Retained<LAContext>;
142
143        /// `NSControlSize`instance passed to the initializer.
144        #[unsafe(method(controlSize))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn controlSize(&self) -> NSControlSize;
147    );
148}
149
150/// Methods declared on superclass `NSResponder`.
151#[cfg(feature = "objc2-app-kit")]
152#[cfg(target_os = "macos")]
153impl LAAuthenticationView {
154    extern_methods!(
155        #[unsafe(method(init))]
156        #[unsafe(method_family = init)]
157        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
158    );
159}
160
161/// Methods declared on superclass `NSObject`.
162#[cfg(feature = "objc2-app-kit")]
163#[cfg(target_os = "macos")]
164impl LAAuthenticationView {
165    extern_methods!(
166        #[unsafe(method(new))]
167        #[unsafe(method_family = new)]
168        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
169    );
170}