objc2_shared_with_you/generated/SWHighlightCenter.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::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-shared-with-you-core")]
8use objc2_shared_with_you_core::*;
9
10use crate::*;
11
12extern_protocol!(
13 /// The delegate is notified when there are changes to the list of surfaced highlights, or when the enablement settings change.
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/sharedwithyou/swhighlightcenterdelegate?language=objc)
16 pub unsafe trait SWHighlightCenterDelegate: NSObjectProtocol {
17 /// Notifies the delegate that the list, or rank order of surfaced highlights has changed.
18 ///
19 /// When this method is called, it is the app's responsibility to update any displayed highlights to match the updated list. Only the highlights provided should have an indication of having been shared. If no highlights are provided in the list, any links previously indicated as shared should be removed. The array is a priority-ordered list, where the first element in the array is deemed to be most relevant to the user at the time this method is called. The list of provided highlights will be empty if there are no highlights, or when the user has not given permission for a particular app to display highlights.
20 #[unsafe(method(highlightCenterHighlightsDidChange:))]
21 #[unsafe(method_family = none)]
22 unsafe fn highlightCenterHighlightsDidChange(&self, highlight_center: &SWHighlightCenter);
23 }
24);
25
26extern_class!(
27 /// Provides the application with a priority-ordered list of universal links which have been shared with the current user.
28 ///
29 /// The system decides which links should be surfaced. The app is responsible for updating its UI to reflect the latest provided list.
30 ///
31 /// See also [Apple's documentation](https://developer.apple.com/documentation/sharedwithyou/swhighlightcenter?language=objc)
32 #[unsafe(super(NSObject))]
33 #[derive(Debug, PartialEq, Eq, Hash)]
34 pub struct SWHighlightCenter;
35);
36
37extern_conformance!(
38 unsafe impl NSObjectProtocol for SWHighlightCenter {}
39);
40
41impl SWHighlightCenter {
42 extern_methods!(
43 /// The highlight center's delegate
44 #[unsafe(method(delegate))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn delegate(
47 &self,
48 ) -> Option<Retained<ProtocolObject<dyn SWHighlightCenterDelegate>>>;
49
50 /// This is a [weak property][objc2::topics::weak_property].
51 /// Setter for [`delegate`][Self::delegate].
52 #[unsafe(method(setDelegate:))]
53 #[unsafe(method_family = none)]
54 pub unsafe fn setDelegate(
55 &self,
56 delegate: Option<&ProtocolObject<dyn SWHighlightCenterDelegate>>,
57 );
58
59 #[cfg(feature = "SWHighlight")]
60 #[unsafe(method(highlights))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn highlights(&self) -> Retained<NSArray<SWHighlight>>;
63
64 /// Localized title to display with a collection of highlights
65 ///
66 /// Use this string as the title for a collection of shared highlight links displayed to the user.
67 #[unsafe(method(highlightCollectionTitle))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn highlightCollectionTitle() -> Retained<NSString>;
70
71 /// Whether the current software version has full support for Messages collaboration features.
72 ///
73 /// Use this property at runtime to conditionally enable Messages collaboration features in your app. This property will be permantently set to YES on a software version with full support for these features.
74 #[unsafe(method(isSystemCollaborationSupportAvailable))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn isSystemCollaborationSupportAvailable() -> bool;
77
78 #[cfg(all(feature = "SWHighlight", feature = "block2"))]
79 /// A convenience method to get a SWHighlight for a given URL
80 ///
81 /// Parameter `URL`: The URL used to find the SWHighlight
82 ///
83 /// Parameter `completionHandler`: an SWHighlight if it was fetched. The completion handler will always be invoked on the main queue
84 #[unsafe(method(getHighlightForURL:completionHandler:))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn getHighlightForURL_completionHandler(
87 &self,
88 url: &NSURL,
89 completion_handler: &block2::DynBlock<dyn Fn(*mut SWHighlight, *mut NSError)>,
90 );
91
92 #[cfg(all(
93 feature = "SWCollaborationHighlight",
94 feature = "SWHighlight",
95 feature = "objc2-shared-with-you-core"
96 ))]
97 #[unsafe(method(collaborationHighlightForIdentifier:error:_))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn collaborationHighlightForIdentifier_error(
100 &self,
101 collaboration_identifier: &SWCollaborationIdentifier,
102 ) -> Result<Retained<SWCollaborationHighlight>, Retained<NSError>>;
103
104 #[cfg(all(
105 feature = "SWCollaborationHighlight",
106 feature = "SWHighlight",
107 feature = "block2"
108 ))]
109 /// A convenience method to get an SWCollaborationHighlight for a given URL
110 ///
111 /// Parameter `URL`: The URL used to find the SWCollaborationHighlight
112 ///
113 /// Parameter `completionHandler`: an SWCollaborationHighlight if it was fetched. The completion handler will always be invoked on the main queue
114 #[unsafe(method(getCollaborationHighlightForURL:completionHandler:))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn getCollaborationHighlightForURL_completionHandler(
117 &self,
118 url: &NSURL,
119 completion_handler: &block2::DynBlock<
120 dyn Fn(*mut SWCollaborationHighlight, *mut NSError),
121 >,
122 );
123
124 #[cfg(feature = "SWHighlightEvent")]
125 /// Post a given event to the highlight center for display in Messages.
126 ///
127 /// Parameter `event`: The event to add for a specific highlight
128 #[unsafe(method(postNoticeForHighlightEvent:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn postNoticeForHighlightEvent(
131 &self,
132 event: &ProtocolObject<dyn SWHighlightEvent>,
133 );
134
135 #[cfg(all(feature = "SWCollaborationHighlight", feature = "SWHighlight"))]
136 /// Clear notices for a given collaboration highlight in Messages.
137 ///
138 /// Parameter `highlight`: The highlight to clear notices from.
139 #[unsafe(method(clearNoticesForHighlight:))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn clearNoticesForHighlight(&self, highlight: &SWCollaborationHighlight);
142
143 #[cfg(all(
144 feature = "SWCollaborationHighlight",
145 feature = "SWHighlight",
146 feature = "block2",
147 feature = "objc2-shared-with-you-core"
148 ))]
149 /// Method to sign passed in data with local device's private key
150 ///
151 /// Parameter `data`: NSData that needs to be signed
152 ///
153 /// Parameter `collaborationHighlight`: The corresponding collaboration highlight.
154 ///
155 /// Parameter `completionHandler`: Signed data along with proof of inclusion for merkle if signing succeeded, otherwise an error. The completion handler will always be invoked on main queue
156 #[unsafe(method(getSignedIdentityProofForCollaborationHighlight:usingData:completionHandler:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn getSignedIdentityProofForCollaborationHighlight_usingData_completionHandler(
159 &self,
160 collaboration_highlight: &SWCollaborationHighlight,
161 data: &NSData,
162 completion_handler: &block2::DynBlock<
163 dyn Fn(*mut SWSignedPersonIdentityProof, *mut NSError),
164 >,
165 );
166 );
167}
168
169/// Methods declared on superclass `NSObject`.
170impl SWHighlightCenter {
171 extern_methods!(
172 #[unsafe(method(init))]
173 #[unsafe(method_family = init)]
174 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
175
176 #[unsafe(method(new))]
177 #[unsafe(method_family = new)]
178 pub unsafe fn new() -> Retained<Self>;
179 );
180}