Skip to content

Commit 3044a67

Browse files
authored
[watchkit] Update to beta 4 (#2398)
1 parent 8c7b776 commit 3044a67

3 files changed

Lines changed: 119 additions & 0 deletions

File tree

src/WatchKit/WKAccessibility.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ public partial class WKAccessibility {
1515
static public bool IsVoiceOverRunning {
1616
get { return WKAccessibilityIsVoiceOverRunning (); }
1717
}
18+
19+
[Watch (4,0)]
20+
[DllImport (Constants.WatchKitLibrary)]
21+
static extern bool WKAccessibilityIsReduceMotionEnabled ();
22+
23+
[Watch (4,0)]
24+
static public bool IsReduceMotionEnabled {
25+
get { return WKAccessibilityIsReduceMotionEnabled (); }
26+
}
1827
}
1928
}
2029

src/WatchKit/WKDefs.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,38 @@ public enum WKWaterResistanceRating : nint {
216216
Ipx7,
217217
Wr50,
218218
}
219+
220+
[Watch (4,0)][NoiOS]
221+
[Native]
222+
public enum WKSnapshotReason : nint {
223+
AppScheduled = 0,
224+
ReturnToDefaultState,
225+
ComplicationUpdate,
226+
Prelaunch,
227+
AppBackgrounded,
228+
}
229+
230+
[Watch (4,0)][NoiOS]
231+
[Native]
232+
public enum WKPageOrientation : nint {
233+
Horizontal,
234+
Vertical,
235+
}
236+
237+
[Watch (4,0)][NoiOS]
238+
[Native]
239+
public enum WKInterfaceScrollPosition : nint {
240+
Top,
241+
CenteredVertically,
242+
Bottom,
243+
}
244+
245+
[Watch (4,0)][NoiOS]
246+
[Native]
247+
public enum WKInterfaceDeviceBatteryState : nint {
248+
Unknown,
249+
Unplugged,
250+
Charging,
251+
Full,
252+
}
219253
}

