objc2_app_clip/generated/APActivationPayload.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::*;
6#[cfg(feature = "objc2-core-location")]
7use objc2_core_location::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern "C" {
13 /// A string that identifies the activation payload’s error domain.
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/appclip/apactivationpayloaderrordomain?language=objc)
16 pub static APActivationPayloadErrorDomain: &'static NSErrorDomain;
17}
18
19/// Error codes that an App Clip activation payload returns.
20///
21/// See also [Apple's documentation](https://developer.apple.com/documentation/appclip/apactivationpayloaderrorcode?language=objc)
22// NS_ERROR_ENUM
23#[repr(transparent)]
24#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
25pub struct APActivationPayloadErrorCode(pub NSInteger);
26impl APActivationPayloadErrorCode {
27 /// The user denied location access, or the source of the App Clip
28 /// invocation wasn’t from an NFC tag or visual code.
29 #[doc(alias = "APActivationPayloadErrorCodeDisallowed")]
30 pub const Disallowed: Self = Self(1);
31 /// The provided URL doesn’t match the registered App Clip URL.
32 #[doc(alias = "APActivationPayloadErrorCodeDoesNotMatch")]
33 pub const DoesNotMatch: Self = Self(2);
34}
35
36unsafe impl Encode for APActivationPayloadErrorCode {
37 const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for APActivationPayloadErrorCode {
41 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44extern_class!(
45 /// Information that’s passed to an App Clip on launch.
46 ///
47 /// When users launch an App Clip, the platform passes an activation payload to
48 /// the App Clip as part of an
49 /// <doc
50 /// ://com.apple.documentation/documentation/foundation/nsuseractivity>
51 /// object. When the App Clip receives the payload, confirm the user’s physical
52 /// location at the time of the invocation.
53 ///
54 /// For more information, see
55 /// <doc
56 /// :responding-to-invocations>.
57 ///
58 /// See also [Apple's documentation](https://developer.apple.com/documentation/appclip/apactivationpayload?language=objc)
59 #[unsafe(super(NSObject))]
60 #[derive(Debug, PartialEq, Eq, Hash)]
61 pub struct APActivationPayload;
62);
63
64extern_conformance!(
65 unsafe impl NSCoding for APActivationPayload {}
66);
67
68extern_conformance!(
69 unsafe impl NSCopying for APActivationPayload {}
70);
71
72unsafe impl CopyingHelper for APActivationPayload {
73 type Result = Self;
74}
75
76extern_conformance!(
77 unsafe impl NSObjectProtocol for APActivationPayload {}
78);
79
80extern_conformance!(
81 unsafe impl NSSecureCoding for APActivationPayload {}
82);
83
84impl APActivationPayload {
85 extern_methods!(
86 #[unsafe(method(new))]
87 #[unsafe(method_family = new)]
88 pub unsafe fn new() -> Retained<Self>;
89
90 #[unsafe(method(init))]
91 #[unsafe(method_family = init)]
92 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
93
94 /// The URL of the link that launched the App Clip.
95 ///
96 /// Use `url` to retrieve data that’s passed to an App Clip on launch, and use
97 /// the data to update the user interface of the App Clip.
98 ///
99 /// The value of `url` is the same as the
100 /// <doc
101 /// ://com.apple.documentation/documentation/foundation/nsuseractivity>
102 /// <doc
103 /// ://com.apple.documentation/documentation/foundation/nsuseractivity/1418086-webpageurl>
104 /// property. If you don’t need to verify the user’s location when they launch
105 /// your App Clip, use `webpageURL` instead.
106 ///
107 /// For more information, see
108 /// <doc
109 /// :responding-to-invocations>.
110 #[unsafe(method(URL))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
113
114 #[cfg(all(feature = "block2", feature = "objc2-core-location"))]
115 /// Checks whether an App Clip invocation happened at an expected physical
116 /// location.
117 ///
118 /// - Parameters:
119 /// - region: The expected physical location at the time of the App Clip
120 /// invocation.
121 /// - completionHandler: A closure called when the platform confirms the
122 /// expected physical location at the time of the App Clip invocation.
123 ///
124 /// The closure takes the following parameters:
125 ///
126 /// - term `inRegion`: A Boolean value that indicates whether the App Clip
127 /// invocation happened at the expected physical location.
128 /// - term `error`: The error object that describes why the platform
129 /// couldn't confirm the user's physical location.
130 ///
131 /// This parameter is `nil` if the platform was able to determine the user's
132 /// physical location at the time of the App Clip invocation.
133 ///
134 /// Confirm the user's location at the time of the App Clip invocation if the
135 /// App Clip is associated with a physical location. The request to confirm the
136 /// location fails with ``App_clips/Apactivationpayloaderror/disallowed`` if the
137 /// source of the invocation isn't an NFC tag or visual code.
138 ///
139 /// For the platform to accept the request to confirm the user's location, you
140 /// need to make modifications to the `Info.plist` file of the App Clip. For
141 /// more information, see
142 /// <doc
143 /// :enabling-notifications-in-app-clips>.
144 ///
145 /// - Note: Functionality to confirm the user's location is only available to
146 /// App Clips. For the full app, request permission to access the user's
147 /// location and make use of the
148 /// <doc
149 /// ://com.apple.documentation/documentation/corelocation> framework. For
150 /// more information, see
151 /// <doc
152 /// ://com.apple.documentation/documentation/corelocation/getting_the_current_location_of_a_device>.
153 #[unsafe(method(confirmAcquiredInRegion:completionHandler:))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn confirmAcquiredInRegion_completionHandler(
156 &self,
157 region: &CLRegion,
158 completion_handler: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>,
159 );
160 );
161}