5
5
//! must be checked so that the user can be directed to approve the launch
6
6
//! daemon in the system settings.
7
7
8
- use objc:: { class, msg_send, sel, sel_impl} ;
8
+ use libc:: c_longlong;
9
+ use objc2:: { class, msg_send, runtime:: AnyObject , Encode , Encoding , RefEncode } ;
9
10
use std:: ffi:: CStr ;
10
11
11
- type Id = * mut objc :: runtime :: Object ;
12
+ type Id = * mut AnyObject ;
12
13
13
14
// Framework that contains `SMAppService`.
14
15
#[ link( name = "ServiceManagement" , kind = "framework" ) ]
@@ -18,18 +19,23 @@ extern "C" {}
18
19
#[ repr( C ) ]
19
20
#[ derive( Debug ) ]
20
21
struct NSOperatingSystemVersion {
21
- major_version : libc :: c_longlong ,
22
- minor_version : libc :: c_longlong ,
23
- patch_version : libc :: c_longlong ,
22
+ major_version : c_longlong ,
23
+ minor_version : c_longlong ,
24
+ patch_version : c_longlong ,
24
25
}
25
26
26
- /// Implement Objective-C type encoding for the struct. Allows the `objc ` crate
27
+ /// Implement Objective-C type encoding for the struct. Allows the `objc2 ` crate
27
28
/// to perform function signature matching before performing calls into the Objective-C
28
- /// runtime. This is needed to be able to enable the `verify_message` feature on `objc`.
29
- unsafe impl objc:: Encode for NSOperatingSystemVersion {
30
- fn encode ( ) -> objc:: Encoding {
31
- unsafe { objc:: Encoding :: from_str ( "{?=qqq}" ) }
32
- }
29
+ /// runtime.
30
+ unsafe impl Encode for NSOperatingSystemVersion {
31
+ const ENCODING : Encoding = Encoding :: Struct (
32
+ "NSOperatingSystemVersion" ,
33
+ & [ Encoding :: LongLong , Encoding :: LongLong , Encoding :: LongLong ] ,
34
+ ) ;
35
+ }
36
+
37
+ unsafe impl RefEncode for NSOperatingSystemVersion {
38
+ const ENCODING_REF : Encoding = Encoding :: Pointer ( & Self :: ENCODING ) ;
33
39
}
34
40
35
41
/// Authorization status of the Mullvad daemon.
0 commit comments