* 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>
61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using CommunityToolkit.Mvvm.Messaging;
|
|
using Windows.ApplicationModel.Activation;
|
|
using Wino.Core.Domain.Interfaces;
|
|
using Wino.Core.Domain.Models.Launch;
|
|
using Wino.Messaging.Client.Shell;
|
|
|
|
namespace Wino.Activation
|
|
{
|
|
internal class ProtocolActivationHandler : ActivationHandler<ProtocolActivatedEventArgs>
|
|
{
|
|
private const string MailtoProtocolTag = "mailto:";
|
|
|
|
private readonly INativeAppService _nativeAppService;
|
|
private readonly ILaunchProtocolService _launchProtocolService;
|
|
|
|
public ProtocolActivationHandler(INativeAppService nativeAppService, ILaunchProtocolService launchProtocolService)
|
|
{
|
|
_nativeAppService = nativeAppService;
|
|
_launchProtocolService = launchProtocolService;
|
|
}
|
|
|
|
protected override Task HandleInternalAsync(ProtocolActivatedEventArgs args)
|
|
{
|
|
// Check URI prefix.
|
|
var protocolString = args.Uri.AbsoluteUri;
|
|
|
|
if (protocolString.StartsWith(MailtoProtocolTag))
|
|
{
|
|
// mailto activation. Try to parse params.
|
|
_launchProtocolService.MailToUri = new MailToUri(protocolString);
|
|
|
|
if (_nativeAppService.IsAppRunning())
|
|
{
|
|
// Just send publish a message. Shell will continue.
|
|
WeakReferenceMessenger.Default.Send(new MailtoProtocolMessageRequested());
|
|
}
|
|
}
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
protected override bool CanHandleInternal(ProtocolActivatedEventArgs args)
|
|
{
|
|
// Validate the URI scheme.
|
|
|
|
try
|
|
{
|
|
var uriGet = args.Uri;
|
|
}
|
|
catch (UriFormatException)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return base.CanHandleInternal(args);
|
|
}
|
|
}
|
|
}
|