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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

#[cfg(feature = "NSString")]
pub type NSUserActivityPersistentIdentifier = NSString;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSUserActivity;

    unsafe impl ClassType for NSUserActivity {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for NSUserActivity {}

extern_methods!(
    unsafe impl NSUserActivity {
        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Init initWithActivityType:)]
        pub unsafe fn initWithActivityType(
            this: Allocated<Self>,
            activity_type: &NSString,
        ) -> Retained<Self>;

        #[deprecated = "Use initWithActivityType: with a specific activity type string"]
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other activityType)]
        pub unsafe fn activityType(&self) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other title)]
        pub unsafe fn title(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[method(setTitle:)]
        pub unsafe fn setTitle(&self, title: Option<&NSString>);

        #[cfg(feature = "NSDictionary")]
        #[method_id(@__retain_semantics Other userInfo)]
        pub unsafe fn userInfo(&self) -> Option<Retained<NSDictionary>>;

        #[cfg(feature = "NSDictionary")]
        #[method(setUserInfo:)]
        pub unsafe fn setUserInfo(&self, user_info: Option<&NSDictionary>);

        #[cfg(feature = "NSDictionary")]
        #[method(addUserInfoEntriesFromDictionary:)]
        pub unsafe fn addUserInfoEntriesFromDictionary(&self, other_dictionary: &NSDictionary);

        #[cfg(all(feature = "NSSet", feature = "NSString"))]
        #[method_id(@__retain_semantics Other requiredUserInfoKeys)]
        pub unsafe fn requiredUserInfoKeys(&self) -> Option<Retained<NSSet<NSString>>>;

        #[cfg(all(feature = "NSSet", feature = "NSString"))]
        #[method(setRequiredUserInfoKeys:)]
        pub unsafe fn setRequiredUserInfoKeys(
            &self,
            required_user_info_keys: Option<&NSSet<NSString>>,
        );

        #[method(needsSave)]
        pub unsafe fn needsSave(&self) -> bool;

        #[method(setNeedsSave:)]
        pub unsafe fn setNeedsSave(&self, needs_save: bool);

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other webpageURL)]
        pub unsafe fn webpageURL(&self) -> Option<Retained<NSURL>>;

        #[cfg(feature = "NSURL")]
        #[method(setWebpageURL:)]
        pub unsafe fn setWebpageURL(&self, webpage_url: Option<&NSURL>);

        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Other referrerURL)]
        pub unsafe fn referrerURL(&self) -> Option<Retained<NSURL>>;

        #[cfg(feature = "NSURL")]
        #[method(setReferrerURL:)]
        pub unsafe fn setReferrerURL(&self, referrer_url: Option<&NSURL>);

        #[cfg(feature = "NSDate")]
        #[method_id(@__retain_semantics Other expirationDate)]
        pub unsafe fn expirationDate(&self) -> Option<Retained<NSDate>>;

        #[cfg(feature = "NSDate")]
        #[method(setExpirationDate:)]
        pub unsafe fn setExpirationDate(&self, expiration_date: Option<&NSDate>);

        #[cfg(all(feature = "NSSet", feature = "NSString"))]
        #[method_id(@__retain_semantics Other keywords)]
        pub unsafe fn keywords(&self) -> Retained<NSSet<NSString>>;

        #[cfg(all(feature = "NSSet", feature = "NSString"))]
        #[method(setKeywords:)]
        pub unsafe fn setKeywords(&self, keywords: &NSSet<NSString>);

        #[method(supportsContinuationStreams)]
        pub unsafe fn supportsContinuationStreams(&self) -> bool;

        #[method(setSupportsContinuationStreams:)]
        pub unsafe fn setSupportsContinuationStreams(&self, supports_continuation_streams: bool);

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn NSUserActivityDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn NSUserActivityDelegate>>,
        );

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other targetContentIdentifier)]
        pub unsafe fn targetContentIdentifier(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[method(setTargetContentIdentifier:)]
        pub unsafe fn setTargetContentIdentifier(
            &self,
            target_content_identifier: Option<&NSString>,
        );

        #[method(becomeCurrent)]
        pub unsafe fn becomeCurrent(&self);

        #[method(resignCurrent)]
        pub unsafe fn resignCurrent(&self);

        #[method(invalidate)]
        pub unsafe fn invalidate(&self);

        #[cfg(all(feature = "NSError", feature = "NSStream", feature = "block2"))]
        #[method(getContinuationStreamsWithCompletionHandler:)]
        pub unsafe fn getContinuationStreamsWithCompletionHandler(
            &self,
            completion_handler: &block2::Block<
                dyn Fn(*mut NSInputStream, *mut NSOutputStream, *mut NSError),
            >,
        );

        #[method(isEligibleForHandoff)]
        pub unsafe fn isEligibleForHandoff(&self) -> bool;

        #[method(setEligibleForHandoff:)]
        pub unsafe fn setEligibleForHandoff(&self, eligible_for_handoff: bool);

        #[method(isEligibleForSearch)]
        pub unsafe fn isEligibleForSearch(&self) -> bool;

        #[method(setEligibleForSearch:)]
        pub unsafe fn setEligibleForSearch(&self, eligible_for_search: bool);

        #[method(isEligibleForPublicIndexing)]
        pub unsafe fn isEligibleForPublicIndexing(&self) -> bool;

        #[method(setEligibleForPublicIndexing:)]
        pub unsafe fn setEligibleForPublicIndexing(&self, eligible_for_public_indexing: bool);

        #[method(isEligibleForPrediction)]
        pub unsafe fn isEligibleForPrediction(&self) -> bool;

        #[method(setEligibleForPrediction:)]
        pub unsafe fn setEligibleForPrediction(&self, eligible_for_prediction: bool);

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other persistentIdentifier)]
        pub unsafe fn persistentIdentifier(
            &self,
        ) -> Option<Retained<NSUserActivityPersistentIdentifier>>;

        #[cfg(feature = "NSString")]
        #[method(setPersistentIdentifier:)]
        pub unsafe fn setPersistentIdentifier(
            &self,
            persistent_identifier: Option<&NSUserActivityPersistentIdentifier>,
        );

        #[cfg(all(feature = "NSArray", feature = "NSString", feature = "block2"))]
        #[method(deleteSavedUserActivitiesWithPersistentIdentifiers:completionHandler:)]
        pub unsafe fn deleteSavedUserActivitiesWithPersistentIdentifiers_completionHandler(
            persistent_identifiers: &NSArray<NSUserActivityPersistentIdentifier>,
            handler: &block2::Block<dyn Fn()>,
        );

        #[cfg(feature = "block2")]
        #[method(deleteAllSavedUserActivitiesWithCompletionHandler:)]
        pub unsafe fn deleteAllSavedUserActivitiesWithCompletionHandler(
            handler: &block2::Block<dyn Fn()>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSUserActivity {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern "C" {
    #[cfg(feature = "NSString")]
    pub static NSUserActivityTypeBrowsingWeb: &'static NSString;
}

extern_protocol!(
    pub unsafe trait NSUserActivityDelegate: NSObjectProtocol {
        #[optional]
        #[method(userActivityWillSave:)]
        unsafe fn userActivityWillSave(&self, user_activity: &NSUserActivity);

        #[optional]
        #[method(userActivityWasContinued:)]
        unsafe fn userActivityWasContinued(&self, user_activity: &NSUserActivity);

        #[cfg(feature = "NSStream")]
        #[optional]
        #[method(userActivity:didReceiveInputStream:outputStream:)]
        unsafe fn userActivity_didReceiveInputStream_outputStream(
            &self,
            user_activity: &NSUserActivity,
            input_stream: &NSInputStream,
            output_stream: &NSOutputStream,
        );
    }

    unsafe impl ProtocolType for dyn NSUserActivityDelegate {}
);