objc2_tv_ml_kit/generated/
TVApplicationController.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-javascript-core")]
8use objc2_javascript_core::*;
9#[cfg(feature = "objc2-ui-kit")]
10use objc2_ui_kit::*;
11
12use crate::*;
13
14extern_class!(
15    /// This class is used to provide launch info to TVApplicationController.
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvapplicationcontrollercontext?language=objc)
18    #[unsafe(super(NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    #[deprecated = "Please use SwiftUI or UIKit"]
21    pub struct TVApplicationControllerContext;
22);
23
24extern_conformance!(
25    unsafe impl NSCopying for TVApplicationControllerContext {}
26);
27
28unsafe impl CopyingHelper for TVApplicationControllerContext {
29    type Result = Self;
30}
31
32extern_conformance!(
33    unsafe impl NSObjectProtocol for TVApplicationControllerContext {}
34);
35
36impl TVApplicationControllerContext {
37    extern_methods!(
38        /// URL to application JavaScript.
39        #[deprecated = "Please use SwiftUI or UIKit"]
40        #[unsafe(method(javaScriptApplicationURL))]
41        #[unsafe(method_family = none)]
42        pub unsafe fn javaScriptApplicationURL(&self) -> Retained<NSURL>;
43
44        /// Setter for [`javaScriptApplicationURL`][Self::javaScriptApplicationURL].
45        #[deprecated = "Please use SwiftUI or UIKit"]
46        #[unsafe(method(setJavaScriptApplicationURL:))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn setJavaScriptApplicationURL(&self, java_script_application_url: &NSURL);
49
50        /// Optional identifier for local storage file name.
51        #[deprecated = "Please use SwiftUI or UIKit"]
52        #[unsafe(method(storageIdentifier))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn storageIdentifier(&self) -> Option<Retained<NSString>>;
55
56        /// Setter for [`storageIdentifier`][Self::storageIdentifier].
57        #[deprecated = "Please use SwiftUI or UIKit"]
58        #[unsafe(method(setStorageIdentifier:))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn setStorageIdentifier(&self, storage_identifier: Option<&NSString>);
61
62        /// Allows PiP to happen when playing back media
63        #[deprecated = "Please use SwiftUI or UIKit"]
64        #[unsafe(method(supportsPictureInPicturePlayback))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn supportsPictureInPicturePlayback(&self) -> bool;
67
68        /// Setter for [`supportsPictureInPicturePlayback`][Self::supportsPictureInPicturePlayback].
69        #[deprecated = "Please use SwiftUI or UIKit"]
70        #[unsafe(method(setSupportsPictureInPicturePlayback:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setSupportsPictureInPicturePlayback(
73            &self,
74            supports_picture_in_picture_playback: bool,
75        );
76
77        /// Data that gets passed to JavaScript onLaunch method. Values must be
78        /// serializable. If app intends for JavaScript to handle openURL: then
79        /// launchOptions should include UIApplicationLaunchOptionsURLKey and
80        /// UIApplicationLaunchOptionsSourceApplicationKey to the launch options.
81        /// TVApplicationController adds location (boot url) by default. If UIApplicationLaunchOptionsURLKey
82        /// and UIApplicationLaunchOptionsSourceApplicationKey are provided then
83        /// maps them to openURL and sourceAppIdentifier keys respectively.
84        #[deprecated = "Please use SwiftUI or UIKit"]
85        #[unsafe(method(launchOptions))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn launchOptions(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
88
89        /// Setter for [`launchOptions`][Self::launchOptions].
90        #[deprecated = "Please use SwiftUI or UIKit"]
91        #[unsafe(method(setLaunchOptions:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setLaunchOptions(&self, launch_options: &NSDictionary<NSString, AnyObject>);
94    );
95}
96
97/// Methods declared on superclass `NSObject`.
98impl TVApplicationControllerContext {
99    extern_methods!(
100        #[unsafe(method(init))]
101        #[unsafe(method_family = init)]
102        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
103
104        #[unsafe(method(new))]
105        #[unsafe(method_family = new)]
106        pub unsafe fn new() -> Retained<Self>;
107    );
108}
109
110extern_protocol!(
111    /// [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvapplicationcontrollerdelegate?language=objc)
112    #[deprecated = "Please use SwiftUI or UIKit"]
113    pub unsafe trait TVApplicationControllerDelegate: NSObjectProtocol {
114        #[cfg(feature = "objc2-javascript-core")]
115        /// This method lets delegate to add JavaScript classes and objects.
116        #[deprecated = "Please use SwiftUI or UIKit"]
117        #[optional]
118        #[unsafe(method(appController:evaluateAppJavaScriptInContext:))]
119        #[unsafe(method_family = none)]
120        unsafe fn appController_evaluateAppJavaScriptInContext(
121            &self,
122            app_controller: &TVApplicationController,
123            js_context: &JSContext,
124        );
125
126        /// Tells the delegate that the application did finish launching.
127        #[deprecated = "Please use SwiftUI or UIKit"]
128        #[optional]
129        #[unsafe(method(appController:didFinishLaunchingWithOptions:))]
130        #[unsafe(method_family = none)]
131        unsafe fn appController_didFinishLaunchingWithOptions(
132            &self,
133            app_controller: &TVApplicationController,
134            options: Option<&NSDictionary<NSString, AnyObject>>,
135        );
136
137        /// Tells the delegate that the application failed to load.
138        #[deprecated = "Please use SwiftUI or UIKit"]
139        #[optional]
140        #[unsafe(method(appController:didFailWithError:))]
141        #[unsafe(method_family = none)]
142        unsafe fn appController_didFailWithError(
143            &self,
144            app_controller: &TVApplicationController,
145            error: &NSError,
146        );
147
148        /// Tells the delegate that the application did stop.
149        #[deprecated = "Please use SwiftUI or UIKit"]
150        #[optional]
151        #[unsafe(method(appController:didStopWithOptions:))]
152        #[unsafe(method_family = none)]
153        unsafe fn appController_didStopWithOptions(
154            &self,
155            app_controller: &TVApplicationController,
156            options: Option<&NSDictionary<NSString, AnyObject>>,
157        );
158
159        #[cfg(feature = "TVPlayback")]
160        /// Asks the delegate for a custom player object for a particular player bridge.
161        #[deprecated = "Please use SwiftUI or UIKit"]
162        #[optional]
163        #[unsafe(method(playerForAppController:))]
164        #[unsafe(method_family = none)]
165        unsafe fn playerForAppController(
166            &self,
167            app_controller: &TVApplicationController,
168        ) -> Option<Retained<TVPlayer>>;
169    }
170);
171
172extern_class!(
173    /// The TVApplicationController class establishes the JavaScript environment
174    /// to provide a centralized point of control and co-ordination. The class
175    /// bridges the UI, navigation stack, storage and event handling from JavaScript.
176    ///
177    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvapplicationcontroller?language=objc)
178    #[unsafe(super(NSObject))]
179    #[derive(Debug, PartialEq, Eq, Hash)]
180    #[deprecated = "Please use SwiftUI or UIKit"]
181    pub struct TVApplicationController;
182);
183
184extern_conformance!(
185    unsafe impl NSObjectProtocol for TVApplicationController {}
186);
187
188impl TVApplicationController {
189    extern_methods!(
190        #[cfg(feature = "objc2-ui-kit")]
191        /// Initializes and returns application controller given the launch context.
192        /// Optionally window can be passed, and in that case TVApplicationController
193        /// acts like an application delegate, and handles the JavaScript
194        /// application lifecycle events e.g. onResume, onSuspend. If window
195        /// is not provided, caller is responsible for hosting the navigationController.
196        #[deprecated = "Please use SwiftUI or UIKit"]
197        #[unsafe(method(initWithContext:window:delegate:))]
198        #[unsafe(method_family = init)]
199        pub unsafe fn initWithContext_window_delegate(
200            this: Allocated<Self>,
201            context: &TVApplicationControllerContext,
202            window: Option<&UIWindow>,
203            delegate: Option<&ProtocolObject<dyn TVApplicationControllerDelegate>>,
204        ) -> Retained<Self>;
205
206        #[deprecated = "Please use SwiftUI or UIKit"]
207        #[unsafe(method(init))]
208        #[unsafe(method_family = init)]
209        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
210
211        #[cfg(feature = "objc2-ui-kit")]
212        #[deprecated = "Please use SwiftUI or UIKit"]
213        #[unsafe(method(window))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn window(&self, mtm: MainThreadMarker) -> Option<Retained<UIWindow>>;
216
217        #[deprecated = "Please use SwiftUI or UIKit"]
218        #[unsafe(method(context))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn context(&self) -> Retained<TVApplicationControllerContext>;
221
222        #[deprecated = "Please use SwiftUI or UIKit"]
223        #[unsafe(method(delegate))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn delegate(
226            &self,
227        ) -> Option<Retained<ProtocolObject<dyn TVApplicationControllerDelegate>>>;
228
229        #[cfg(feature = "objc2-ui-kit")]
230        /// Returns the navigation controller which is bridged from JavaScript. Native controllers can also be pushed onto this controller.
231        #[deprecated = "Please use SwiftUI or UIKit"]
232        #[unsafe(method(navigationController))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn navigationController(
235            &self,
236            mtm: MainThreadMarker,
237        ) -> Retained<UINavigationController>;
238
239        #[cfg(all(feature = "block2", feature = "objc2-javascript-core"))]
240        /// Adds the block to the JavaScript execution queue and invokes
241        /// completion block once the evaluation block has finished execution. JSContext is
242        /// valid within the scope of evaluation block and should not be referenced by the
243        /// application outside the block.
244        ///
245        /// Parameter `evaluation`: Block to evaluate in JavaScript execution queue.
246        ///
247        /// Parameter `completion`: Invoked after the evaluation block has been executed.
248        /// evaluated is YES if the block was evaluated; NO otherwise.
249        #[deprecated = "Please use SwiftUI or UIKit"]
250        #[unsafe(method(evaluateInJavaScriptContext:completion:))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn evaluateInJavaScriptContext_completion(
253            &self,
254            evaluation: &block2::DynBlock<dyn Fn(NonNull<JSContext>)>,
255            completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
256        );
257
258        /// Stops the application lifecycle. appController:didStopWithOptions: is
259        /// called once the JSContext has finished execution and has released all
260        /// it's resources. The delegate must wait before releasing the controller.
261        /// The controller cannot be reused after calling stop.
262        #[deprecated = "Please use SwiftUI or UIKit"]
263        #[unsafe(method(stop))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn stop(&self);
266    );
267}
268
269/// Methods declared on superclass `NSObject`.
270impl TVApplicationController {
271    extern_methods!(
272        #[unsafe(method(new))]
273        #[unsafe(method_family = new)]
274        pub unsafe fn new() -> Retained<Self>;
275    );
276}