objc2_local_authentication/generated/
LAEnvironment.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
7use crate::*;
8
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/localauthentication/laenvironment?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct LAEnvironment;
14);
15
16extern_conformance!(
17    unsafe impl NSObjectProtocol for LAEnvironment {}
18);
19
20impl LAEnvironment {
21    extern_methods!(
22        /// The clients should use
23        /// `currentUser`class property.
24        #[unsafe(method(new))]
25        #[unsafe(method_family = new)]
26        pub unsafe fn new() -> Retained<Self>;
27
28        /// The clients should use
29        /// `currentUser`class property.
30        #[unsafe(method(init))]
31        #[unsafe(method_family = init)]
32        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
33
34        /// Adds observer to monitor changes of the environment.
35        ///
36        /// The observer will be held weakly so its instance should be kept alive by the caller.
37        #[unsafe(method(addObserver:))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn addObserver(&self, observer: &ProtocolObject<dyn LAEnvironmentObserver>);
40
41        /// Removes the previously registered observer.
42        ///
43        /// If the observer is deallocated, it will be removed automatically.
44        #[unsafe(method(removeObserver:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn removeObserver(&self, observer: &ProtocolObject<dyn LAEnvironmentObserver>);
47
48        /// Environment of the current user.
49        #[unsafe(method(currentUser))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn currentUser() -> Retained<LAEnvironment>;
52
53        #[cfg(feature = "LAEnvironmentState")]
54        /// The environment state information.
55        #[unsafe(method(state))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn state(&self) -> Retained<LAEnvironmentState>;
58    );
59}
60
61extern_protocol!(
62    /// [Apple's documentation](https://developer.apple.com/documentation/localauthentication/laenvironmentobserver?language=objc)
63    pub unsafe trait LAEnvironmentObserver: NSObjectProtocol {
64        #[cfg(feature = "LAEnvironmentState")]
65        /// Called when there has been a change in the environment.
66        ///
67        /// Invoked on a queue private to LocalAuthentication framework. At the moment of invocation of this method,
68        /// `LAEnvironment.state`already contains the new updated state.
69        ///
70        /// Parameter `oldState`: The old environment state (before update)
71        #[optional]
72        #[unsafe(method(environment:stateDidChangeFromOldState:))]
73        #[unsafe(method_family = none)]
74        unsafe fn environment_stateDidChangeFromOldState(
75            &self,
76            environment: &LAEnvironment,
77            old_state: &LAEnvironmentState,
78        );
79    }
80);