From 34bec31573964c23a68403ffc08c304f8cf98587 Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Sat, 18 Nov 2023 14:21:19 -0800 Subject: [PATCH] Update frontier URL and fix new handling. Also update submodule to lastest master. --- lib/FFXIVQuickLauncher | 2 +- .../Components/MainPage/NewsFrame.cs | 19 ++++++++++++++----- src/XIVLauncher.Core/LauncherApp.cs | 4 ++-- src/XIVLauncher.Core/Program.cs | 4 +++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/FFXIVQuickLauncher b/lib/FFXIVQuickLauncher index e8e22c32..c8a5471e 160000 --- a/lib/FFXIVQuickLauncher +++ b/lib/FFXIVQuickLauncher @@ -1 +1 @@ -Subproject commit e8e22c32969a858343b751dbbda4777606ba5717 +Subproject commit c8a5471e0343c5ef89ccce698179324c44a3bce9 diff --git a/src/XIVLauncher.Core/Components/MainPage/NewsFrame.cs b/src/XIVLauncher.Core/Components/MainPage/NewsFrame.cs index a23c8cc3..1a3fc600 100644 --- a/src/XIVLauncher.Core/Components/MainPage/NewsFrame.cs +++ b/src/XIVLauncher.Core/Components/MainPage/NewsFrame.cs @@ -15,6 +15,8 @@ public class NewsFrame : Component private Headlines? headlines; private TextureWrap[]? banners; + private IReadOnlyList? bannerList; + private int currentBanner = 0; private bool newsLoaded = false; @@ -43,14 +45,21 @@ public void ReloadNews() { this.newsLoaded = false; - this.headlines = await Headlines.Get(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English).ConfigureAwait(false); - this.banners = new TextureWrap[this.headlines.Banner.Length]; + await Headlines.GetWorlds(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English); + + bannerList = await Headlines.GetBanners(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English).ConfigureAwait(false); + + await Headlines.GetMessage(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English); + + headlines = await Headlines.GetNews(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English).ConfigureAwait(false); + + this.banners = new TextureWrap[bannerList.Count]; var client = new HttpClient(); - for (var i = 0; i < this.headlines.Banner.Length; i++) + for (var i = 0; i < bannerList.Count; i++) { - var textureBytes = await client.GetByteArrayAsync(this.headlines.Banner[i].LsbBanner).ConfigureAwait(false); + var textureBytes = await client.GetByteArrayAsync(this.bannerList[i].LsbBanner).ConfigureAwait(false); this.banners[i] = TextureWrap.Load(textureBytes); } @@ -77,7 +86,7 @@ public override void Draw() ImGui.Image(banner.ImGuiHandle, banner.Size); if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) - AppUtil.OpenBrowser(this.headlines.Banner[this.currentBanner].Link.ToString()); + AppUtil.OpenBrowser(this.bannerList[this.currentBanner].Link.ToString()); ImGui.Dummy(new Vector2(15)); diff --git a/src/XIVLauncher.Core/LauncherApp.cs b/src/XIVLauncher.Core/LauncherApp.cs index f893e33d..482fc65a 100644 --- a/src/XIVLauncher.Core/LauncherApp.cs +++ b/src/XIVLauncher.Core/LauncherApp.cs @@ -125,13 +125,13 @@ public LauncherState State private readonly Background background = new(); - public LauncherApp(Storage storage, bool needsUpdateWarning) + public LauncherApp(Storage storage, bool needsUpdateWarning, string frontierUrl) { this.Storage = storage; this.Accounts = new AccountManager(this.Storage.GetFile("accounts.json")); this.UniqueIdCache = new CommonUniqueIdCache(this.Storage.GetFile("uidCache.json")); - this.Launcher = new Launcher(Program.Steam, UniqueIdCache, Program.CommonSettings); + this.Launcher = new Launcher(Program.Steam, UniqueIdCache, Program.CommonSettings, frontierUrl); this.mainPage = new MainPage(this); this.setPage = new SettingsPage(this); diff --git a/src/XIVLauncher.Core/Program.cs b/src/XIVLauncher.Core/Program.cs index 4a689730..d6317302 100644 --- a/src/XIVLauncher.Core/Program.cs +++ b/src/XIVLauncher.Core/Program.cs @@ -64,6 +64,8 @@ class Program private static uint invalidationFrames = 0; private static Vector2 lastMousePosition; + private const string FRONTIER_FALLBACK = "https://launcher.finalfantasyxiv.com/v650/index.html?rc_lang={0}&time={1}"; + public static void Invalidate(uint frames = 100) { invalidationFrames = frames; @@ -258,7 +260,7 @@ private static void Main(string[] args) needUpdate = CoreEnvironmentSettings.IsUpgrade ? true : needUpdate; - launcherApp = new LauncherApp(storage, needUpdate); + launcherApp = new LauncherApp(storage, needUpdate, FRONTIER_FALLBACK); Invalidate(20);