Skip to content

Commit 760d7b1

Browse files
committed
feat: Annotate Magnetometer
1 parent d8ef246 commit 760d7b1

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/Uno.UI/LinkerDefinition.Wasm.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@
5151
<type fullname="Uno.Devices.Enumeration.Internal.Providers.Midi.MidiDeviceConnectionWatcher">
5252
<method name="DispatchStateChanged" />
5353
</type>
54-
<type fullname="Windows.Devices.Sensors.Magnetometer">
55-
<method name="DispatchReading" />
56-
</type>
5754
<type fullname="Windows.Networking.Connectivity.NetworkInformation">
5855
<method name="DispatchStatusChanged" />
5956
</type>

src/Uno.UWP/Devices/Sensors/Magnetometer.wasm.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#if __WASM__
22
using System;
33
using System.Diagnostics;
4+
using System.Diagnostics.CodeAnalysis;
45
using Uno;
56
using Uno.Devices.Sensors.Helpers;
67

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

1314
private DateTimeOffset _lastReading = DateTimeOffset.MinValue;
1415

16+
[DynamicDependency(nameof(DispatchReading))]
1517
private Magnetometer()
1618
{
1719
}
@@ -52,7 +54,6 @@ private void StopReading()
5254
/// <param name="y">Magnetic field Y</param>
5355
/// <param name="z">Magnetic field Z</param>
5456
/// <returns>0 - needed to bind method from WASM</returns>
55-
[Preserve]
5657
public static int DispatchReading(float x, float y, float z)
5758
{
5859
if (_instance == null)

0 commit comments

Comments
 (0)