Skip to content

Commit

Permalink
feat: Annotate Magnetometer
Browse files Browse the repository at this point in the history
  • Loading branch information
ebariche committed Nov 25, 2022
1 parent d8ef246 commit 760d7b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/Uno.UI/LinkerDefinition.Wasm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
<type fullname="Uno.Devices.Enumeration.Internal.Providers.Midi.MidiDeviceConnectionWatcher">
<method name="DispatchStateChanged" />
</type>
<type fullname="Windows.Devices.Sensors.Magnetometer">
<method name="DispatchReading" />
</type>
<type fullname="Windows.Networking.Connectivity.NetworkInformation">
<method name="DispatchStatusChanged" />
</type>
Expand Down
3 changes: 2 additions & 1 deletion src/Uno.UWP/Devices/Sensors/Magnetometer.wasm.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#if __WASM__
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Uno;
using Uno.Devices.Sensors.Helpers;

Expand All @@ -12,6 +13,7 @@ public partial class Magnetometer

private DateTimeOffset _lastReading = DateTimeOffset.MinValue;

[DynamicDependency(nameof(DispatchReading))]
private Magnetometer()
{
}
Expand Down Expand Up @@ -52,7 +54,6 @@ private void StopReading()
/// <param name="y">Magnetic field Y</param>
/// <param name="z">Magnetic field Z</param>
/// <returns>0 - needed to bind method from WASM</returns>
[Preserve]
public static int DispatchReading(float x, float y, float z)
{
if (_instance == null)
Expand Down

0 comments on commit 760d7b1

Please sign in to comment.