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
56unsafe impl NSCoding for UIActivityCollaborationModeRestriction {}
57
58unsafe impl NSCopying for UIActivityCollaborationModeRestriction {}
59
60unsafe impl CopyingHelper for UIActivityCollaborationModeRestriction {
61    type Result = Self;
62}
63
64unsafe impl NSObjectProtocol for UIActivityCollaborationModeRestriction {}
65
66unsafe impl NSSecureCoding for UIActivityCollaborationModeRestriction {}
67
68impl UIActivityCollaborationModeRestriction {
69    extern_methods!(
70        /// The type of sharing which should be disabled
71        #[unsafe(method(disabledMode))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn disabledMode(&self) -> UIActivityCollaborationMode;
74
75        /// The title of the alert if a reason for disabling is provided
76        #[unsafe(method(alertTitle))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn alertTitle(&self) -> Option<Retained<NSString>>;
79
80        /// The message of the alert if a reason for disabling is provided
81        #[unsafe(method(alertMessage))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn alertMessage(&self) -> Option<Retained<NSString>>;
84
85        /// The label on the alert button which will simply confirm that the alert was viewed and dismiss it
86        /// Defaults to "OK"
87        #[unsafe(method(alertDismissButtonTitle))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn alertDismissButtonTitle(&self) -> Option<Retained<NSString>>;
90
91        /// The label on the recovery suggestion button if it is provided
92        #[unsafe(method(alertRecoverySuggestionButtonTitle))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn alertRecoverySuggestionButtonTitle(&self) -> Option<Retained<NSString>>;
95
96        /// On tapping the recovery suggestion button (if it is provided), the user will be launched to this URL
97        #[unsafe(method(alertRecoverySuggestionButtonLaunchURL))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn alertRecoverySuggestionButtonLaunchURL(&self) -> Option<Retained<NSURL>>;
100
101        /// - Parameters:
102        /// - disabledMode: The disabled type of sharing
103        #[unsafe(method(initWithDisabledMode:))]
104        #[unsafe(method_family = init)]
105        pub unsafe fn initWithDisabledMode(
106            this: Allocated<Self>,
107            disabled_mode: UIActivityCollaborationMode,
108        ) -> Retained<Self>;
109
110        /// - Parameters:
111        /// - disabledMode: The disabled type of sharing
112        /// - alertTitle: The alert title
113        /// - alertMessage: The alert message
114        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:))]
115        #[unsafe(method_family = init)]
116        pub unsafe fn initWithDisabledMode_alertTitle_alertMessage(
117            this: Allocated<Self>,
118            disabled_mode: UIActivityCollaborationMode,
119            alert_title: &NSString,
120            alert_message: &NSString,
121        ) -> Retained<Self>;
122
123        /// - Parameters:
124        /// - disabledMode: The disabled type of sharing
125        /// - alertTitle: The alert title
126        /// - alertMessage: The alert message
127        /// - alertDismissButtonTitle: The label on the default alert button
128        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:alertDismissButtonTitle:))]
129        #[unsafe(method_family = init)]
130        pub unsafe fn initWithDisabledMode_alertTitle_alertMessage_alertDismissButtonTitle(
131            this: Allocated<Self>,
132            disabled_mode: UIActivityCollaborationMode,
133            alert_title: &NSString,
134            alert_message: &NSString,
135            alert_dismiss_button_title: &NSString,
136        ) -> Retained<Self>;
137
138        /// - Parameters:
139        /// - disabledMode: The disabled type of sharing
140        /// - alertTitle: The alert title
141        /// - alertMessage: The alert message
142        /// - alertDismissButtonTitle: The label on the default alert button
143        /// - alertRecoverySuggestionButtonTitle: The label on the optional recovery suggestion button on the alert
144        /// - alertRecoverySuggestionButtonLaunchURL: The URL which launches when the optional recovery suggestion button is tapped
145        #[unsafe(method(initWithDisabledMode:alertTitle:alertMessage:alertDismissButtonTitle:alertRecoverySuggestionButtonTitle:alertRecoverySuggestionButtonLaunchURL:))]
146        #[unsafe(method_family = init)]
147        pub unsafe fn initWithDisabledMode_alertTitle_alertMessage_alertDismissButtonTitle_alertRecoverySuggestionButtonTitle_alertRecoverySuggestionButtonLaunchURL(
148            this: Allocated<Self>,
149            disabled_mode: UIActivityCollaborationMode,
150            alert_title: &NSString,
151            alert_message: &NSString,
152            alert_dismiss_button_title: &NSString,
153            alert_recovery_suggestion_button_title: &NSString,
154            alert_recovery_suggestion_button_launch_url: &NSURL,
155        ) -> Retained<Self>;
156
157        #[unsafe(method(init))]
158        #[unsafe(method_family = init)]
159        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
160
161        #[unsafe(method(new))]
162        #[unsafe(method_family = new)]
163        pub unsafe fn new() -> Retained<Self>;
164
165        #[unsafe(method(description))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn description(&self) -> Retained<NSString>;
168    );
169}