From 9b6fbf715a38db6b7c01dce8b88641178fca0418 Mon Sep 17 00:00:00 2001 From: Silicasandwhich <43558271+Silicasandwhich@users.noreply.github.com> Date: Thu, 29 Jun 2023 03:24:10 -0400 Subject: [PATCH 01/27] added drop down for additional launch options --- src/XIVLauncher/App.xaml | 1 + src/XIVLauncher/Windows/MainWindow.xaml | 48 ++++++++++++++++++- .../Windows/ViewModel/MainWindowViewModel.cs | 1 + 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/XIVLauncher/App.xaml b/src/XIVLauncher/App.xaml index 15a4fffbd..43152336a 100644 --- a/src/XIVLauncher/App.xaml +++ b/src/XIVLauncher/App.xaml @@ -16,6 +16,7 @@ + diff --git a/src/XIVLauncher/Windows/MainWindow.xaml b/src/XIVLauncher/Windows/MainWindow.xaml index 8bc9833e5..d47435447 100644 --- a/src/XIVLauncher/Windows/MainWindow.xaml +++ b/src/XIVLauncher/Windows/MainWindow.xaml @@ -279,11 +279,11 @@ + Width="160" Margin="0,0,0,0" DockPanel.Dock="Bottom"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/XIVLauncher/Windows/MainWindow.xaml.cs b/src/XIVLauncher/Windows/MainWindow.xaml.cs index 1c5c04d10..89420dafe 100644 --- a/src/XIVLauncher/Windows/MainWindow.xaml.cs +++ b/src/XIVLauncher/Windows/MainWindow.xaml.cs @@ -34,6 +34,7 @@ public partial class MainWindow : Window { private Timer _bannerChangeTimer; private Headlines _headlines; + private IReadOnlyList _banners; private BitmapImage[] _bannerBitmaps; private int _currentBannerIndex; private bool _everShown = false; @@ -121,14 +122,20 @@ private async Task SetupHeadlines() { _bannerChangeTimer?.Stop(); - _headlines = await Headlines.Get(_launcher, App.Settings.Language.GetValueOrDefault(ClientLanguage.English), App.Settings.ForceNorthAmerica.GetValueOrDefault(false)).ConfigureAwait(false); + await Headlines.GetWorlds(_launcher, App.Settings.Language.GetValueOrDefault(ClientLanguage.English)); + _banners = await Headlines.GetBanners(_launcher, App.Settings.Language.GetValueOrDefault(ClientLanguage.English), App.Settings.ForceNorthAmerica.GetValueOrDefault(false)) + .ConfigureAwait(false); + await Headlines.GetMessage(_launcher, App.Settings.Language.GetValueOrDefault(ClientLanguage.English), App.Settings.ForceNorthAmerica.GetValueOrDefault(false)) + .ConfigureAwait(false); + _headlines = await Headlines.GetNews(_launcher, App.Settings.Language.GetValueOrDefault(ClientLanguage.English), App.Settings.ForceNorthAmerica.GetValueOrDefault(false)) + .ConfigureAwait(false); - _bannerBitmaps = new BitmapImage[_headlines.Banner.Length]; + _bannerBitmaps = new BitmapImage[_banners.Count]; _bannerDotList = new(); - for (var i = 0; i < _headlines.Banner.Length; i++) + for (var i = 0; i < _banners.Count; i++) { - var imageBytes = await _launcher.DownloadAsLauncher(_headlines.Banner[i].LsbBanner.ToString(), App.Settings.Language.GetValueOrDefault(ClientLanguage.English)); + var imageBytes = await _launcher.DownloadAsLauncher(_banners[i].LsbBanner.ToString(), App.Settings.Language.GetValueOrDefault(ClientLanguage.English)); using var stream = new MemoryStream(imageBytes); @@ -157,7 +164,7 @@ private async Task SetupHeadlines() { _bannerDotList.ToList().ForEach(x => x.Active = false); - if (_currentBannerIndex + 1 > _headlines.Banner.Length - 1) + if (_currentBannerIndex + 1 > _banners.Count - 1) _currentBannerIndex = 0; else _currentBannerIndex++; @@ -176,8 +183,9 @@ private async Task SetupHeadlines() Dispatcher.BeginInvoke(new Action(() => { NewsListView.ItemsSource = _headlines.News; })); } - catch (Exception) + catch (Exception ex) { + Log.Error(ex, "Could not get news"); Dispatcher.BeginInvoke(new Action(() => { NewsListView.ItemsSource = new List {new News {Title = Loc.Localize("NewsDlFailed", "Could not download news data."), Tag = "DlError"}}; @@ -272,23 +280,6 @@ public void Initialize() this.SetDefaults(); - var worldStatusBrushOk = WorldStatusPackIcon.Foreground; - // grey out world status icon while deferred check is running - WorldStatusPackIcon.Foreground = new SolidColorBrush(Color.FromRgb(38, 38, 38)); - - _launcher.GetGateStatus(App.Settings.Language.GetValueOrDefault(ClientLanguage.English)).ContinueWith((resultTask) => - { - try - { - var brushToSet = resultTask.Result.Status ? worldStatusBrushOk : null; - Dispatcher.InvokeAsync(() => WorldStatusPackIcon.Foreground = brushToSet ?? new SolidColorBrush(Color.FromRgb(242, 24, 24))); - } - catch - { - // ignored - } - }); - _accountManager = new AccountManager(App.Settings); var savedAccount = _accountManager.CurrentAccount; @@ -359,7 +350,7 @@ private void BannerCard_MouseUp(object sender, MouseButtonEventArgs e) if (e.ChangedButton != MouseButton.Left) return; - if (_headlines != null) Process.Start(_headlines.Banner[_currentBannerIndex].Link.ToString()); + if (_headlines != null) Process.Start(_banners[_currentBannerIndex].Link.ToString()); } private void NewsListView_OnMouseUp(object sender, MouseButtonEventArgs e) diff --git a/src/XIVLauncher/Windows/ViewModel/MainWindowViewModel.cs b/src/XIVLauncher/Windows/ViewModel/MainWindowViewModel.cs index 523eef882..e347b7e18 100644 --- a/src/XIVLauncher/Windows/ViewModel/MainWindowViewModel.cs +++ b/src/XIVLauncher/Windows/ViewModel/MainWindowViewModel.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Input; +using System.Windows.Media; using System.Windows.Threading; using CheapLoc; using Serilog; @@ -36,6 +37,9 @@ internal class MainWindowViewModel : INotifyPropertyChanged { private readonly Window _window; + private readonly Task loginStatusTask; + private bool refetchLoginStatus = false; + public bool IsLoggingIn; public Launcher Launcher { get; private set; } @@ -71,9 +75,36 @@ public MainWindowViewModel(Window window) LoginNoThirdCommand = new SyncCommand(GetLoginFunc(AfterLoginAction.StartWithoutThird), () => !IsLoggingIn); LoginRepairCommand = new SyncCommand(GetLoginFunc(AfterLoginAction.Repair), () => !IsLoggingIn); + var frontierUrl = Updates.UpdateLease?.FrontierUrl; +#if DEBUG || RELEASENOUPDATE + // FALLBACK + frontierUrl ??= "https://launcher.finalfantasyxiv.com/v650/index.html?rc_lang={0}&time={1}"; +#endif + Launcher = App.GlobalSteamTicket == null - ? new(App.Steam, App.UniqueIdCache, CommonSettings.Instance, Updates.UpdateLease?.FrontierUrl) - : new(App.GlobalSteamTicket, App.UniqueIdCache, CommonSettings.Instance, Updates.UpdateLease?.FrontierUrl); + ? new(App.Steam, App.UniqueIdCache, CommonSettings.Instance, frontierUrl) + : new(App.GlobalSteamTicket, App.UniqueIdCache, CommonSettings.Instance, frontierUrl); + + // Tried and failed to get this from the theme + var worldStatusBrushOk = new SolidColorBrush(Color.FromRgb(0x21, 0x96, 0xf3)); + WorldStatusIconColor = worldStatusBrushOk; + + // Grey out world status icon while deferred check is running + WorldStatusIconColor = new SolidColorBrush(Color.FromRgb(38, 38, 38)); + + this.loginStatusTask = Launcher.GetLoginStatus(); + this.loginStatusTask.ContinueWith((resultTask) => + { + try + { + var brushToSet = resultTask.Result.Status ? worldStatusBrushOk : null; + WorldStatusIconColor = brushToSet ?? new SolidColorBrush(Color.FromRgb(242, 24, 24)); + } + catch + { + // ignored + } + }); } private Action GetLoginFunc(AfterLoginAction action) @@ -338,7 +369,17 @@ private async Task CheckGateStatus() #if !DEBUG try { - loginStatus = await Launcher.GetLoginStatus().ConfigureAwait(false); + if (refetchLoginStatus) + { + var response = await Launcher.GetLoginStatus().ConfigureAwait(false); + loginStatus = response.Status; + } + else + { + var response = await this.loginStatusTask; + loginStatus = response.Status; + refetchLoginStatus = true; + } } catch (Exception ex) { @@ -1485,6 +1526,17 @@ public string LoadingDialogMessage } } + private SolidColorBrush _worldStatusIconColor; + public SolidColorBrush WorldStatusIconColor + { + get => _worldStatusIconColor; + set + { + _worldStatusIconColor = value; + OnPropertyChanged(nameof(WorldStatusIconColor)); + } + } + #endregion #region Localization From 9657e0b7f8e35fbb88ada94b8be826187d765294 Mon Sep 17 00:00:00 2001 From: goat Date: Wed, 1 Nov 2023 19:23:36 +0100 Subject: [PATCH 25/27] build: 6.3.11 --- src/XIVLauncher/Resources/CHANGELOG.txt | 10 ++-------- src/XIVLauncher/XIVLauncher.csproj | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/XIVLauncher/Resources/CHANGELOG.txt b/src/XIVLauncher/Resources/CHANGELOG.txt index 591bd4db7..0ee293654 100644 --- a/src/XIVLauncher/Resources/CHANGELOG.txt +++ b/src/XIVLauncher/Resources/CHANGELOG.txt @@ -1,8 +1,2 @@ -* Fixes an issue wherein the game repair feature may not have functioned correctly -* Fixes an issue wherein required data files for Dalamud may not have been downloaded correctly -* Adds a separate button to the login menu, which will open advanced login options, in addition to right-clicking -* Updated the localization files - => Thanks to our dedicated localization team! - -Hotfix: -* Fixes an issue wherein a window showing debug information may have been shown during patching \ No newline at end of file +* Fixes an issue wherein required data files for Dalamud may not have been downloaded correctly under certain conditions +* Fixes an issue wherein the banners shown on the main page were outdated diff --git a/src/XIVLauncher/XIVLauncher.csproj b/src/XIVLauncher/XIVLauncher.csproj index 17fa66907..9f23f2fa9 100644 --- a/src/XIVLauncher/XIVLauncher.csproj +++ b/src/XIVLauncher/XIVLauncher.csproj @@ -3,7 +3,7 @@ XIVLauncher XIVLauncher Custom launcher for the most critically acclaimed MMO. - 6.3.10 + 6.3.11 @@ -143,4 +143,4 @@ - \ No newline at end of file + From 6c3562b5e510e2937862a087d6df2062cafe96e1 Mon Sep 17 00:00:00 2001 From: goat Date: Wed, 1 Nov 2023 20:16:04 +0100 Subject: [PATCH 26/27] fix: null-check the correct variable --- src/XIVLauncher.Common/Game/Launcher.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/XIVLauncher.Common/Game/Launcher.cs b/src/XIVLauncher.Common/Game/Launcher.cs index 70c5eee90..97d61d648 100644 --- a/src/XIVLauncher.Common/Game/Launcher.cs +++ b/src/XIVLauncher.Common/Game/Launcher.cs @@ -42,10 +42,7 @@ public Launcher(ISteam? steam, IUniqueIdCache uniqueIdCache, ISettings settings, this.uniqueIdCache = uniqueIdCache; this.settings = settings; - if (this.frontierUrlTemplate == null) - throw new Exception("Frontier URL template is null, this is now required"); - - this.frontierUrlTemplate = frontierUrl; + this.frontierUrlTemplate = frontierUrl ?? throw new Exception("Frontier URL template is null, this is now required"); ServicePointManager.Expect100Continue = false; From c8a5471e0343c5ef89ccce698179324c44a3bce9 Mon Sep 17 00:00:00 2001 From: goat Date: Wed, 1 Nov 2023 20:18:59 +0100 Subject: [PATCH 27/27] build: 6.3.12 --- src/XIVLauncher/XIVLauncher.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/XIVLauncher/XIVLauncher.csproj b/src/XIVLauncher/XIVLauncher.csproj index 9f23f2fa9..26d7d592b 100644 --- a/src/XIVLauncher/XIVLauncher.csproj +++ b/src/XIVLauncher/XIVLauncher.csproj @@ -3,7 +3,7 @@ XIVLauncher XIVLauncher Custom launcher for the most critically acclaimed MMO. - 6.3.11 + 6.3.12