Skip to content

Commit afb561b

Browse files
authored
[HealthKit] Implement Xcode 16.0 beta 1-6 changes. (#21146)
There were no changes in beta 2, beta 3, beta 4 or beta 6.
1 parent 22d6e44 commit afb561b

16 files changed

+608
-427
lines changed

src/HealthKit/Enums.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ public enum HKCategoryValueCervicalMucusQuality : long {
369369
[Mac (13, 0)]
370370
[MacCatalyst (13, 1)]
371371
[Native]
372+
[Deprecated (PlatformName.iOS, 18, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
373+
[Deprecated (PlatformName.MacCatalyst, 18, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
374+
[Deprecated (PlatformName.TvOS, 18, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
375+
[Deprecated (PlatformName.WatchOS, 11, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
376+
[Deprecated (PlatformName.MacOSX, 15, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
372377
public enum HKCategoryValueMenstrualFlow : long {
373378
NotApplicable = 0,
374379
Unspecified = 1,
@@ -381,6 +386,16 @@ public enum HKCategoryValueMenstrualFlow : long {
381386
None,
382387
}
383388

389+
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
390+
[Native]
391+
public enum HKCategoryValueVaginalBleeding : long {
392+
Unspecified = 1,
393+
Light = 2,
394+
Medium = 3,
395+
Heavy = 4,
396+
None = 5,
397+
}
398+
384399
/// <summary>Enumerates the results of an ovulation test.</summary>
385400
[Mac (13, 0)]
386401
[MacCatalyst (13, 1)]

src/HealthKit/HKSupportFunctions.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#nullable enable
2+
3+
using System;
4+
using System.Runtime.InteropServices;
5+
6+
using Foundation;
7+
using ObjCRuntime;
8+
9+
namespace HealthKit {
10+
/// <summary>This class contains helper functions for the <see cref="HKStateOfMindValenceClassification" /> enum.</summary>
11+
#if NET
12+
[SupportedOSPlatform ("ios18.0")]
13+
[SupportedOSPlatform ("maccatalyst18.0")]
14+
[SupportedOSPlatform ("macos15.0")]
15+
[UnsupportedOSPlatform ("tvos")]
16+
#else
17+
[Watch (11, 0), NoTV, Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
18+
#endif
19+
public static class HKStateOfMindValence {
20+
[DllImport (Constants.HealthKitLibrary)]
21+
static extern IntPtr HKStateOfMindValenceClassificationForValence (double valence);
22+
23+
/// <summary>Gets the valence classification appropriate for a given valence value.</summary>
24+
/// <param name="valence">The valence value whose classification to get.</param>
25+
/// <returns>The valence classification, or null if the specified valence is outside of the supported range of valence values.</returns>
26+
public static HKStateOfMindValenceClassification? GetClassification (double valence)
27+
{
28+
var nsnumber = Runtime.GetNSObject<NSNumber> (HKStateOfMindValenceClassificationForValence (valence), owns: false);
29+
if (nsnumber is null)
30+
return null;
31+
return (HKStateOfMindValenceClassification) (long) nsnumber.LongValue;
32+
}
33+
}
34+
}

src/frameworks.sources

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,7 @@ HEALTHKIT_SOURCES = \
10081008
HealthKit/HKObjectType.cs \
10091009
HealthKit/HKObsolete.cs \
10101010
HealthKit/HKSampleQuery.cs \
1011+
HealthKit/HKSupportFunctions.cs \
10111012
HealthKit/HKUnit.cs \
10121013

10131014
# HealthKitUI

src/healthkit.cs

Lines changed: 407 additions & 11 deletions
Large diffs are not rendered by default.

tests/cecil-tests/Documentation.KnownFailures.txt

Lines changed: 130 additions & 0 deletions
Large diffs are not rendered by default.

tests/monotouch-test/HealthKit/CategoryTypeIdentifierTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ public void EnumValues_22351 ()
133133
if (!TestRuntime.CheckXcodeVersion (14, 1))
134134
continue;
135135
break;
136+
137+
case HKCategoryTypeIdentifier.BleedingAfterPregnancy:
138+
case HKCategoryTypeIdentifier.BleedingDuringPregnancy:
139+
if (!TestRuntime.CheckXcodeVersion (16, 0))
140+
continue;
141+
break;
136142
default:
137143
if (!TestRuntime.CheckXcodeVersion (7, 0))
138144
continue;

tests/monotouch-test/HealthKit/QuantityTypeIdentifierTest.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ public void EnumValues_22351 ()
125125
if (!TestRuntime.CheckXcodeVersion (15, 0))
126126
continue;
127127
break;
128+
case HKQuantityTypeIdentifier.CrossCountrySkiingSpeed:
129+
case HKQuantityTypeIdentifier.DistanceCrossCountrySkiing:
130+
case HKQuantityTypeIdentifier.DistancePaddleSports:
131+
case HKQuantityTypeIdentifier.DistanceRowing:
132+
case HKQuantityTypeIdentifier.DistanceSkatingSports:
133+
case HKQuantityTypeIdentifier.EstimatedWorkoutEffortScore:
134+
case HKQuantityTypeIdentifier.PaddleSportsSpeed:
135+
case HKQuantityTypeIdentifier.RowingSpeed:
136+
case HKQuantityTypeIdentifier.WorkoutEffortScore:
137+
if (!TestRuntime.CheckXcodeVersion (16, 0))
138+
continue;
139+
break;
128140
}
129141

130142
try {

tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-HealthKit.todo

Lines changed: 0 additions & 70 deletions
This file was deleted.

tests/xtro-sharpie/api-annotations-dotnet/iOS-HealthKit.todo

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
# intro reports them as not present
1+
# xtro says 'workoutSessionMirroringStartHandler' exists on macOS, introspection disagrees.
2+
# Headers doesn't say neither that it's available nor that it's not on macOS, which is probably why xtro picks it up (defaults to available).
3+
# Assuming that the lack of unavailability in the headers is a mistake, so remove from macOS.
24
!missing-selector! HKHealthStore::setWorkoutSessionMirroringStartHandler: not bound
35
!missing-selector! HKHealthStore::workoutSessionMirroringStartHandler not bound

tests/xtro-sharpie/api-annotations-dotnet/macOS-HealthKit.todo

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)