Skip to content

Commit

Permalink
[HealthKit] Implement Xcode 16.0 beta 1-6 changes. (#21146)
Browse files Browse the repository at this point in the history
There were no changes in beta 2, beta 3, beta 4 or beta 6.
  • Loading branch information
rolfbjarne committed Sep 5, 2024
1 parent 22d6e44 commit afb561b
Show file tree
Hide file tree
Showing 16 changed files with 608 additions and 427 deletions.
15 changes: 15 additions & 0 deletions src/HealthKit/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ public enum HKCategoryValueCervicalMucusQuality : long {
[Mac (13, 0)]
[MacCatalyst (13, 1)]
[Native]
[Deprecated (PlatformName.iOS, 18, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
[Deprecated (PlatformName.MacCatalyst, 18, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
[Deprecated (PlatformName.TvOS, 18, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
[Deprecated (PlatformName.WatchOS, 11, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
[Deprecated (PlatformName.MacOSX, 15, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
public enum HKCategoryValueMenstrualFlow : long {
NotApplicable = 0,
Unspecified = 1,
Expand All @@ -381,6 +386,16 @@ public enum HKCategoryValueMenstrualFlow : long {
None,
}

[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Native]
public enum HKCategoryValueVaginalBleeding : long {
Unspecified = 1,
Light = 2,
Medium = 3,
Heavy = 4,
None = 5,
}

/// <summary>Enumerates the results of an ovulation test.</summary>
[Mac (13, 0)]
[MacCatalyst (13, 1)]
Expand Down
34 changes: 34 additions & 0 deletions src/HealthKit/HKSupportFunctions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#nullable enable

using System;
using System.Runtime.InteropServices;

using Foundation;
using ObjCRuntime;

namespace HealthKit {
/// <summary>This class contains helper functions for the <see cref="HKStateOfMindValenceClassification" /> enum.</summary>
#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[UnsupportedOSPlatform ("tvos")]
#else
[Watch (11, 0), NoTV, Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
public static class HKStateOfMindValence {
[DllImport (Constants.HealthKitLibrary)]
static extern IntPtr HKStateOfMindValenceClassificationForValence (double valence);

/// <summary>Gets the valence classification appropriate for a given valence value.</summary>
/// <param name="valence">The valence value whose classification to get.</param>
/// <returns>The valence classification, or null if the specified valence is outside of the supported range of valence values.</returns>
public static HKStateOfMindValenceClassification? GetClassification (double valence)
{
var nsnumber = Runtime.GetNSObject<NSNumber> (HKStateOfMindValenceClassificationForValence (valence), owns: false);
if (nsnumber is null)
return null;
return (HKStateOfMindValenceClassification) (long) nsnumber.LongValue;
}
}
}
1 change: 1 addition & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,7 @@ HEALTHKIT_SOURCES = \
HealthKit/HKObjectType.cs \
HealthKit/HKObsolete.cs \
HealthKit/HKSampleQuery.cs \
HealthKit/HKSupportFunctions.cs \
HealthKit/HKUnit.cs \

# HealthKitUI
Expand Down
418 changes: 407 additions & 11 deletions src/healthkit.cs

Large diffs are not rendered by default.

130 changes: 130 additions & 0 deletions tests/cecil-tests/Documentation.KnownFailures.txt

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions tests/monotouch-test/HealthKit/CategoryTypeIdentifierTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ public void EnumValues_22351 ()
if (!TestRuntime.CheckXcodeVersion (14, 1))
continue;
break;

case HKCategoryTypeIdentifier.BleedingAfterPregnancy:
case HKCategoryTypeIdentifier.BleedingDuringPregnancy:
if (!TestRuntime.CheckXcodeVersion (16, 0))
continue;
break;
default:
if (!TestRuntime.CheckXcodeVersion (7, 0))
continue;
Expand Down
12 changes: 12 additions & 0 deletions tests/monotouch-test/HealthKit/QuantityTypeIdentifierTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ public void EnumValues_22351 ()
if (!TestRuntime.CheckXcodeVersion (15, 0))
continue;
break;
case HKQuantityTypeIdentifier.CrossCountrySkiingSpeed:
case HKQuantityTypeIdentifier.DistanceCrossCountrySkiing:
case HKQuantityTypeIdentifier.DistancePaddleSports:
case HKQuantityTypeIdentifier.DistanceRowing:
case HKQuantityTypeIdentifier.DistanceSkatingSports:
case HKQuantityTypeIdentifier.EstimatedWorkoutEffortScore:
case HKQuantityTypeIdentifier.PaddleSportsSpeed:
case HKQuantityTypeIdentifier.RowingSpeed:
case HKQuantityTypeIdentifier.WorkoutEffortScore:
if (!TestRuntime.CheckXcodeVersion (16, 0))
continue;
break;
}

try {
Expand Down

This file was deleted.

68 changes: 0 additions & 68 deletions tests/xtro-sharpie/api-annotations-dotnet/iOS-HealthKit.todo

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# intro reports them as not present
# xtro says 'workoutSessionMirroringStartHandler' exists on macOS, introspection disagrees.
# 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).
# Assuming that the lack of unavailability in the headers is a mistake, so remove from macOS.
!missing-selector! HKHealthStore::setWorkoutSessionMirroringStartHandler: not bound
!missing-selector! HKHealthStore::workoutSessionMirroringStartHandler not bound
68 changes: 0 additions & 68 deletions tests/xtro-sharpie/api-annotations-dotnet/macOS-HealthKit.todo

This file was deleted.

Loading

8 comments on commit afb561b

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.