Add subscription pricing and Base drawing limit
This commit is contained in:
1 parent
ad64d6def0
commit
6a675ce635
15 files changed
+384
-37
No files matched your search
@@ -235,6 +235,10 @@
|
||||
|
||||
<section class="panel-section">
|
||||
<h2>Disegni e misure</h2>
|
||||
@if (!Entitlements.HasProAccess)
|
||||
{
|
||||
<small class="field-help">@L("drawings.base.limit")</small>
|
||||
}
|
||||
<div class="button-row">
|
||||
<button class="secondary-command" @onclick="UndoMapChange">Annulla</button>
|
||||
<button class="secondary-command" @onclick="RedoMapChange">Ripristina</button>
|
||||
@@ -494,8 +498,8 @@
|
||||
<p>@L("settings.pro.note")</p>
|
||||
<p>@L("settings.pro.offline")</p>
|
||||
<div class="button-row">
|
||||
<button class="primary-command" @onclick='() => SubscribeGooglePro(EntitlementService.MonthlyBasePlanId)' disabled="@BillingBusy">@L("settings.pro.monthly")</button>
|
||||
<button class="primary-command" @onclick='() => SubscribeGooglePro(EntitlementService.YearlyBasePlanId)' disabled="@BillingBusy">@L("settings.pro.yearly")</button>
|
||||
<button class="primary-command" @onclick='() => SubscribeGooglePro(EntitlementService.MonthlyBasePlanId)' disabled="@BillingBusy">@MonthlyPlanLabel</button>
|
||||
<button class="primary-command" @onclick='() => SubscribeGooglePro(EntitlementService.YearlyBasePlanId)' disabled="@BillingBusy">@YearlyPlanLabel</button>
|
||||
</div>
|
||||
<div class="button-row">
|
||||
<button class="secondary-command" @onclick="RestorePurchases" disabled="@BillingBusy">@L("settings.pro.restore")</button>
|
||||
@@ -725,6 +729,8 @@
|
||||
private string MeasurementPreference { get; set; } = "auto";
|
||||
private string ManualLicenseCode { get; set; } = string.Empty;
|
||||
private string ManualLicenseMessage { get; set; } = string.Empty;
|
||||
private string MonthlyPrice { get; set; } = string.Empty;
|
||||
private string YearlyPrice { get; set; } = string.Empty;
|
||||
private bool BillingBusy { get; set; }
|
||||
private string Status { get; set; } = "online";
|
||||
private string SelectedBaseLayer { get; set; } = "satellite";
|
||||
@@ -784,6 +790,12 @@
|
||||
private string UpdateDownloadUrl { get; set; } = string.Empty;
|
||||
private string UpdateReleaseNotes { get; set; } = string.Empty;
|
||||
private string ProUpgradeText => "Funzione inclusa in LME Pro. I dati esistenti restano consultabili.";
|
||||
private string MonthlyPlanLabel => string.IsNullOrWhiteSpace(MonthlyPrice)
|
||||
? L("settings.pro.monthly")
|
||||
: $"{L("settings.pro.monthly")} - {MonthlyPrice}/mese";
|
||||
private string YearlyPlanLabel => string.IsNullOrWhiteSpace(YearlyPrice)
|
||||
? L("settings.pro.yearly")
|
||||
: $"{L("settings.pro.yearly")} - {YearlyPrice}/anno";
|
||||
private CancellationTokenSource? CatalogCancellation { get; set; }
|
||||
private CancellationTokenSource? GpsLookupCancellation { get; set; }
|
||||
private CancellationTokenSource? ProjectAutoSaveCancellation { get; set; }
|
||||
@@ -892,6 +904,7 @@
|
||||
await ApplyEntitlementsToMapAsync();
|
||||
await ApplyFlagPreferencesToMapAsync();
|
||||
await ApplyAdvancedOptions();
|
||||
await RefreshBillingStateAsync();
|
||||
await CenterOnInitialLocationAsync();
|
||||
await MigrateLegacyProjectAsync();
|
||||
var offlineCount = await JS.InvokeAsync<int>("lmeMap.getOfflineTileStats");
|
||||
@@ -2118,9 +2131,26 @@
|
||||
|
||||
private Task ApplyEntitlementsToMapAsync() => JS.InvokeVoidAsync("lmeMap.setEntitlements", new
|
||||
{
|
||||
advancedGeometry = CanUse(AppFeatures.AdvancedGeometry)
|
||||
advancedGeometry = CanUse(AppFeatures.AdvancedGeometry),
|
||||
maxDrawingObjects = Entitlements.HasProAccess ? (int?)null : EntitlementService.BaseDrawingObjectLimit,
|
||||
drawingLimitMessage = L("drawings.base.limit.reached")
|
||||
}).AsTask();
|
||||
|
||||
private async Task RefreshBillingStateAsync()
|
||||
{
|
||||
var plans = await Entitlements.GetSubscriptionPlansAsync();
|
||||
MonthlyPrice = plans.FirstOrDefault(plan => plan.BasePlanId == EntitlementService.MonthlyBasePlanId)?.FormattedPrice
|
||||
?? string.Empty;
|
||||
YearlyPrice = plans.FirstOrDefault(plan => plan.BasePlanId == EntitlementService.YearlyBasePlanId)?.FormattedPrice
|
||||
?? string.Empty;
|
||||
|
||||
if (DeviceInfo.Current.Platform == DevicePlatform.Android)
|
||||
{
|
||||
await Entitlements.RestorePurchasesAsync();
|
||||
await ApplyEntitlementsToMapAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RestorePurchases()
|
||||
{
|
||||
BillingBusy = true;
|
||||
|
||||
Reference in new issue
Block a user