From 6d47b64ce5ed16051940b3d6bb3e62ab8d0608ca Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Tue, 19 Jul 2022 11:18:41 -0400 Subject: [PATCH] [WatchKit] Add support for Xcode 14 beta 1,2 & 3 (#15535) --- src/watchkit.cs | 129 +++++++++++++++++++++ tests/xtro-sharpie/watchOS-WatchKit.ignore | 1 + tests/xtro-sharpie/watchOS-WatchKit.todo | 20 ---- 3 files changed, 130 insertions(+), 20 deletions(-) create mode 100644 tests/xtro-sharpie/watchOS-WatchKit.ignore delete mode 100644 tests/xtro-sharpie/watchOS-WatchKit.todo diff --git a/src/watchkit.cs b/src/watchkit.cs index 01366468ab..b116ca3e1e 100644 --- a/src/watchkit.cs +++ b/src/watchkit.cs @@ -1791,4 +1791,133 @@ namespace WatchKit { [Export ("setSecureTextEntry:")] void SetSecureTextEntry (bool secureTextEntry); } + + [Watch (7,0), NoiOS] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface WKApplication + { + [Static] + [Export ("sharedApplication")] + WKApplication SharedApplication { get; } + + [Export ("openSystemURL:")] + void OpenSystemUrl (NSUrl url); + + [Wrap ("WeakDelegate")] + [NullAllowed] + IWKApplicationDelegate Delegate { get; } + + [NullAllowed, Export ("delegate", ArgumentSemantic.Weak)] + NSObject WeakDelegate { get; } + + [NullAllowed, Export ("rootInterfaceController")] + WKInterfaceController RootInterfaceController { get; } + + [NullAllowed, Export ("visibleInterfaceController")] + WKInterfaceController VisibleInterfaceController { get; } + + [Export ("applicationState")] + WKApplicationState ApplicationState { get; } + + [Export ("isApplicationRunningInDock")] + bool IsApplicationRunningInDock { get; } + + [Export ("autorotating")] + bool IsAutorotating { [Bind ("isAutorotating")] get; set; } + + [Export ("autorotated")] + bool Autorotated { [Bind ("isAutorotated")] get; } + + [Export ("registerForRemoteNotifications")] + void RegisterForRemoteNotifications (); + + [Export ("unregisterForRemoteNotifications")] + void UnregisterForRemoteNotifications (); + + [Export ("registeredForRemoteNotifications")] + bool RegisteredForRemoteNotifications { [Bind ("isRegisteredForRemoteNotifications")] get; } + + [Export ("globalTintColor")] + UIColor GlobalTintColor { get; } + + // from interface WKBackgroundTasks (WKApplication) + [Async] + [Export ("scheduleBackgroundRefreshWithPreferredDate:userInfo:scheduledCompletion:")] + void ScheduleBackgroundRefresh (NSDate preferredFireDate, [NullAllowed] NSObject userInfo, Action scheduledCompletion); + + [Async] + [Export ("scheduleSnapshotRefreshWithPreferredDate:userInfo:scheduledCompletion:")] + void ScheduleSnapshotRefresh (NSDate preferredFireDate, [NullAllowed] NSObject userInfo, Action scheduledCompletion); + } + + interface IWKApplicationDelegate {} + + [Watch (7,0), NoiOS] +#if NET + [Protocol, Model] +#else + [Protocol, Model (AutoGeneratedName = true)] +#endif + [BaseType (typeof (NSObject))] + interface WKApplicationDelegate + { + [Export ("applicationDidFinishLaunching")] + void ApplicationDidFinishLaunching (); + + [Export ("applicationDidBecomeActive")] + void ApplicationDidBecomeActive (); + + [Export ("applicationWillResignActive")] + void ApplicationWillResignActive (); + + [Export ("applicationWillEnterForeground")] + void ApplicationWillEnterForeground (); + + [Export ("applicationDidEnterBackground")] + void ApplicationDidEnterBackground (); + + [Export ("handleWorkoutConfiguration:")] + void HandleWorkoutConfiguration (HKWorkoutConfiguration workoutConfiguration); + + [Export ("handleActiveWorkoutRecovery")] + void HandleActiveWorkoutRecovery (); + + [Export ("handleExtendedRuntimeSession:")] + void HandleExtendedRuntimeSession (WKExtendedRuntimeSession extendedRuntimeSession); + + [Export ("handleRemoteNowPlayingActivity")] + void HandleRemoteNowPlayingActivity (); + + [Export ("handleUserActivity:")] + void HandleUserActivity ([NullAllowed] NSDictionary userInfo); + + [Export ("handleActivity:")] + void HandleActivity (NSUserActivity userActivity); + + [Export ("handleIntent:completionHandler:")] + void HandleIntent (INIntent intent, Action completionHandler); + + [Export ("handleBackgroundTasks:")] + void HandleBackgroundTasks (NSSet backgroundTasks); + + [Export ("deviceOrientationDidChange")] + void DeviceOrientationDidChange (); + + [Export ("didRegisterForRemoteNotificationsWithDeviceToken:")] + void DidRegisterForRemoteNotifications (NSData deviceToken); + + [Export ("didFailToRegisterForRemoteNotificationsWithError:")] + void DidFailToRegisterForRemoteNotifications (NSError error); + + [Export ("didReceiveRemoteNotification:fetchCompletionHandler:")] + void DidReceiveRemoteNotification (NSDictionary userInfo, Action completionHandler); + + [Export ("userDidAcceptCloudKitShareWithMetadata:")] + void UserDidAcceptCloudKitShare (CKShareMetadata cloudKitShareMetadata); + } + + [Watch (9,0), NoiOS] + [BaseType (typeof (WKRefreshBackgroundTask))] + interface WKBluetoothAlertRefreshBackgroundTask {} } diff --git a/tests/xtro-sharpie/watchOS-WatchKit.ignore b/tests/xtro-sharpie/watchOS-WatchKit.ignore new file mode 100644 index 0000000000..9f98d1928a --- /dev/null +++ b/tests/xtro-sharpie/watchOS-WatchKit.ignore @@ -0,0 +1 @@ +!missing-pinvoke! WKApplicationMain is not bound diff --git a/tests/xtro-sharpie/watchOS-WatchKit.todo b/tests/xtro-sharpie/watchOS-WatchKit.todo deleted file mode 100644 index 2740da199f..0000000000 --- a/tests/xtro-sharpie/watchOS-WatchKit.todo +++ /dev/null @@ -1,20 +0,0 @@ -!missing-pinvoke! WKApplicationMain is not bound -!missing-protocol! WKApplicationDelegate not bound -!missing-selector! +WKApplication::sharedApplication not bound -!missing-selector! WKApplication::applicationState not bound -!missing-selector! WKApplication::delegate not bound -!missing-selector! WKApplication::globalTintColor not bound -!missing-selector! WKApplication::isApplicationRunningInDock not bound -!missing-selector! WKApplication::isAutorotated not bound -!missing-selector! WKApplication::isAutorotating not bound -!missing-selector! WKApplication::isRegisteredForRemoteNotifications not bound -!missing-selector! WKApplication::openSystemURL: not bound -!missing-selector! WKApplication::registerForRemoteNotifications not bound -!missing-selector! WKApplication::rootInterfaceController not bound -!missing-selector! WKApplication::scheduleBackgroundRefreshWithPreferredDate:userInfo:scheduledCompletion: not bound -!missing-selector! WKApplication::scheduleSnapshotRefreshWithPreferredDate:userInfo:scheduledCompletion: not bound -!missing-selector! WKApplication::setAutorotating: not bound -!missing-selector! WKApplication::unregisterForRemoteNotifications not bound -!missing-selector! WKApplication::visibleInterfaceController not bound -!missing-type! WKApplication not bound -!missing-type! WKBluetoothAlertRefreshBackgroundTask not bound