diff --git a/src/Uno.UWP/System/Profile/AnalyticsInfo.Interop.wasm.cs b/src/Uno.UWP/System/Profile/AnalyticsInfo.Interop.wasm.cs index 1b6547e50bd2..f4140e10634f 100644 --- a/src/Uno.UWP/System/Profile/AnalyticsInfo.Interop.wasm.cs +++ b/src/Uno.UWP/System/Profile/AnalyticsInfo.Interop.wasm.cs @@ -7,7 +7,11 @@ internal partial class AnalyticsInfo { internal static partial class NativeMethods { + private const string JsType = "globalThis.Windows.System.Profile.AnalyticsInfo"; + + [JSImport($"{JsType}.getDeviceType")] + internal static partial string GetDeviceType(); } } } -#endif \ No newline at end of file +#endif diff --git a/src/Uno.UWP/System/Profile/AnalyticsInfo.wasm.cs b/src/Uno.UWP/System/Profile/AnalyticsInfo.wasm.cs index 6952b010b680..119bf795e285 100644 --- a/src/Uno.UWP/System/Profile/AnalyticsInfo.wasm.cs +++ b/src/Uno.UWP/System/Profile/AnalyticsInfo.wasm.cs @@ -10,11 +10,19 @@ namespace Windows.System.Profile { public static partial class AnalyticsInfo { +#if !NET7_0_OR_GREATER private const string JsType = "Windows.System.Profile.AnalyticsInfo"; +#endif private static UnoDeviceForm GetDeviceForm() { - var typeString = WebAssemblyRuntime.InvokeJS($"{JsType}.getDeviceType()"); + var typeString = +#if NET7_0_OR_GREATER + NativeMethods.GetDeviceType(); +#else + WebAssemblyRuntime.InvokeJS($"{JsType}.getDeviceType()"); +#endif + if (Enum.TryParse(typeString, true, out UnoDeviceForm deviceForm)) { return deviceForm;