From 4ba3dd2d96beb2b5faeb6b75b5994785895e77aa Mon Sep 17 00:00:00 2001 From: Reitberger Date: Sun, 7 Dec 2025 14:50:09 +0100 Subject: [PATCH 1/2] Fixed `VersionMessage` processing Fixed #304 --- src/SharedMauiCoreLibrary.Licensing/LicenseManager.cs | 9 +++++++-- .../Utilities/AppUpdateManager.cs | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/SharedMauiCoreLibrary.Licensing/LicenseManager.cs b/src/SharedMauiCoreLibrary.Licensing/LicenseManager.cs index 7a7c4b9..ba5739c 100644 --- a/src/SharedMauiCoreLibrary.Licensing/LicenseManager.cs +++ b/src/SharedMauiCoreLibrary.Licensing/LicenseManager.cs @@ -354,11 +354,13 @@ public async Task GetLatestApplicationVersionAsync(IL WooCodeVersionResponse[] wooResult = await QueryLatestApplicationVersionFromWooCommerceAsync(WooSoftwareLicenseAction.CodeVersion, license).ConfigureAwait(false); if (wooResult?.All(result => result.Status == "success" && (result.ErrorCode == "s403")) == true) { + WooCodeVersionResponse res = wooResult.First(); result = new() { Success = true, - //Message = string.Join("|", wooResult?.Select(result => result.VersionMessage)), + Message = res.VersionMessage.UpgradeNotice, TimeStamp = DateTimeOffset.Now, + Version = res.VersionMessage.Version }; } else @@ -394,11 +396,13 @@ public async Task GetLatestApplicationVersionAsync(st WooCodeVersionResponse[] wooResult = await QueryLatestApplicationVersionFromWooCommerceAsync(WooSoftwareLicenseAction.CodeVersion, productCode).ConfigureAwait(false); if (wooResult?.All(result => result.Status == "success" && (result.ErrorCode == "s403")) == true) { + WooCodeVersionResponse res = wooResult.First(); result = new() { Success = true, - //Message = string.Join("|", wooResult?.Select(result => result.VersionMessage)), + Message = res.VersionMessage.UpgradeNotice, TimeStamp = DateTimeOffset.Now, + Version = res.VersionMessage.Version }; } else @@ -408,6 +412,7 @@ public async Task GetLatestApplicationVersionAsync(st Success = false, //Message = string.Join("|", wooResult?.Select(result => result.VersionMessage)), TimeStamp = DateTimeOffset.Now, + Version = "0.0.0", }; } break; diff --git a/src/SharedMauiCoreLibrary.Licensing/Utilities/AppUpdateManager.cs b/src/SharedMauiCoreLibrary.Licensing/Utilities/AppUpdateManager.cs index ae47855..9b5bc9f 100644 --- a/src/SharedMauiCoreLibrary.Licensing/Utilities/AppUpdateManager.cs +++ b/src/SharedMauiCoreLibrary.Licensing/Utilities/AppUpdateManager.cs @@ -46,7 +46,9 @@ public override async Task CheckForUpdateAsync(string productCode, string? IsCheckingForUpdates = true; if (DeviceInfo.Platform == DevicePlatform.WinUI) { - IApplicationVersionResult? res = await LicenseManager.GetLatestApplicationVersionAsync(productCode: productCode, target: Enums.LicenseServerTarget.WooCommerce, null, null); + IApplicationVersionResult? res = await LicenseManager + .GetLatestApplicationVersionAsync(productCode: productCode, target: Enums.LicenseServerTarget.WooCommerce, null, null) + .ConfigureAwait(false); OnUpdateAvailable(new() { LatestVersion = new(res?.Version ?? "0.0.0"), From 366dda3c1688220197e550e9ad85e36c503eaf72 Mon Sep 17 00:00:00 2001 From: Andreas Date: Sun, 7 Dec 2025 15:41:33 +0100 Subject: [PATCH 2/2] Finalized PR --- .../Utilities/AppUpdateManager.cs | 7 ++++++- .../Models/FirebaseHandler.cs | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/SharedMauiCoreLibrary.Licensing/Utilities/AppUpdateManager.cs b/src/SharedMauiCoreLibrary.Licensing/Utilities/AppUpdateManager.cs index 9b5bc9f..53256f7 100644 --- a/src/SharedMauiCoreLibrary.Licensing/Utilities/AppUpdateManager.cs +++ b/src/SharedMauiCoreLibrary.Licensing/Utilities/AppUpdateManager.cs @@ -44,7 +44,7 @@ public override async Task CheckForUpdateAsync(string productCode, string? return updateAvailable; } IsCheckingForUpdates = true; - if (DeviceInfo.Platform == DevicePlatform.WinUI) + if (DeviceInfo.Platform == DevicePlatform.WinUI || DeviceInfo.Platform == DevicePlatform.MacCatalyst) { IApplicationVersionResult? res = await LicenseManager .GetLatestApplicationVersionAsync(productCode: productCode, target: Enums.LicenseServerTarget.WooCommerce, null, null) @@ -54,6 +54,11 @@ public override async Task CheckForUpdateAsync(string productCode, string? LatestVersion = new(res?.Version ?? "0.0.0"), }); } + else + { + OnClientIncompatibleWithNewVersion(); + return updateAvailable; + } IsCheckingForUpdates = false; return updateAvailable; } diff --git a/src/SharedNetCoreLibrary.Firebase/Models/FirebaseHandler.cs b/src/SharedNetCoreLibrary.Firebase/Models/FirebaseHandler.cs index 2900639..342db72 100644 --- a/src/SharedNetCoreLibrary.Firebase/Models/FirebaseHandler.cs +++ b/src/SharedNetCoreLibrary.Firebase/Models/FirebaseHandler.cs @@ -36,6 +36,7 @@ public static FirebaseHandler? Instance #endregion #region Properties + [ObservableProperty] public partial ConcurrentDictionary Subscriptions { get; set; } = []; #endregion