objc2_ui_kit/generated/
UIActivityCollaborationModeRestriction.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern "C" {
10    /// A key for a collaboration mode restriction, used to specify the case where Share Sheet should not support some modes of sharing even if they are supported by the items being shared
11    /// The object returned for this key should be an array of UIActivityCollaborationModeRestriction instances
12    /// For supported behaviour, this array should have a maximum size of one less than the amount of possible Share Sheet modes
13    /// Currently at most one object should be provided
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactivityitemsconfigurationmetadatakeycollaborationmoderestrictions?language=objc)
16    #[cfg(feature = "UIActivityItemsConfigurationReading")]
17    pub static UIActivityItemsConfigurationMetadataKeyCollaborationModeRestrictions:
18        &'static UIActivityItemsConfigurationMetadataKey;
19}
20
21/// Represents the types of sharing (collaborating on an item vs. sending a copy of the item)
22/// Share Sheet supports up to two modes, each of which corresponds to one of these types
23///
24/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactivitycollaborationmode?language=objc)
25// NS_ENUM
26#[repr(transparent)]
27#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
28pub struct UIActivityCollaborationMode(pub NSInteger);
29impl UIActivityCollaborationMode {
30    #[doc(alias = "UIActivityCollaborationModeSendCopy")]
31    pub const SendCopy: Self = Self(0);
32    #[doc(alias = "UIActivityCollaborationModeCollaborate")]
33    pub const Collaborate: Self = Self(1);
34}
35
36unsafe impl Encode for UIActivityCollaborationMode {
37    const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for UIActivityCollaborationMode {
41    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44extern_class!(
45    /// Specifies whether any types of sharing should be disabled in Share Sheet, and if so, whether they should provide a reason when tapped
46    /// If a reason is provided, the corresponding mode will show up as an option, but an alert explaining why it is disabled will show if it is chosen, and the mode will switch back to the supported one
47    /// Optionally, an extra alert button can be provided for a "recovery suggestion". This can give a user a way to fix whatever is causing this type of sharing to be disabled
48    /// If no reason is provided, the corresponding mode will not show up as an option
49    ///
50    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactivitycollaborationmoderestriction?language=objc)
51    #[unsafe(super(NSObject))]
52    #[derive(Debug, PartialEq, Eq, Hash)]
53    pub struct UIActivityCollaborationModeRestriction;
54);
55
56extern_conformance!(
57    unsafe impl NSCoding for UIActivityCollaborationModeRestriction {}
58);
59
60extern_conformance!(
61    unsafe impl NSCopying for UIActivityCollaborationModeRestriction {}
62);
63
64unsafe impl CopyingHelper for UIActivityCollaborationModeRestriction {
65    type Result = Self;
66}
67
68extern_conformance!(
69    unsafe impl NSObjectProtocol for UIActivityCollaborationModeRestriction {}
70);
71
72extern_conformance!(
73    unsafe impl NSSecureCoding for UIActivityCollaborationModeRestriction {}
74);
75
76impl UIActivityCollaborationModeRestriction {
77    extern_methods!(
78        /// The type of sharing which should be disabled
79        #[unsafe(method(disabledMode))]
80        #[unsafe(method_family = none)]
81        pub fn disabledMode(&self) -> UIActivityCollaborationMode;
82
83        /// The title of the alert if a reason for disabling is provided
84        #[unsafe(method(alertTitle))]
85        #[unsafe(method_family = none)]
86        pub fn alertTitle(&self) -> Option<Retained<NSString>>;
87
88        /// The message of the alert if a reason for disabling is provided
89        #[unsafe(method(alertMessage))]
90        #[unsafe(method_family = none)]
91        pub fn alertMessage(&self) -> Option<Retained<NSString>>;
92
93        /// The label on the alert button which will simply confirm that the alert was viewed and dismiss it
94        /// Defaults to "OK"
95        #[unsafe(method(alertDismissButtonTitle))]
96        #[unsafe(method_family = none)]
97        pub fn alertDismissButtonTitle(&self) -> Option<Retained<NSString>>;
98
99        /// The label on the recovery suggestion button if it is provided
100        #[unsafe(method(alertRecoverySuggestionButtonTitle))]
101        #[unsafe(method_family = none)]
102        pub fn alertRecoverySuggestionButtonTitle(&self) -> Option<Retained<NSString>>;
103
104        /// On tapping the recovery suggestion button (if it is provided), the user will be launched to this URL
105        #[unsafe(method(alertRecoverySuggestionButtonLaunchURL))]
106        #[unsafe(method_family = none)]
107        pub fn alertRecoverySuggestionButtonLaunchURL(&self) -> Option<Retained<NSURL>>;
108
109        /// - Parameters:
110        /// - disabledMode: The disabled type of sharing
111        #[unsafe(method(initWithDisabledMode:))]
112        #[unsafe(method_family = init)]
113        pub fn initWithDisabledMode(
114            this: Allocated<Self>,
115            disabled_mode: UIActivityCollaborationMode,
116        ) -> Retained<Self>;
117
118        /// - Parameters:
119        /// - disabledMode: The disabled type of sharing
120        /// - alertTitle: The alert title
121        /// - alertMessage: The alert message
122        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:))]
123        #[unsafe(method_family = init)]
124        pub fn initWithDisabledMode_alertTitle_alertMessage(
125            this: Allocated<Self>,
126            disabled_mode: UIActivityCollaborationMode,
127            alert_title: &NSString,
128            alert_message: &NSString,
129        ) -> Retained<Self>;
130
131        /// - Parameters:
132        /// - disabledMode: The disabled type of sharing
133        /// - alertTitle: The alert title
134        /// - alertMessage: The alert message
135        /// - alertDismissButtonTitle: The label on the default alert button
136        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:alertDismissButtonTitle:))]
137        #[unsafe(method_family = init)]
138        pub fn initWithDisabledMode_alertTitle_alertMessage_alertDismissButtonTitle(
139            this: Allocated<Self>,
140            disabled_mode: UIActivityCollaborationMode,
141            alert_title: &NSString,
142            alert_message: &NSString,
143            alert_dismiss_button_title: &NSString,
144        ) -> Retained<Self>;
145
146        /// - Parameters:
147        /// - disabledMode: The disabled type of sharing
148        /// - alertTitle: The alert title
149        /// - alertMessage: The alert message
150        /// - alertDismissButtonTitle: The label on the default alert button
151        /// - alertRecoverySuggestionButtonTitle: The label on the optional recovery suggestion button on the alert
152        /// - alertRecoverySuggestionButtonLaunchURL: The URL which launches when the optional recovery suggestion button is tapped
153        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:alertDismissButtonTitle:alertRecoverySuggestionButtonTitle:alertRecoverySuggestionButtonLaunchURL:))]
154        #[unsafe(method_family = init)]
155        pub fn initWithDisabledMode_alertTitle_alertMessage_alertDismissButtonTitle_alertRecoverySuggestionButtonTitle_alertRecoverySuggestionButtonLaunchURL(
156            this: Allocated<Self>,
157            disabled_mode: UIActivityCollaborationMode,
158            alert_title: &NSString,
159            alert_message: &NSString,
160            alert_dismiss_button_title: &NSString,
161            alert_recovery_suggestion_button_title: &NSString,
162            alert_recovery_suggestion_button_launch_url: &NSURL,
163        ) -> Retained<Self>;
164
165        #[unsafe(method(init))]
166        #[unsafe(method_family = init)]
167        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
168
169        #[unsafe(method(new))]
170        #[unsafe(method_family = new)]
171        pub unsafe fn new() -> Retained<Self>;
172
173        #[unsafe(method(description))]
174        #[unsafe(method_family = none)]
175        pub fn description(&self) -> Retained<NSString>;
176    );
177}