mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Code cleanup
This commit is contained in:
parent
1032e2554b
commit
5948af4c0d
@ -55,10 +55,6 @@ public class NexusLoginManager : ViewModel, INeedsLogin
|
||||
//MessageBus.Current.SendMessage(new OpenBrowserTab(_serviceProvider.GetRequiredService<NexusLoginHandler>()));
|
||||
StartLogin();
|
||||
}, this.WhenAnyValue(v => v.HaveLogin).Select(v => !v));
|
||||
|
||||
MessageBus.Current.Listen<CloseBrowserTab>()
|
||||
.Subscribe(x => RefreshTokenState())
|
||||
.DisposeWith(CompositeDisposable);
|
||||
}
|
||||
|
||||
private void StartLogin()
|
||||
|
@ -1,11 +0,0 @@
|
||||
namespace Wabbajack.Messages;
|
||||
|
||||
public class CloseBrowserTab
|
||||
{
|
||||
public BrowserWindowViewModel ViewModel { get; init; }
|
||||
|
||||
public CloseBrowserTab(BrowserWindowViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Wabbajack.Messages;
|
||||
|
||||
public class LoversLabLogin : ALoginMessage
|
||||
{
|
||||
|
||||
public static Task Send()
|
||||
{
|
||||
var msg = new LoversLabLogin();
|
||||
MessageBus.Current.SendMessage(msg);
|
||||
return msg.CompletionSource.Task;
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
using Wabbajack.DTOs.Interventions;
|
||||
using Wabbajack.Networking.Http.Interfaces;
|
||||
|
||||
namespace Wabbajack.Messages;
|
||||
|
||||
public class NexusLogin : ALoginMessage
|
||||
{
|
||||
public NexusLogin()
|
||||
{
|
||||
}
|
||||
|
||||
public static Task Send()
|
||||
{
|
||||
var msg = new NexusLogin();
|
||||
MessageBus.Current.SendMessage(msg);
|
||||
return msg.CompletionSource.Task;
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
namespace Wabbajack.Messages;
|
||||
|
||||
public class OpenBrowserTab
|
||||
{
|
||||
public BrowserWindowViewModel ViewModel { get; set; }
|
||||
|
||||
public OpenBrowserTab(BrowserWindowViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Wabbajack.Messages;
|
||||
|
||||
public class VectorPlexusLogin : ALoginMessage
|
||||
{
|
||||
|
||||
public static Task Send()
|
||||
{
|
||||
var msg = new VectorPlexusLogin();
|
||||
MessageBus.Current.SendMessage(msg);
|
||||
return msg.CompletionSource.Task;
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ using Wabbajack.Services.OSIntegrated;
|
||||
|
||||
namespace Wabbajack.UserIntervention;
|
||||
|
||||
public class LoversLabLoginHandler : OAuth2LoginHandler<Messages.LoversLabLogin, DTOs.Logins.LoversLabLoginState>
|
||||
public class LoversLabLoginHandler : OAuth2LoginHandler<DTOs.Logins.LoversLabLoginState>
|
||||
{
|
||||
public LoversLabLoginHandler(ILogger<LoversLabLoginHandler> logger, HttpClient httpClient, EncryptedJsonTokenProvider<LoversLabLoginState> tokenProvider)
|
||||
: base(logger, httpClient, tokenProvider)
|
||||
|
@ -17,8 +17,7 @@ using Wabbajack.Services.OSIntegrated;
|
||||
|
||||
namespace Wabbajack.UserIntervention;
|
||||
|
||||
public abstract class OAuth2LoginHandler<TIntervention, TLoginType> : BrowserWindowViewModel
|
||||
where TIntervention : IUserIntervention
|
||||
public abstract class OAuth2LoginHandler<TLoginType> : BrowserWindowViewModel
|
||||
where TLoginType : OAuth2LoginState, new()
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
|
@ -7,7 +7,7 @@ using Wabbajack.Services.OSIntegrated;
|
||||
|
||||
namespace Wabbajack.UserIntervention;
|
||||
|
||||
public class VectorPlexusLoginHandler : OAuth2LoginHandler<Messages.VectorPlexusLogin, DTOs.Logins.VectorPlexusLoginState>
|
||||
public class VectorPlexusLoginHandler : OAuth2LoginHandler<DTOs.Logins.VectorPlexusLoginState>
|
||||
{
|
||||
public VectorPlexusLoginHandler(ILogger<VectorPlexusLoginHandler> logger, HttpClient httpClient, EncryptedJsonTokenProvider<VectorPlexusLoginState> tokenProvider)
|
||||
: base(logger, httpClient, tokenProvider)
|
||||
|
@ -101,18 +101,6 @@ namespace Wabbajack
|
||||
MessageBus.Current.Listen<NavigateBack>()
|
||||
.Subscribe(HandleNavigateBack)
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
MessageBus.Current.Listen<NexusLogin>()
|
||||
.Subscribe(HandleLogin)
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
MessageBus.Current.Listen<LoversLabLogin>()
|
||||
.Subscribe(HandleLogin)
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
MessageBus.Current.Listen<VectorPlexusLogin>()
|
||||
.Subscribe(HandleLogin)
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
MessageBus.Current.Listen<ManualDownload>()
|
||||
.Subscribe(HandleManualDownload)
|
||||
@ -171,25 +159,7 @@ namespace Wabbajack
|
||||
|
||||
ActivePane = objViewModel;
|
||||
}
|
||||
|
||||
private void HandleLogin(NexusLogin nexusLogin)
|
||||
{
|
||||
var handler = _serviceProvider.GetRequiredService<NexusLoginHandler>();
|
||||
handler.RunWrapper(CancellationToken.None).FireAndForget();
|
||||
}
|
||||
|
||||
private void HandleLogin(LoversLabLogin loversLabLogin)
|
||||
{
|
||||
var handler = _serviceProvider.GetRequiredService<LoversLabLoginHandler>();
|
||||
//handler.RunWrapper(CancellationToken.None).FireAndForget();
|
||||
}
|
||||
|
||||
private void HandleLogin(VectorPlexusLogin vectorPlexusLogin)
|
||||
{
|
||||
var handler = _serviceProvider.GetRequiredService<VectorPlexusLoginHandler>();
|
||||
//handler.RunWrapper(CancellationToken.None).FireAndForget();
|
||||
}
|
||||
|
||||
private void HandleNavigateBack(NavigateBack navigateBack)
|
||||
{
|
||||
ActivePane = PreviousPanes.Last();
|
||||
|
@ -62,13 +62,6 @@ namespace Wabbajack
|
||||
TaskbarItemInfo.ProgressState = u.State;
|
||||
});
|
||||
|
||||
MessageBus.Current.Listen<OpenBrowserTab>()
|
||||
.ObserveOnGuiThread()
|
||||
.Subscribe(OnOpenBrowserTab);
|
||||
|
||||
MessageBus.Current.Listen<CloseBrowserTab>()
|
||||
.ObserveOnGuiThread()
|
||||
.Subscribe(OnCloseBrowserTab);
|
||||
|
||||
_logger.LogInformation("Wabbajack Build - {Sha}",ThisAssembly.Git.Sha);
|
||||
_logger.LogInformation("Running in {EntryPoint}", KnownFolders.EntryPoint);
|
||||
@ -212,23 +205,6 @@ namespace Wabbajack
|
||||
{
|
||||
this.DragMove();
|
||||
}
|
||||
|
||||
private void OnOpenBrowserTab(OpenBrowserTab msg)
|
||||
{
|
||||
//var tab = new BrowserTabView(msg.ViewModel);
|
||||
//Tabs.Items.Add(tab);
|
||||
//Tabs.SelectedItem = tab;
|
||||
}
|
||||
|
||||
private void OnCloseBrowserTab(CloseBrowserTab msg)
|
||||
{
|
||||
/*
|
||||
foreach (var tab in Tabs.Items.OfType<BrowserTabView>())
|
||||
{
|
||||
if (tab.DataContext != msg.ViewModel) continue;
|
||||
Tabs.Items.Remove(tab);
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user