Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/WatchKit/WKAccessibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ public partial class WKAccessibility {
static public bool IsVoiceOverRunning {
get { return WKAccessibilityIsVoiceOverRunning (); }
}

[Watch (4,0)]
[DllImport (Constants.WatchKitLibrary)]
static extern bool WKAccessibilityIsReduceMotionEnabled ();

[Watch (4,0)]
static public bool IsReduceMotionEnabled {
get { return WKAccessibilityIsReduceMotionEnabled (); }
}
}
}

Expand Down
34 changes: 34 additions & 0 deletions src/WatchKit/WKDefs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,38 @@ public enum WKWaterResistanceRating : nint {
Ipx7,
Wr50,
}

[Watch (4,0)][NoiOS]
[Native]
public enum WKSnapshotReason : nint {
AppScheduled = 0,
ReturnToDefaultState,
ComplicationUpdate,
Prelaunch,
AppBackgrounded,
}

[Watch (4,0)][NoiOS]
[Native]
public enum WKPageOrientation : nint {
Horizontal,
Vertical,
}

[Watch (4,0)][NoiOS]
[Native]
public enum WKInterfaceScrollPosition : nint {
Top,
CenteredVertically,
Bottom,
}

[Watch (4,0)][NoiOS]
[Native]
public enum WKInterfaceDeviceBatteryState : nint {
Unknown,
Unplugged,
Charging,
Full,
}
}
76 changes: 76 additions & 0 deletions src/watchkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ interface WKInterfaceController {
[Export ("handleActionWithIdentifier:forNotification:")]
void HandleAction ([NullAllowed] string identifier, UNNotification notification);

[Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'WKExtensionDelegate.HandleUserActivity' instead.")]
[Export ("handleUserActivity:")]
// This NSDictionary is OK, it is arbitrary and user specific
void HandleUserActivity ([NullAllowed] NSDictionary userActivity);
Expand Down Expand Up @@ -157,9 +158,15 @@ interface WKInterfaceController {
[Static, Export ("openParentApplication:reply:")]
bool OpenParentApplication (NSDictionary userInfo, [NullAllowed] Action<NSDictionary, NSError> reply);

[Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'ReloadRootPageControllers' instead.")]
[Static, Export ("reloadRootControllersWithNames:contexts:")]
void ReloadRootControllers (string [] names, [NullAllowed] NSObject [] contexts);

[Watch (4,0)][NoiOS]
[Static]
[Export ("reloadRootPageControllersWithNames:contexts:orientation:pageIndex:")]
void ReloadRootPageControllers (string[] names, [NullAllowed] NSObject[] contexts, WKPageOrientation orientation, nint pageIndex);

#if !XAMCORE_3_0
// now exposed with the corresponding WKErrorCode enum
[Field ("WatchKitErrorDomain")]
Expand Down Expand Up @@ -192,9 +199,11 @@ interface WKInterfaceController {
[Export ("dismissAddPassesController")]
void DismissAddPassesController ();

[Deprecated (PlatformName.WatchOS, 4,0, message: "Glances support was removed.")]
[Export ("beginGlanceUpdates")]
void BeginGlanceUpdates ();

[Deprecated (PlatformName.WatchOS, 4,0, message: "Glances support was removed.")]
[Export ("endGlanceUpdates")]
void EndGlanceUpdates ();

Expand All @@ -215,6 +224,22 @@ interface WKInterfaceController {
[Watch (3,0)][NoiOS]
[Export ("crownSequencer", ArgumentSemantic.Strong)]
WKCrownSequencer CrownSequencer { get; }

[Watch (4,0)][NoiOS]
[Export ("scrollToObject:atScrollPosition:animated:")]
void ScrollTo (WKInterfaceObject @object, WKInterfaceScrollPosition scrollPosition, bool animated);

[Watch (4,0)][NoiOS]
[Export ("interfaceDidScrollToTop")]
void InterfaceDidScrollToTop ();

[Watch (4,0)][NoiOS]
[Export ("interfaceOffsetDidScrollToTop")]
void InterfaceOffsetDidScrollToTop ();

[Watch (4,0)][NoiOS]
[Export ("interfaceOffsetDidScrollToBottom")]
void InterfaceOffsetDidScrollToBottom ();
}

[iOS (8,2)]
Expand Down Expand Up @@ -330,6 +355,11 @@ interface WKAccessibility {
[Notification]
[Field ("WKAccessibilityVoiceOverStatusChanged")]
NSString VoiceOverStatusChanged { get; }

[Watch (4,0)][NoiOS]
[Notification]
[Field ("WKAccessibilityReduceMotionStatusDidChangeNotification")]
NSString ReduceMotionStatusDidChangeNotification { get; }
}

[iOS (8,2)]
Expand Down Expand Up @@ -414,6 +444,18 @@ interface WKInterfaceDevice {
[Watch (3,0)][NoiOS]
[Export ("crownOrientation")]
WKInterfaceDeviceCrownOrientation CrownOrientation { get; }

[Watch (4,0)][NoiOS]
[Export ("batteryMonitoringEnabled")]
bool BatteryMonitoringEnabled { [Bind ("isBatteryMonitoringEnabled")] get; set; }

[Watch (4,0)][NoiOS]
[Export ("batteryLevel")]
float BatteryLevel { get; }

[Watch (4,0)][NoiOS]
[Export ("batteryState")]
WKInterfaceDeviceBatteryState BatteryState { get; }
}

[iOS (8,2)]
Expand Down Expand Up @@ -830,6 +872,26 @@ interface WKExtension {
[Watch (3,0)]
[Export ("applicationState")]
WKApplicationState ApplicationState { get; }

[Watch (4,0)]
[NullAllowed, Export ("visibleInterfaceController")]
WKInterfaceController VisibleInterfaceController { get; }

[Watch (4,0)]
[Export ("isApplicationRunningInDock")]
bool IsApplicationRunningInDock { get; }

[Watch (4,0)]
[Export ("autorotating")]
bool Autorotating { [Bind ("isAutorotating")] get; set; }

[Watch (4,0)]
[Export ("frontmostTimeoutExtended")]
bool FrontmostTimeoutExtended { [Bind ("isFrontmostTimeoutExtended")] get; set; }

[Watch (4,0)]
[Export ("enableWaterLock")]
void EnableWaterLock ();
}

[NoiOS]
Expand Down Expand Up @@ -892,6 +954,10 @@ interface WKExtensionDelegate {
[Watch (3,0)]
[Export ("handleWorkoutConfiguration:")]
void HandleWorkoutConfiguration (HKWorkoutConfiguration workoutConfiguration);

[Watch (4,0)]
[Export ("deviceOrientationDidChange")]
void DeviceOrientationDidChange ();
}

[Watch (2,2), NoiOS]
Expand Down Expand Up @@ -1024,8 +1090,13 @@ interface WKRefreshBackgroundTask {
[NullAllowed, Export ("userInfo")]
INSSecureCoding UserInfo { get; }

[Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'SetTaskCompleted (false)' instead.")]
[Export ("setTaskCompleted")]
void SetTaskCompleted ();

[Watch (4,0)]
[Export ("setTaskCompletedWithSnapshot:")]
void SetTaskCompleted (bool refreshSnapshot);
}

[Watch (3,0)][NoiOS]
Expand All @@ -1037,9 +1108,14 @@ interface WKApplicationRefreshBackgroundTask {
[BaseType (typeof (WKRefreshBackgroundTask))]
interface WKSnapshotRefreshBackgroundTask {

[Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'ReasonForSnapshot' instead.")]
[Export ("returnToDefaultState")]
bool ReturnToDefaultState { get; }

[Watch (4,0)]
[Export ("reasonForSnapshot")]
WKSnapshotReason ReasonForSnapshot { get; }

[Export ("setTaskCompletedWithDefaultStateRestored:estimatedSnapshotExpiration:userInfo:")]
void SetTaskCompleted (bool restoredDefaultState, [NullAllowed] NSDate estimatedSnapshotExpiration, [NullAllowed] INSSecureCoding userInfo);
}
Expand Down