use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKRefreshBackgroundTask;
);
unsafe impl Send for WKRefreshBackgroundTask {}
unsafe impl Sync for WKRefreshBackgroundTask {}
extern_conformance!(
unsafe impl NSObjectProtocol for WKRefreshBackgroundTask {}
);
impl WKRefreshBackgroundTask {
extern_methods!(
#[unsafe(method(userInfo))]
#[unsafe(method_family = none)]
pub unsafe fn userInfo(
&self,
) -> Option<Retained<AnyObject >>;
#[cfg(feature = "block2")]
#[unsafe(method(expirationHandler))]
#[unsafe(method_family = none)]
pub unsafe fn expirationHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;
#[cfg(feature = "block2")]
#[unsafe(method(setExpirationHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn setExpirationHandler(
&self,
expiration_handler: Option<&block2::DynBlock<dyn Fn()>>,
);
#[deprecated = "Use -setTaskCompletedWithSnapshot: instead, pass NO to duplicate existing behavior"]
#[unsafe(method(setTaskCompleted))]
#[unsafe(method_family = none)]
pub unsafe fn setTaskCompleted(&self);
#[unsafe(method(setTaskCompletedWithSnapshot:))]
#[unsafe(method_family = none)]
pub unsafe fn setTaskCompletedWithSnapshot(&self, refresh_snapshot: bool);
);
}
impl WKRefreshBackgroundTask {
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_class!(
#[unsafe(super(WKRefreshBackgroundTask, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKApplicationRefreshBackgroundTask;
);
extern_conformance!(
unsafe impl NSObjectProtocol for WKApplicationRefreshBackgroundTask {}
);
impl WKApplicationRefreshBackgroundTask {
extern_methods!();
}
impl WKApplicationRefreshBackgroundTask {
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>;
);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKSnapshotReason(pub NSInteger);
impl WKSnapshotReason {
#[doc(alias = "WKSnapshotReasonAppScheduled")]
pub const AppScheduled: Self = Self(0);
#[doc(alias = "WKSnapshotReasonReturnToDefaultState")]
pub const ReturnToDefaultState: Self = Self(1);
#[doc(alias = "WKSnapshotReasonComplicationUpdate")]
pub const ComplicationUpdate: Self = Self(2);
#[doc(alias = "WKSnapshotReasonPrelaunch")]
pub const Prelaunch: Self = Self(3);
#[doc(alias = "WKSnapshotReasonAppBackgrounded")]
pub const AppBackgrounded: Self = Self(4);
}
unsafe impl Encode for WKSnapshotReason {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for WKSnapshotReason {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(WKRefreshBackgroundTask, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKSnapshotRefreshBackgroundTask;
);
extern_conformance!(
unsafe impl NSObjectProtocol for WKSnapshotRefreshBackgroundTask {}
);
impl WKSnapshotRefreshBackgroundTask {
extern_methods!(
#[deprecated = "Use reasonForSnapshot instead, WKSnapshotReasonReturnToPrimaryUI is equivalent to returnToDefaultState=true"]
#[unsafe(method(returnToDefaultState))]
#[unsafe(method_family = none)]
pub unsafe fn returnToDefaultState(&self) -> bool;
#[unsafe(method(reasonForSnapshot))]
#[unsafe(method_family = none)]
pub unsafe fn reasonForSnapshot(&self) -> WKSnapshotReason;
#[unsafe(method(setTaskCompletedWithDefaultStateRestored:estimatedSnapshotExpiration:userInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn setTaskCompletedWithDefaultStateRestored_estimatedSnapshotExpiration_userInfo(
&self,
restored_default_state: bool,
estimated_snapshot_expiration: Option<&NSDate>,
user_info: Option<&AnyObject >,
);
);
}
impl WKSnapshotRefreshBackgroundTask {
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_class!(
#[unsafe(super(WKRefreshBackgroundTask, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKURLSessionRefreshBackgroundTask;
);
extern_conformance!(
unsafe impl NSObjectProtocol for WKURLSessionRefreshBackgroundTask {}
);
impl WKURLSessionRefreshBackgroundTask {
extern_methods!(
#[unsafe(method(sessionIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn sessionIdentifier(&self) -> Retained<NSString>;
);
}
impl WKURLSessionRefreshBackgroundTask {
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_class!(
#[unsafe(super(WKRefreshBackgroundTask, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKWatchConnectivityRefreshBackgroundTask;
);
extern_conformance!(
unsafe impl NSObjectProtocol for WKWatchConnectivityRefreshBackgroundTask {}
);
impl WKWatchConnectivityRefreshBackgroundTask {
extern_methods!();
}
impl WKWatchConnectivityRefreshBackgroundTask {
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_class!(
#[unsafe(super(WKRefreshBackgroundTask, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKRelevantShortcutRefreshBackgroundTask;
);
extern_conformance!(
unsafe impl NSObjectProtocol for WKRelevantShortcutRefreshBackgroundTask {}
);
impl WKRelevantShortcutRefreshBackgroundTask {
extern_methods!();
}
impl WKRelevantShortcutRefreshBackgroundTask {
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_class!(
#[unsafe(super(WKRefreshBackgroundTask, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKIntentDidRunRefreshBackgroundTask;
);
extern_conformance!(
unsafe impl NSObjectProtocol for WKIntentDidRunRefreshBackgroundTask {}
);
impl WKIntentDidRunRefreshBackgroundTask {
extern_methods!();
}
impl WKIntentDidRunRefreshBackgroundTask {
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_class!(
#[unsafe(super(WKRefreshBackgroundTask, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKBluetoothAlertRefreshBackgroundTask;
);
extern_conformance!(
unsafe impl NSObjectProtocol for WKBluetoothAlertRefreshBackgroundTask {}
);
impl WKBluetoothAlertRefreshBackgroundTask {
extern_methods!();
}
impl WKBluetoothAlertRefreshBackgroundTask {
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>;
);
}
#[cfg(feature = "WKExtension")]
impl WKExtension {
extern_methods!(
#[cfg(feature = "block2")]
#[unsafe(method(scheduleBackgroundRefreshWithPreferredDate:userInfo:scheduledCompletion:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleBackgroundRefreshWithPreferredDate_userInfo_scheduledCompletion(
&self,
preferred_fire_date: &NSDate,
user_info: Option<&AnyObject >,
scheduled_completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
#[cfg(feature = "block2")]
#[unsafe(method(scheduleSnapshotRefreshWithPreferredDate:userInfo:scheduledCompletion:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleSnapshotRefreshWithPreferredDate_userInfo_scheduledCompletion(
&self,
preferred_fire_date: &NSDate,
user_info: Option<&AnyObject >,
scheduled_completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
);
}
#[cfg(feature = "WKApplication")]
impl WKApplication {
extern_methods!(
#[cfg(feature = "block2")]
#[unsafe(method(scheduleBackgroundRefreshWithPreferredDate:userInfo:scheduledCompletion:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleBackgroundRefreshWithPreferredDate_userInfo_scheduledCompletion(
&self,
preferred_fire_date: &NSDate,
user_info: Option<&AnyObject >,
scheduled_completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
#[cfg(feature = "block2")]
#[unsafe(method(scheduleSnapshotRefreshWithPreferredDate:userInfo:scheduledCompletion:))]
#[unsafe(method_family = none)]
pub unsafe fn scheduleSnapshotRefreshWithPreferredDate_userInfo_scheduledCompletion(
&self,
preferred_fire_date: &NSDate,
user_info: Option<&AnyObject >,
scheduled_completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
);
}