Whats new implementation.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
using Wino.Core.Domain.Models.Updates;
|
||||
|
||||
namespace Wino.Core.Domain;
|
||||
|
||||
@@ -8,4 +9,6 @@ namespace Wino.Core.Domain;
|
||||
[JsonSerializable(typeof(int))]
|
||||
[JsonSerializable(typeof(List<string>))]
|
||||
[JsonSerializable(typeof(bool))]
|
||||
[JsonSerializable(typeof(UpdateNotes))]
|
||||
[JsonSerializable(typeof(List<UpdateNoteSection>))]
|
||||
public partial class BasicTypesJsonContext : JsonSerializerContext;
|
||||
|
||||
@@ -19,6 +19,7 @@ public static class Constants
|
||||
public const string ToastModeKey = nameof(ToastModeKey);
|
||||
public const string ToastModeMail = nameof(ToastModeMail);
|
||||
public const string ToastModeCalendar = nameof(ToastModeCalendar);
|
||||
public const string ToastMigrationRequiredKey = nameof(ToastMigrationRequiredKey);
|
||||
|
||||
public const string ClientLogFile = "Client_.log";
|
||||
public const string ServerLogFile = "Server_.log";
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Wino.Core.Domain.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a one-time app or data migration that runs when a user updates to a new version.
|
||||
/// </summary>
|
||||
public interface IAppMigration
|
||||
{
|
||||
/// <summary>Gets the unique identifier for this migration, used to track completion in local settings.</summary>
|
||||
string MigrationId { get; }
|
||||
|
||||
/// <summary>Executes the migration logic.</summary>
|
||||
Task ExecuteAsync();
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Models.Accounts;
|
||||
using Wino.Core.Domain.Models.Common;
|
||||
using Wino.Core.Domain.Models.Printing;
|
||||
using Wino.Core.Domain.Models.Updates;
|
||||
|
||||
namespace Wino.Core.Domain.Interfaces;
|
||||
|
||||
@@ -30,4 +31,10 @@ public interface IDialogServiceBase
|
||||
Task<List<SharedFile>> PickFilesAsync(params object[] typeFilters);
|
||||
Task<string> PickFilePathAsync(string saveFileName);
|
||||
Task<WebView2PrintSettingsModel> ShowPrintDialogAsync(WebView2PrintSettingsModel initialSettings = null);
|
||||
|
||||
/// <summary>
|
||||
/// Presents the "What's New" dialog for the current version.
|
||||
/// This dialog is undismissable and runs any pending migrations when the user clicks "Get Started".
|
||||
/// </summary>
|
||||
Task ShowWhatIsNewDialogAsync(UpdateNotes notes);
|
||||
}
|
||||
|
||||
@@ -40,4 +40,10 @@ public interface INotificationBuilder
|
||||
/// Creates a calendar reminder toast for the specified calendar item.
|
||||
/// </summary>
|
||||
Task CreateCalendarReminderNotificationAsync(CalendarItem calendarItem, long reminderDurationInSeconds);
|
||||
|
||||
/// <summary>
|
||||
/// Shows a notification that a migration is required for the new app version.
|
||||
/// Synchronization is stopped and the user is prompted to open the app.
|
||||
/// </summary>
|
||||
void CreateMigrationRequiredNotification();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Models.Updates;
|
||||
|
||||
namespace Wino.Core.Domain.Interfaces;
|
||||
|
||||
public interface IUpdateManager
|
||||
{
|
||||
/// <summary>Loads and parses the update notes for the current version from the bundled asset file.</summary>
|
||||
Task<UpdateNotes> GetLatestUpdateNotesAsync();
|
||||
|
||||
/// <summary>Returns true if the current version's update notes have not yet been shown to the user.</summary>
|
||||
bool ShouldShowUpdateNotes();
|
||||
|
||||
/// <summary>Stores a flag in local settings indicating the update notes for the current version have been seen.</summary>
|
||||
void MarkUpdateNotesAsSeen();
|
||||
|
||||
/// <summary>Returns true if any registered migration has not yet been completed.</summary>
|
||||
bool HasPendingMigrations();
|
||||
|
||||
/// <summary>Runs all pending migrations in order and marks each as completed in local settings.</summary>
|
||||
Task RunPendingMigrationsAsync();
|
||||
|
||||
/// <summary>Registers migrations to be tracked and executed by this manager.</summary>
|
||||
void RegisterMigrations(IEnumerable<IAppMigration> migrations);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Updates;
|
||||
|
||||
public class UpdateNoteSection
|
||||
{
|
||||
[JsonPropertyName("title")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("imageUrl")]
|
||||
public string ImageUrl { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("imageWidth")]
|
||||
public double? ImageWidth { get; set; }
|
||||
|
||||
[JsonPropertyName("imageHeight")]
|
||||
public double? ImageHeight { get; set; }
|
||||
|
||||
/// <summary>Gets the image width for binding, returning NaN for auto-sizing when not specified.</summary>
|
||||
public double ActualImageWidth => ImageWidth ?? double.NaN;
|
||||
|
||||
/// <summary>Gets the image height for binding, returning NaN for auto-sizing when not specified.</summary>
|
||||
public double ActualImageHeight => ImageHeight ?? double.NaN;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Updates;
|
||||
|
||||
public class UpdateNotes
|
||||
{
|
||||
[JsonPropertyName("hasMigrations")]
|
||||
public bool HasMigrations { get; set; }
|
||||
|
||||
[JsonPropertyName("sections")]
|
||||
public List<UpdateNoteSection> Sections { get; set; } = [];
|
||||
}
|
||||
@@ -983,5 +983,8 @@
|
||||
"CalendarAccountSettings_DefaultShowAs": "Default Show As Status",
|
||||
"CalendarAccountSettings_DefaultShowAsDescription": "Default availability status for new events created with this account",
|
||||
"CalendarAccountSettings_PrimaryCalendar": "Primary Calendar",
|
||||
"CalendarAccountSettings_PrimaryCalendarDescription": "Mark this calendar as the primary calendar for the account"
|
||||
"CalendarAccountSettings_PrimaryCalendarDescription": "Mark this calendar as the primary calendar for the account",
|
||||
"WhatIsNew_GetStartedButton": "Get Started",
|
||||
"WhatIsNew_MigrationNotification_Title": "Wino Mail Updated",
|
||||
"WhatIsNew_MigrationNotification_Message": "Open the app to complete the update and see what's new."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user