-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Integrate common ISensor interface (net10.0) #30135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: net10.0
Are you sure you want to change the base?
Integrate common ISensor interface (net10.0) #30135
Conversation
Updates sensor and device interfaces by integrating common capabilities into base interfaces, namely ISensor and IDeviceCapabilities. Simplifies code maintenance and enhances consistency across devices.
Hey there @@framinosona! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new ISensor
base interface and a shared IDeviceCapabilities
interface, then updates all existing sensor and capability APIs to inherit from these to remove duplicate members.
- Introduces
ISensor
withIsMonitoring
,Start
, andStop
- Introduces
IDeviceCapabilities
withIsSupported
- Updates all sensor interfaces and other device‐capability APIs (e.g., vibration, haptics, phone dialer, app actions) to derive from these new bases
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/Essentials/src/Sensors/ISensors.shared.cs | Adds new ISensor interface |
src/Essentials/src/Sensors/IDeviceCapabilities.shared.cs | Adds new IDeviceCapabilities interface |
src/Essentials/src/Vibration/Vibration.shared.cs | Updates IVibration to extend IDeviceCapabilities |
src/Essentials/src/HapticFeedback/HapticFeedback.shared.cs | Updates IHapticFeedback to extend IDeviceCapabilities |
src/Essentials/src/PhoneDialer/PhoneDialer.shared.cs | Updates IPhoneDialer to extend IDeviceCapabilities |
src/Essentials/src/AppActions/AppActions.shared.cs | Updates IAppActions to extend IDeviceCapabilities |
src/Essentials/src/Sensors/* | Updates all sensor interfaces to extend ISensor |
src/Essentials/src/PublicAPI/*/PublicAPI.Unshipped.txt | Exposes new interfaces in public API listings |
Comments suppressed due to low confidence (2)
src/Essentials/src/Sensors/ISensors.shared.cs:12
- Add automated unit tests for the new ISensor and IDeviceCapabilities interfaces under TestCases.Shared.Tests and ensure corresponding UI tests in TestCases.HostApp with unique AutomationIds.
public interface ISensor : IDeviceCapabilities
src/Essentials/src/Sensors/ISensors.shared.cs:1
- Update the public XML documentation in the /docs/ folder to describe the new ISensor and IDeviceCapabilities interfaces, ensuring consistency between docs and code.
#nullable enable
/azp run MAUI-public |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
84 errors that look similar to this
C:\a_work\1\s\src\Essentials\src\PublicAPI\net\PublicAPI.Shipped.txt(673,1): error RS0017: Symbol 'Microsoft.Maui.Devices.Sensors.IMagnetometer.Stop() -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md) [C:\a_work\1\s\src\Essentials\src\Essentials.csproj::TargetFramework=net10.0]
C:\a_work\1\s\src\Essentials\src\PublicAPI\net\PublicAPI.Shipped.txt(675,1): error RS0017: Symbol 'Microsoft.Maui.Devices.Sensors.IOrientationSensor.IsMonitoring.get -> bool' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md) [C:\a_work\1\s\src\Essentials\src\Essentials.csproj::TargetFramework=net10.0]
C:\a_work\1\s\src\Essentials\src\PublicAPI\net\PublicAPI.Shipped.txt(676,1): error RS0017: Symbol 'Microsoft.Maui.Devices.Sensors.IOrientationSensor.IsSupported.get -> bool' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md) [C:\a_work\1\s\src\Essentials\src\Essentials.csproj::TargetFramework=net10.0]
C:\a_work\1\s\src\Essentials\src\PublicAPI\net\PublicAPI.Shipped.txt(678,1): error RS0017: Symbol 'Microsoft.Maui.Devices.Sensors.IOrientationSensor.Start(Microsoft.Maui.Devices.Sensors.SensorSpeed sensorSpeed) -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md) [C:\a_work\1\s\src\Essentials\src\Essentials.csproj::TargetFramework=net10.0]
C:\a_work\1\s\src\Essentials\src\PublicAPI\net\PublicAPI.Shipped.txt(679,1): error RS0017: Symbol 'Microsoft.Maui.Devices.Sensors.IOrientationSensor.Stop() -> void' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md) [C:\a_work\1\s\src\Essentials\src\Essentials.csproj::TargetFramework=net10.0]
@jfversluis Of course ... When I add them to Unshipped, I need to remove them in the Shipped ... I just pushed. It should fix it :) |
/azp run MAUI-public |
Commenter does not have sufficient privileges for PR 30135 in repo dotnet/maui |
Ohhh hold on, just discovered there is REMOVED tag ! Will use that instead |
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Extends sensor interfaces such as IAccelerometer, IBarometer, ICompass, IGyroscope, IMagnetometer, and IOrientationSensor with a common ISensor interface to unify capabilities. Eliminates redundant IsSupported and IsMonitoring properties and Start/Stop methods from individual sensor interfaces. Updates IAppActions, IHapticFeedback, IPhoneDialer, and IVibration to extend from IDeviceCapabilities for uniformity. Improves code maintainability by reducing duplicate functionality.
Relates to codebase cleanup and standardization.
(net9 PR : #30121)