mirror of
https://github.com/sp-tarkov/launcher.git
synced 2025-02-13 02:50:44 -05:00
move first run checks to main viewmodel
This commit is contained in:
parent
6489ef4793
commit
26d1813f3e
@ -7,6 +7,10 @@ using System.IO;
|
|||||||
using Splat;
|
using Splat;
|
||||||
using Aki.Launcher.Models.Aki;
|
using Aki.Launcher.Models.Aki;
|
||||||
using Aki.Launcher.Helpers;
|
using Aki.Launcher.Helpers;
|
||||||
|
using Aki.Launcher.ViewModels.Dialogs;
|
||||||
|
using Avalonia.Threading;
|
||||||
|
using dialogHost = DialogHost.DialogHost;
|
||||||
|
|
||||||
|
|
||||||
namespace Aki.Launcher.ViewModels
|
namespace Aki.Launcher.ViewModels
|
||||||
{
|
{
|
||||||
@ -29,6 +33,32 @@ namespace Aki.Launcher.ViewModels
|
|||||||
|
|
||||||
LauncherSettingsProvider.Instance.AllowSettings = true;
|
LauncherSettingsProvider.Instance.AllowSettings = true;
|
||||||
|
|
||||||
|
if (LauncherSettingsProvider.Instance.FirstRun)
|
||||||
|
{
|
||||||
|
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||||
|
{
|
||||||
|
LauncherSettingsProvider.Instance.FirstRun = false;
|
||||||
|
|
||||||
|
LocalizationProvider.TryAutoSetLocale();
|
||||||
|
|
||||||
|
var viewModel = new ConfirmationDialogViewModel(this,
|
||||||
|
LocalizationProvider.Instance.copy_live_settings_question,
|
||||||
|
LocalizationProvider.Instance.yes,
|
||||||
|
LocalizationProvider.Instance.no);
|
||||||
|
|
||||||
|
var confirmCopySettings = await dialogHost.Show(viewModel);
|
||||||
|
|
||||||
|
if (confirmCopySettings is bool and true)
|
||||||
|
{
|
||||||
|
var settingsVm = new SettingsViewModel(this);
|
||||||
|
|
||||||
|
await settingsVm.ResetGameSettingsCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
LauncherSettingsProvider.Instance.SaveSettings();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.WhenActivated((CompositeDisposable disposables) =>
|
this.WhenActivated((CompositeDisposable disposables) =>
|
||||||
{
|
{
|
||||||
Router.Navigate.Execute(new ConnectServerViewModel(this));
|
Router.Navigate.Execute(new ConnectServerViewModel(this));
|
||||||
|
@ -8,7 +8,6 @@ using System.Threading.Tasks;
|
|||||||
using Aki.Launcher.Attributes;
|
using Aki.Launcher.Attributes;
|
||||||
using Aki.Launcher.ViewModels.Dialogs;
|
using Aki.Launcher.ViewModels.Dialogs;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using System.Reactive.Disposables;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Aki.Launcher.Models.Aki;
|
using Aki.Launcher.Models.Aki;
|
||||||
@ -62,36 +61,6 @@ namespace Aki.Launcher.ViewModels
|
|||||||
|
|
||||||
public ProfileViewModel(IScreen Host) : base(Host)
|
public ProfileViewModel(IScreen Host) : base(Host)
|
||||||
{
|
{
|
||||||
this.WhenActivated((CompositeDisposable disposables) =>
|
|
||||||
{
|
|
||||||
Task.Run(async () =>
|
|
||||||
{
|
|
||||||
await GameVersionCheck();
|
|
||||||
|
|
||||||
await Dispatcher.UIThread.InvokeAsync(async () =>
|
|
||||||
{
|
|
||||||
if (LauncherSettingsProvider.Instance.FirstRun)
|
|
||||||
{
|
|
||||||
LauncherSettingsProvider.Instance.FirstRun = false;
|
|
||||||
|
|
||||||
LauncherSettingsProvider.Instance.SaveSettings();
|
|
||||||
|
|
||||||
var confirmCopySettings = await ShowDialog(new ConfirmationDialogViewModel(Host,
|
|
||||||
LocalizationProvider.Instance.copy_live_settings_question,
|
|
||||||
LocalizationProvider.Instance.yes,
|
|
||||||
LocalizationProvider.Instance.no));
|
|
||||||
|
|
||||||
if (confirmCopySettings != null && confirmCopySettings is bool confirmed && confirmed)
|
|
||||||
{
|
|
||||||
var settingsVM = new SettingsViewModel(Host);
|
|
||||||
|
|
||||||
await settingsVM.ResetGameSettingsCommand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// cache and load side image if profile has a side
|
// cache and load side image if profile has a side
|
||||||
if(AccountManager.SelectedProfileInfo != null && AccountManager.SelectedProfileInfo.Side != null)
|
if(AccountManager.SelectedProfileInfo != null && AccountManager.SelectedProfileInfo.Side != null)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user