UWP .NET9 (#555)
* Ground work for NET9 UWP switch. * Add launch settings for Wino.Mail * Added new test WAP project * fix platforms in slnx solution * ManagePackageVersionsCentrally set default * Fixing assets and couple issues with the new packaging project. * Add back markdown * Fix nuget warnings * FIx error in WAP about build tools * Add build.props with default language preview * Some AOT compilation progress. * More AOT stuff. * Remove deprecated protocol auth activation handler. * Fix remaining protocol handler for google auth. * Even more AOT * More more AOT fixes * Fix a few more AOT warnings * Fix signature editor AOT * Fix composer and renderer AOT JSON * Outlook Sync AOT * Fixing bundle generation and package signing. --------- Co-authored-by: Burak Kaan Köse <bkaankose@outlook.com>
This commit is contained in:
@@ -4,13 +4,13 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using CommunityToolkit.WinUI.Controls;
|
||||
using EmailValidation;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Toolkit.Uwp.Helpers;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using MimeKit;
|
||||
@@ -27,6 +27,7 @@ using Windows.UI.Xaml.Navigation;
|
||||
using Wino.Core.Domain;
|
||||
using Wino.Core.Domain.Entities.Shared;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models;
|
||||
using Wino.Core.Domain.Models.Reader;
|
||||
using Wino.Core.UWP.Extensions;
|
||||
using Wino.Mail.ViewModels.Data;
|
||||
@@ -215,7 +216,7 @@ namespace Wino.Views
|
||||
}
|
||||
}
|
||||
|
||||
await InvokeScriptSafeAsync($"insertImages({JsonSerializer.Serialize(imagesInformation)});");
|
||||
await InvokeScriptSafeAsync($"insertImages({JsonSerializer.Serialize(imagesInformation, ComposerPageJsonContext.Default.ListImageInfo)});");
|
||||
}
|
||||
}
|
||||
// State should be reset even when an exception occurs, otherwise the UI will be stuck in a dragging state.
|
||||
@@ -227,7 +228,7 @@ namespace Wino.Views
|
||||
|
||||
static async Task<string> GetDataURL(StorageFile file)
|
||||
{
|
||||
return $"data:image/{file.FileType.Replace(".", "")};base64,{Convert.ToBase64String(await file.ReadBytesAsync())}";
|
||||
return $"data:image/{file.FileType.Replace(".", "")};base64,{Convert.ToBase64String(await file.ToByteArrayAsync())}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,22 +321,6 @@ namespace Wino.Views
|
||||
await InvokeScriptSafeAsync($"toggleToolbar('{enable}');");
|
||||
}
|
||||
|
||||
public async Task<string> ExecuteScriptFunctionAsync(string functionName, params object[] parameters)
|
||||
{
|
||||
string script = functionName + "(";
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
{
|
||||
script += JsonSerializer.Serialize(parameters[i]);
|
||||
if (i < parameters.Length - 1)
|
||||
{
|
||||
script += ", ";
|
||||
}
|
||||
}
|
||||
script += ");";
|
||||
|
||||
return await Chromium.ExecuteScriptAsync(script);
|
||||
}
|
||||
|
||||
private async Task<string> InvokeScriptSafeAsync(string function)
|
||||
{
|
||||
if (Chromium == null) return string.Empty;
|
||||
@@ -404,11 +389,11 @@ namespace Wino.Views
|
||||
|
||||
if (string.IsNullOrEmpty(htmlBody))
|
||||
{
|
||||
await ExecuteScriptFunctionAsync("RenderHTML", " ");
|
||||
await Chromium.ExecuteScriptFunctionAsync("RenderHTML", parameters: JsonSerializer.Serialize(" ", BasicTypesJsonContext.Default.String));
|
||||
}
|
||||
else
|
||||
{
|
||||
await ExecuteScriptFunctionAsync("RenderHTML", htmlBody);
|
||||
await Chromium.ExecuteScriptFunctionAsync("RenderHTML", parameters: JsonSerializer.Serialize(htmlBody, BasicTypesJsonContext.Default.String));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,7 +404,13 @@ namespace Wino.Views
|
||||
int composerFontSize = ViewModel.PreferencesService.ComposerFontSize;
|
||||
var readerFont = ViewModel.PreferencesService.ReaderFont;
|
||||
int readerFontSize = ViewModel.PreferencesService.ReaderFontSize;
|
||||
return await ExecuteScriptFunctionAsync("initializeJodit", fonts, composerFont, composerFontSize, readerFont, readerFontSize);
|
||||
return await Chromium.ExecuteScriptFunctionAsync("initializeJodit",
|
||||
false,
|
||||
JsonSerializer.Serialize(fonts, BasicTypesJsonContext.Default.ListString),
|
||||
JsonSerializer.Serialize(composerFont, BasicTypesJsonContext.Default.String),
|
||||
JsonSerializer.Serialize(composerFontSize, BasicTypesJsonContext.Default.Int32),
|
||||
JsonSerializer.Serialize(readerFont, BasicTypesJsonContext.Default.String),
|
||||
JsonSerializer.Serialize(readerFontSize, BasicTypesJsonContext.Default.Int32));
|
||||
}
|
||||
|
||||
private void DisposeWebView2()
|
||||
@@ -468,7 +459,7 @@ namespace Wino.Views
|
||||
{
|
||||
var editorContent = await InvokeScriptSafeAsync("GetHTMLContent();");
|
||||
|
||||
return JsonSerializer.Deserialize<string>(editorContent);
|
||||
return JsonSerializer.Deserialize(editorContent, BasicTypesJsonContext.Default.String);
|
||||
});
|
||||
|
||||
var underlyingThemeService = App.Current.Services.GetService<IUnderlyingThemeService>();
|
||||
@@ -492,7 +483,7 @@ namespace Wino.Views
|
||||
|
||||
private void ScriptMessageReceived(CoreWebView2 sender, CoreWebView2WebMessageReceivedEventArgs args)
|
||||
{
|
||||
var change = JsonSerializer.Deserialize<WebViewMessage>(args.WebMessageAsJson);
|
||||
var change = JsonSerializer.Deserialize(args.WebMessageAsJson, DomainModelsJsonContext.Default.WebViewMessage);
|
||||
|
||||
if (change.Type == "bold")
|
||||
{
|
||||
@@ -698,4 +689,7 @@ namespace Wino.Views
|
||||
finally { deferral.Complete(); }
|
||||
}
|
||||
}
|
||||
|
||||
[JsonSerializable(typeof(List<ImageInfo>))]
|
||||
public partial class ComposerPageJsonContext: JsonSerializerContext;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user