use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-cloud-kit")]
use objc2_cloud_kit::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-health-kit")]
use objc2_health_kit::*;
#[cfg(feature = "objc2-intents")]
use objc2_intents::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKApplication;
);
extern_conformance!(
unsafe impl NSObjectProtocol for WKApplication {}
);
impl WKApplication {
extern_methods!(
#[unsafe(method(sharedApplication))]
#[unsafe(method_family = none)]
pub unsafe fn sharedApplication(mtm: MainThreadMarker) -> Retained<WKApplication>;
#[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(&self) -> Retained<Self>;
#[unsafe(method(openSystemURL:))]
#[unsafe(method_family = none)]
pub unsafe fn openSystemURL(&self, url: &NSURL);
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn WKApplicationDelegate>>>;
#[cfg(feature = "WKInterfaceController")]
#[unsafe(method(rootInterfaceController))]
#[unsafe(method_family = none)]
pub unsafe fn rootInterfaceController(&self) -> Option<Retained<WKInterfaceController>>;
#[cfg(feature = "WKInterfaceController")]
#[unsafe(method(visibleInterfaceController))]
#[unsafe(method_family = none)]
pub unsafe fn visibleInterfaceController(&self) -> Option<Retained<WKInterfaceController>>;
#[cfg(feature = "WKExtension")]
#[unsafe(method(applicationState))]
#[unsafe(method_family = none)]
pub unsafe fn applicationState(&self) -> WKApplicationState;
#[unsafe(method(isApplicationRunningInDock))]
#[unsafe(method_family = none)]
pub unsafe fn isApplicationRunningInDock(&self) -> bool;
#[unsafe(method(isAutorotating))]
#[unsafe(method_family = none)]
pub unsafe fn isAutorotating(&self) -> bool;
#[unsafe(method(setAutorotating:))]
#[unsafe(method_family = none)]
pub unsafe fn setAutorotating(&self, autorotating: bool);
#[unsafe(method(isAutorotated))]
#[unsafe(method_family = none)]
pub unsafe fn isAutorotated(&self) -> bool;
#[unsafe(method(registerForRemoteNotifications))]
#[unsafe(method_family = none)]
pub unsafe fn registerForRemoteNotifications(&self);
#[unsafe(method(unregisterForRemoteNotifications))]
#[unsafe(method_family = none)]
pub unsafe fn unregisterForRemoteNotifications(&self);
#[unsafe(method(isRegisteredForRemoteNotifications))]
#[unsafe(method_family = none)]
pub unsafe fn isRegisteredForRemoteNotifications(&self) -> bool;
#[cfg(feature = "objc2-ui-kit")]
#[unsafe(method(globalTintColor))]
#[unsafe(method_family = none)]
pub unsafe fn globalTintColor(&self) -> Retained<UIColor>;
);
}
impl WKApplication {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new_class(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait WKApplicationDelegate: NSObjectProtocol + MainThreadOnly {
#[optional]
#[unsafe(method(applicationDidFinishLaunching))]
#[unsafe(method_family = none)]
unsafe fn applicationDidFinishLaunching(&self);
#[optional]
#[unsafe(method(applicationDidBecomeActive))]
#[unsafe(method_family = none)]
unsafe fn applicationDidBecomeActive(&self);
#[optional]
#[unsafe(method(applicationWillResignActive))]
#[unsafe(method_family = none)]
unsafe fn applicationWillResignActive(&self);
#[optional]
#[unsafe(method(applicationWillEnterForeground))]
#[unsafe(method_family = none)]
unsafe fn applicationWillEnterForeground(&self);
#[optional]
#[unsafe(method(applicationDidEnterBackground))]
#[unsafe(method_family = none)]
unsafe fn applicationDidEnterBackground(&self);
#[cfg(feature = "objc2-health-kit")]
#[optional]
#[unsafe(method(handleWorkoutConfiguration:))]
#[unsafe(method_family = none)]
unsafe fn handleWorkoutConfiguration(&self, workout_configuration: &HKWorkoutConfiguration);
#[optional]
#[unsafe(method(handleActiveWorkoutRecovery))]
#[unsafe(method_family = none)]
unsafe fn handleActiveWorkoutRecovery(&self);
#[cfg(feature = "WKExtendedRuntimeSession")]
#[optional]
#[unsafe(method(handleExtendedRuntimeSession:))]
#[unsafe(method_family = none)]
unsafe fn handleExtendedRuntimeSession(
&self,
extended_runtime_session: &WKExtendedRuntimeSession,
);
#[optional]
#[unsafe(method(handleRemoteNowPlayingActivity))]
#[unsafe(method_family = none)]
unsafe fn handleRemoteNowPlayingActivity(&self);
#[optional]
#[unsafe(method(handleUserActivity:))]
#[unsafe(method_family = none)]
unsafe fn handleUserActivity(&self, user_info: Option<&NSDictionary>);
#[optional]
#[unsafe(method(handleActivity:))]
#[unsafe(method_family = none)]
unsafe fn handleActivity(&self, user_activity: &NSUserActivity);
#[cfg(all(feature = "block2", feature = "objc2-intents"))]
#[optional]
#[unsafe(method(handleIntent:completionHandler:))]
#[unsafe(method_family = none)]
unsafe fn handleIntent_completionHandler(
&self,
intent: &INIntent,
completion_handler: &block2::DynBlock<dyn Fn(NonNull<INIntentResponse>)>,
);
#[cfg(feature = "WKBackgroundTask")]
#[optional]
#[unsafe(method(handleBackgroundTasks:))]
#[unsafe(method_family = none)]
unsafe fn handleBackgroundTasks(&self, background_tasks: &NSSet<WKRefreshBackgroundTask>);
#[optional]
#[unsafe(method(deviceOrientationDidChange))]
#[unsafe(method_family = none)]
unsafe fn deviceOrientationDidChange(&self);
#[optional]
#[unsafe(method(didRegisterForRemoteNotificationsWithDeviceToken:))]
#[unsafe(method_family = none)]
unsafe fn didRegisterForRemoteNotificationsWithDeviceToken(&self, device_token: &NSData);
#[optional]
#[unsafe(method(didFailToRegisterForRemoteNotificationsWithError:))]
#[unsafe(method_family = none)]
unsafe fn didFailToRegisterForRemoteNotificationsWithError(&self, error: &NSError);
#[cfg(all(feature = "WKExtension", feature = "block2"))]
#[optional]
#[unsafe(method(didReceiveRemoteNotification:fetchCompletionHandler:))]
#[unsafe(method_family = none)]
unsafe fn didReceiveRemoteNotification_fetchCompletionHandler(
&self,
user_info: &NSDictionary,
completion_handler: &block2::DynBlock<dyn Fn(WKBackgroundFetchResult)>,
);
#[cfg(feature = "objc2-cloud-kit")]
#[optional]
#[unsafe(method(userDidAcceptCloudKitShareWithMetadata:))]
#[unsafe(method_family = none)]
unsafe fn userDidAcceptCloudKitShareWithMetadata(
&self,
cloud_kit_share_metadata: &CKShareMetadata,
);
}
);