src/watchkit.cs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ interface WKInterfaceController {
7171
[Export ("handleActionWithIdentifier:forNotification:")]
7272
void HandleAction ([NullAllowed] string identifier, UNNotification notification);
7373

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

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

165+
[Watch (4,0)][NoiOS]
166+
[Static]
167+
[Export ("reloadRootPageControllersWithNames:contexts:orientation:pageIndex:")]
168+
void ReloadRootPageControllers (string[] names, [NullAllowed] NSObject[] contexts, WKPageOrientation orientation, nint pageIndex);
169+
163170
#if !XAMCORE_3_0
164171
// now exposed with the corresponding WKErrorCode enum
165172
[Field ("WatchKitErrorDomain")]
@@ -192,9 +199,11 @@ interface WKInterfaceController {
192199
[Export ("dismissAddPassesController")]
193200
void DismissAddPassesController ();
194201

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

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

@@ -215,6 +224,22 @@ interface WKInterfaceController {
215224
[Watch (3,0)][NoiOS]
216225
[Export ("crownSequencer", ArgumentSemantic.Strong)]
217226
WKCrownSequencer CrownSequencer { get; }
227+
228+
[Watch (4,0)][NoiOS]
229+
[Export ("scrollToObject:atScrollPosition:animated:")]
230+
void ScrollTo (WKInterfaceObject @object, WKInterfaceScrollPosition scrollPosition, bool animated);
231+
232+
[Watch (4,0)][NoiOS]
233+
[Export ("interfaceDidScrollToTop")]
234+
void InterfaceDidScrollToTop ();
235+
236+
[Watch (4,0)][NoiOS]
237+
[Export ("interfaceOffsetDidScrollToTop")]
238+
void InterfaceOffsetDidScrollToTop ();
239+
240+
[Watch (4,0)][NoiOS]
241+
[Export ("interfaceOffsetDidScrollToBottom")]
242+
void InterfaceOffsetDidScrollToBottom ();
218243
}
219244

220245
[iOS (8,2)]
@@ -330,6 +355,11 @@ interface WKAccessibility {
330355
[Notification]
331356
[Field ("WKAccessibilityVoiceOverStatusChanged")]
332357
NSString VoiceOverStatusChanged { get; }
358+
359+
[Watch (4,0)][NoiOS]
360+
[Notification]
361+
[Field ("WKAccessibilityReduceMotionStatusDidChangeNotification")]
362+
NSString ReduceMotionStatusDidChangeNotification { get; }
333363
}
334364

335365
[iOS (8,2)]
@@ -414,6 +444,18 @@ interface WKInterfaceDevice {
414444
[Watch (3,0)][NoiOS]
415445
[Export ("crownOrientation")]
416446
WKInterfaceDeviceCrownOrientation CrownOrientation { get; }
447+
448+
[Watch (4,0)][NoiOS]
449+
[Export ("batteryMonitoringEnabled")]
450+
bool BatteryMonitoringEnabled { [Bind ("isBatteryMonitoringEnabled")] get; set; }
451+
452+
[Watch (4,0)][NoiOS]
453+
[Export ("batteryLevel")]
454+
float BatteryLevel { get; }
455+
456+
[Watch (4,0)][NoiOS]
457+
[Export ("batteryState")]
458+
WKInterfaceDeviceBatteryState BatteryState { get; }
417459
}
418460

419461
[iOS (8,2)]
@@ -830,6 +872,26 @@ interface WKExtension {
830872
[Watch (3,0)]
831873
[Export ("applicationState")]
832874
WKApplicationState ApplicationState { get; }
875+
876+
[Watch (4,0)]
877+
[NullAllowed, Export ("visibleInterfaceController")]
878+
WKInterfaceController VisibleInterfaceController { get; }
879+
880+
[Watch (4,0)]
881+
[Export ("isApplicationRunningInDock")]
882+
bool IsApplicationRunningInDock { get; }
883+
884+
[Watch (4,0)]
885+
[Export ("autorotating")]
886+
bool Autorotating { [Bind ("isAutorotating")] get; set; }
887+
888+
[Watch (4,0)]
889+
[Export ("frontmostTimeoutExtended")]
890+
bool FrontmostTimeoutExtended { [Bind ("isFrontmostTimeoutExtended")] get; set; }
891+
892+
[Watch (4,0)]
893+
[Export ("enableWaterLock")]
894+
void EnableWaterLock ();
833895
}
834896

835897
[NoiOS]
@@ -892,6 +954,10 @@ interface WKExtensionDelegate {
892954
[Watch (3,0)]
893955
[Export ("handleWorkoutConfiguration:")]
894956
void HandleWorkoutConfiguration (HKWorkoutConfiguration workoutConfiguration);
957+
958+
[Watch (4,0)]
959+
[Export ("deviceOrientationDidChange")]
960+
void DeviceOrientationDidChange ();
895961
}
896962

897963
[Watch (2,2), NoiOS]
@@ -1024,8 +1090,13 @@ interface WKRefreshBackgroundTask {
10241090
[NullAllowed, Export ("userInfo")]
10251091
INSSecureCoding UserInfo { get; }
10261092

1093+
[Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'SetTaskCompleted (false)' instead.")]
10271094
[Export ("setTaskCompleted")]
10281095
void SetTaskCompleted ();
1096+
1097+
[Watch (4,0)]
1098+
[Export ("setTaskCompletedWithSnapshot:")]
1099+
void SetTaskCompleted (bool refreshSnapshot);
10291100
}
10301101

10311102
[Watch (3,0)][NoiOS]
@@ -1037,9 +1108,14 @@ interface WKApplicationRefreshBackgroundTask {
10371108
[BaseType (typeof (WKRefreshBackgroundTask))]
10381109
interface WKSnapshotRefreshBackgroundTask {
10391110

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

1115+
[Watch (4,0)]
1116+
[Export ("reasonForSnapshot")]
1117+
WKSnapshotReason ReasonForSnapshot { get; }
1118+
10431119
[Export ("setTaskCompletedWithDefaultStateRestored:estimatedSnapshotExpiration:userInfo:")]
10441120
void SetTaskCompleted (bool restoredDefaultState, [NullAllowed] NSDate estimatedSnapshotExpiration, [NullAllowed] INSSecureCoding userInfo);
10451121
}

0 commit comments

Comments
 (0)