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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-javascript-core")]
use objc2_javascript_core::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;
use crate::*;
extern_class!(
/// This class is used to provide launch info to TVApplicationController.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvapplicationcontrollercontext?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "Please use SwiftUI or UIKit"]
pub struct TVApplicationControllerContext;
);
extern_conformance!(
unsafe impl NSCopying for TVApplicationControllerContext {}
);
unsafe impl CopyingHelper for TVApplicationControllerContext {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for TVApplicationControllerContext {}
);
impl TVApplicationControllerContext {
extern_methods!(
/// URL to application JavaScript.
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(javaScriptApplicationURL))]
#[unsafe(method_family = none)]
pub unsafe fn javaScriptApplicationURL(&self) -> Retained<NSURL>;
/// Setter for [`javaScriptApplicationURL`][Self::javaScriptApplicationURL].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(setJavaScriptApplicationURL:))]
#[unsafe(method_family = none)]
pub unsafe fn setJavaScriptApplicationURL(&self, java_script_application_url: &NSURL);
/// Optional identifier for local storage file name.
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(storageIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn storageIdentifier(&self) -> Option<Retained<NSString>>;
/// Setter for [`storageIdentifier`][Self::storageIdentifier].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(setStorageIdentifier:))]
#[unsafe(method_family = none)]
pub unsafe fn setStorageIdentifier(&self, storage_identifier: Option<&NSString>);
/// Allows PiP to happen when playing back media
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(supportsPictureInPicturePlayback))]
#[unsafe(method_family = none)]
pub unsafe fn supportsPictureInPicturePlayback(&self) -> bool;
/// Setter for [`supportsPictureInPicturePlayback`][Self::supportsPictureInPicturePlayback].
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(setSupportsPictureInPicturePlayback:))]
#[unsafe(method_family = none)]
pub unsafe fn setSupportsPictureInPicturePlayback(
&self,
supports_picture_in_picture_playback: bool,
);
/// Data that gets passed to JavaScript onLaunch method. Values must be
/// serializable. If app intends for JavaScript to handle openURL: then
/// launchOptions should include UIApplicationLaunchOptionsURLKey and
/// UIApplicationLaunchOptionsSourceApplicationKey to the launch options.
/// TVApplicationController adds location (boot url) by default. If UIApplicationLaunchOptionsURLKey
/// and UIApplicationLaunchOptionsSourceApplicationKey are provided then
/// maps them to openURL and sourceAppIdentifier keys respectively.
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(launchOptions))]
#[unsafe(method_family = none)]
pub unsafe fn launchOptions(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
/// Setter for [`launchOptions`][Self::launchOptions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
///
/// # Safety
///
/// `launch_options` generic should be of the correct type.
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(setLaunchOptions:))]
#[unsafe(method_family = none)]
pub unsafe fn setLaunchOptions(&self, launch_options: &NSDictionary<NSString, AnyObject>);
);
}
/// Methods declared on superclass `NSObject`.
impl TVApplicationControllerContext {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_protocol!(
/// [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvapplicationcontrollerdelegate?language=objc)
#[deprecated = "Please use SwiftUI or UIKit"]
pub unsafe trait TVApplicationControllerDelegate: NSObjectProtocol {
#[cfg(feature = "objc2-javascript-core")]
/// This method lets delegate to add JavaScript classes and objects.
#[deprecated = "Please use SwiftUI or UIKit"]
#[optional]
#[unsafe(method(appController:evaluateAppJavaScriptInContext:))]
#[unsafe(method_family = none)]
unsafe fn appController_evaluateAppJavaScriptInContext(
&self,
app_controller: &TVApplicationController,
js_context: &JSContext,
);
/// Tells the delegate that the application did finish launching.
///
/// # Safety
///
/// `options` generic should be of the correct type.
#[deprecated = "Please use SwiftUI or UIKit"]
#[optional]
#[unsafe(method(appController:didFinishLaunchingWithOptions:))]
#[unsafe(method_family = none)]
unsafe fn appController_didFinishLaunchingWithOptions(
&self,
app_controller: &TVApplicationController,
options: Option<&NSDictionary<NSString, AnyObject>>,
);
/// Tells the delegate that the application failed to load.
#[deprecated = "Please use SwiftUI or UIKit"]
#[optional]
#[unsafe(method(appController:didFailWithError:))]
#[unsafe(method_family = none)]
unsafe fn appController_didFailWithError(
&self,
app_controller: &TVApplicationController,
error: &NSError,
);
/// Tells the delegate that the application did stop.
///
/// # Safety
///
/// `options` generic should be of the correct type.
#[deprecated = "Please use SwiftUI or UIKit"]
#[optional]
#[unsafe(method(appController:didStopWithOptions:))]
#[unsafe(method_family = none)]
unsafe fn appController_didStopWithOptions(
&self,
app_controller: &TVApplicationController,
options: Option<&NSDictionary<NSString, AnyObject>>,
);
#[cfg(feature = "TVPlayback")]
/// Asks the delegate for a custom player object for a particular player bridge.
#[deprecated = "Please use SwiftUI or UIKit"]
#[optional]
#[unsafe(method(playerForAppController:))]
#[unsafe(method_family = none)]
unsafe fn playerForAppController(
&self,
app_controller: &TVApplicationController,
) -> Option<Retained<TVPlayer>>;
}
);
extern_class!(
/// The TVApplicationController class establishes the JavaScript environment
/// to provide a centralized point of control and co-ordination. The class
/// bridges the UI, navigation stack, storage and event handling from JavaScript.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvapplicationcontroller?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "Please use SwiftUI or UIKit"]
pub struct TVApplicationController;
);
extern_conformance!(
unsafe impl NSObjectProtocol for TVApplicationController {}
);
impl TVApplicationController {
extern_methods!(
#[cfg(feature = "objc2-ui-kit")]
/// Initializes and returns application controller given the launch context.
/// Optionally window can be passed, and in that case TVApplicationController
/// acts like an application delegate, and handles the JavaScript
/// application lifecycle events e.g. onResume, onSuspend. If window
/// is not provided, caller is responsible for hosting the navigationController.
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(initWithContext:window:delegate:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithContext_window_delegate(
this: Allocated<Self>,
context: &TVApplicationControllerContext,
window: Option<&UIWindow>,
delegate: Option<&ProtocolObject<dyn TVApplicationControllerDelegate>>,
) -> Retained<Self>;
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "objc2-ui-kit")]
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(window))]
#[unsafe(method_family = none)]
pub unsafe fn window(&self, mtm: MainThreadMarker) -> Option<Retained<UIWindow>>;
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(context))]
#[unsafe(method_family = none)]
pub unsafe fn context(&self) -> Retained<TVApplicationControllerContext>;
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn TVApplicationControllerDelegate>>>;
#[cfg(feature = "objc2-ui-kit")]
/// Returns the navigation controller which is bridged from JavaScript. Native controllers can also be pushed onto this controller.
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(navigationController))]
#[unsafe(method_family = none)]
pub unsafe fn navigationController(
&self,
mtm: MainThreadMarker,
) -> Retained<UINavigationController>;
#[cfg(all(feature = "block2", feature = "objc2-javascript-core"))]
/// Adds the block to the JavaScript execution queue and invokes
/// completion block once the evaluation block has finished execution. JSContext is
/// valid within the scope of evaluation block and should not be referenced by the
/// application outside the block.
///
/// Parameter `evaluation`: Block to evaluate in JavaScript execution queue.
///
/// Parameter `completion`: Invoked after the evaluation block has been executed.
/// evaluated is YES if the block was evaluated; NO otherwise.
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(evaluateInJavaScriptContext:completion:))]
#[unsafe(method_family = none)]
pub unsafe fn evaluateInJavaScriptContext_completion(
&self,
evaluation: &block2::DynBlock<dyn Fn(NonNull<JSContext>)>,
completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
);
/// Stops the application lifecycle. appController:didStopWithOptions: is
/// called once the JSContext has finished execution and has released all
/// it's resources. The delegate must wait before releasing the controller.
/// The controller cannot be reused after calling stop.
#[deprecated = "Please use SwiftUI or UIKit"]
#[unsafe(method(stop))]
#[unsafe(method_family = none)]
pub unsafe fn stop(&self);
);
}
/// Methods declared on superclass `NSObject`.
impl TVApplicationController {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}