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