Fix typo.
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Wino.Core.UWP.Services
|
|||||||
{
|
{
|
||||||
public class WinoServerConnectionManager :
|
public class WinoServerConnectionManager :
|
||||||
IWinoServerConnectionManager<AppServiceConnection>,
|
IWinoServerConnectionManager<AppServiceConnection>,
|
||||||
IRecipient<WinoServerConnectionEstrablished>
|
IRecipient<WinoServerConnectionEstablished>
|
||||||
{
|
{
|
||||||
private const int ServerConnectionTimeoutMs = 5000;
|
private const int ServerConnectionTimeoutMs = 5000;
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ namespace Wino.Core.UWP.Services
|
|||||||
|
|
||||||
// Connection establishment handler is in App.xaml.cs OnBackgroundActivated.
|
// Connection establishment handler is in App.xaml.cs OnBackgroundActivated.
|
||||||
// Once the connection is established, the handler will set the Connection property
|
// Once the connection is established, the handler will set the Connection property
|
||||||
// and WinoServerConnectionEstrablished will be fired by the messenger.
|
// and WinoServerConnectionEstablished will be fired by the messenger.
|
||||||
|
|
||||||
await _connectionTaskCompletionSource.Task.WaitAsync(connectionCancellationToken.Token);
|
await _connectionTaskCompletionSource.Task.WaitAsync(connectionCancellationToken.Token);
|
||||||
}
|
}
|
||||||
@@ -305,7 +305,7 @@ namespace Wino.Core.UWP.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Receive(WinoServerConnectionEstrablished message)
|
public void Receive(WinoServerConnectionEstablished message)
|
||||||
{
|
{
|
||||||
if (_connectionTaskCompletionSource != null)
|
if (_connectionTaskCompletionSource != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Microsoft.AppCenter;
|
|||||||
using Microsoft.AppCenter.Analytics;
|
using Microsoft.AppCenter.Analytics;
|
||||||
using Microsoft.AppCenter.Crashes;
|
using Microsoft.AppCenter.Crashes;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Nito.AsyncEx;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Windows.ApplicationModel;
|
using Windows.ApplicationModel;
|
||||||
using Windows.ApplicationModel.Activation;
|
using Windows.ApplicationModel.Activation;
|
||||||
@@ -146,7 +147,6 @@ namespace Wino
|
|||||||
private void RegisterActivationHandlers(IServiceCollection services)
|
private void RegisterActivationHandlers(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddTransient<ProtocolActivationHandler>();
|
services.AddTransient<ProtocolActivationHandler>();
|
||||||
// services.AddTransient<BackgroundActivationHandler>();
|
|
||||||
services.AddTransient<ToastNotificationActivationHandler>();
|
services.AddTransient<ToastNotificationActivationHandler>();
|
||||||
services.AddTransient<FileActivationHandler>();
|
services.AddTransient<FileActivationHandler>();
|
||||||
}
|
}
|
||||||
@@ -283,19 +283,18 @@ namespace Wino
|
|||||||
|
|
||||||
_appServiceConnectionManager.Connection = appServiceTriggerDetails.AppServiceConnection;
|
_appServiceConnectionManager.Connection = appServiceTriggerDetails.AppServiceConnection;
|
||||||
|
|
||||||
WeakReferenceMessenger.Default.Send(new WinoServerConnectionEstrablished());
|
WeakReferenceMessenger.Default.Send(new WinoServerConnectionEstablished());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.TaskInstance.TriggerDetails is ToastNotificationActionTriggerDetail toastNotificationActionTriggerDetail)
|
else if (args.TaskInstance.TriggerDetails is ToastNotificationActionTriggerDetail toastNotificationActionTriggerDetail)
|
||||||
{
|
{
|
||||||
await InitializeServicesAsync();
|
|
||||||
|
|
||||||
// Notification action is triggered and the app is not running.
|
// Notification action is triggered and the app is not running.
|
||||||
|
|
||||||
toastActionBackgroundTaskDeferral = args.TaskInstance.GetDeferral();
|
toastActionBackgroundTaskDeferral = args.TaskInstance.GetDeferral();
|
||||||
|
|
||||||
args.TaskInstance.Canceled += OnToastActionClickedBackgroundTaskCanceled;
|
args.TaskInstance.Canceled += OnToastActionClickedBackgroundTaskCanceled;
|
||||||
|
|
||||||
|
await InitializeServicesAsync();
|
||||||
|
|
||||||
var toastArguments = ToastArguments.Parse(toastNotificationActionTriggerDetail.Argument);
|
var toastArguments = ToastArguments.Parse(toastNotificationActionTriggerDetail.Argument);
|
||||||
|
|
||||||
// All toast activation mail actions are handled here like mark as read or delete.
|
// All toast activation mail actions are handled here like mark as read or delete.
|
||||||
@@ -364,13 +363,7 @@ namespace Wino
|
|||||||
|
|
||||||
private bool IsInteractiveLaunchArgs(object args) => args is IActivatedEventArgs;
|
private bool IsInteractiveLaunchArgs(object args) => args is IActivatedEventArgs;
|
||||||
|
|
||||||
private async Task InitializeServicesAsync()
|
private Task InitializeServicesAsync() => initializeServices.Select(a => a.InitializeAsync()).WhenAll();
|
||||||
{
|
|
||||||
foreach (var service in initializeServices)
|
|
||||||
{
|
|
||||||
await service.InitializeAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task ActivateWinoAsync(object args)
|
private async Task ActivateWinoAsync(object args)
|
||||||
{
|
{
|
||||||
@@ -428,7 +421,7 @@ namespace Wino
|
|||||||
{
|
{
|
||||||
sender.Canceled -= OnConnectionBackgroundTaskCanceled;
|
sender.Canceled -= OnConnectionBackgroundTaskCanceled;
|
||||||
|
|
||||||
Log.Information($"Background task {sender.Task.Name} was canceled. Reason: {reason}");
|
Log.Information($"Server connection background task '{sender.Task.Name}' was canceled. Reason: {reason}");
|
||||||
|
|
||||||
await _appServiceConnectionManager.DisconnectAsync();
|
await _appServiceConnectionManager.DisconnectAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// When client established a healthy connection to the server.
|
/// When client established a healthy connection to the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record WinoServerConnectionEstrablished;
|
public record WinoServerConnectionEstablished;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user