Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove flatpak update check #200

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/XIVLauncher.Core/Components/SteamDeckPromptPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ namespace XIVLauncher.Core.Components;

public class SteamDeckPromptPage : Page
{
private readonly TextureWrap updateWarnTexture;
private readonly TextureWrap switchPromptTexture;

public SteamDeckPromptPage(LauncherApp app)
: base(app)
{
this.updateWarnTexture = TextureWrap.Load(AppUtil.GetEmbeddedResourceBytes("steamdeck_switchprompt.png"));
this.switchPromptTexture = TextureWrap.Load(AppUtil.GetEmbeddedResourceBytes("steamdeck_switchprompt.png"));
}

public override void Draw()
{
ImGui.SetCursorPos(new Vector2(0));

ImGui.Image(this.updateWarnTexture.ImGuiHandle, new Vector2(1280, 800));
ImGui.Image(this.switchPromptTexture.ImGuiHandle, new Vector2(1280, 800));

base.Draw();
}
Expand Down
45 changes: 0 additions & 45 deletions src/XIVLauncher.Core/Components/UpdateWarnPage.cs

This file was deleted.

13 changes: 6 additions & 7 deletions src/XIVLauncher.Core/CoreEnvironmentSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public static class CoreEnvironmentSettings
public static bool? IsDeck => CheckEnvBoolOrNull("XL_DECK");
public static bool? IsDeckGameMode => CheckEnvBoolOrNull("XL_GAMEMODE");
public static bool? IsDeckFirstRun => CheckEnvBoolOrNull("XL_FIRSTRUN");
public static bool IsUpgrade => CheckEnvBool("XL_SHOW_UPGRADE");
public static bool ClearSettings => CheckEnvBool("XL_CLEAR_SETTINGS");
public static bool ClearPrefix => CheckEnvBool("XL_CLEAR_PREFIX");
public static bool ClearPlugins => CheckEnvBool("XL_CLEAR_PLUGINS");
Expand All @@ -16,19 +15,19 @@ public static class CoreEnvironmentSettings
public static bool ClearAll => CheckEnvBool("XL_CLEAR_ALL");
public static bool? UseSteam => CheckEnvBoolOrNull("XL_USE_STEAM"); // Fix for Steam Deck users who lock themselves out
public static bool IsSteamCompatTool => CheckEnvBool("XL_SCT");
public static uint SteamAppId => GetAppId(System.Environment.GetEnvironmentVariable("SteamAppId"));
public static uint AltAppID => GetAppId(System.Environment.GetEnvironmentVariable("XL_APPID"));
public static uint SteamAppId => GetAppId(Environment.GetEnvironmentVariable("SteamAppId"));
public static uint AltAppID => GetAppId(Environment.GetEnvironmentVariable("XL_APPID"));

private static bool CheckEnvBool(string key)
{
string val = (System.Environment.GetEnvironmentVariable(key) ?? string.Empty).ToLower();
string val = (Environment.GetEnvironmentVariable(key) ?? string.Empty).ToLower();
if (val == "1" || val == "true" || val == "yes" || val == "y" || val == "on") return true;
return false;
}

private static bool? CheckEnvBoolOrNull(string key)
{
string val = (System.Environment.GetEnvironmentVariable(key) ?? string.Empty).ToLower();
string val = (Environment.GetEnvironmentVariable(key) ?? string.Empty).ToLower();
if (val == "1" || val == "true" || val == "yes" || val == "y" || val == "on") return true;
if (val == "0" || val == "false" || val == "no" || val == "n" || val == "off") return false;
return null;
Expand All @@ -44,14 +43,14 @@ public static string GetCleanEnvironmentVariable(string envvar, string badstring
public static uint GetAppId(string? appid)
{
uint.TryParse(appid, out var result);

// Will return 0 if appid is invalid (or zero).
return result;
}

public static string GetCType()
{
if (System.OperatingSystem.IsWindows())
if (OperatingSystem.IsWindows())
return "";
var psi = new ProcessStartInfo("sh");
psi.Arguments = "-c \"locale -a 2>/dev/null | grep -i utf\"";
Expand Down
25 changes: 2 additions & 23 deletions src/XIVLauncher.Core/LauncherApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public enum LauncherState
Loading,
OtpEntry,
Fts,
UpdateWarn,
SteamDeckPrompt,
}

Expand Down Expand Up @@ -82,10 +81,6 @@ public LauncherState State
this.ftsPage.OnShow();
break;

case LauncherState.UpdateWarn:
this.updateWarnPage.OnShow();
break;

case LauncherState.SteamDeckPrompt:
this.steamDeckPromptPage.OnShow();
break;
Expand All @@ -103,7 +98,6 @@ public LauncherState State
LauncherState.Loading => this.LoadingPage,
LauncherState.OtpEntry => this.otpEntryPage,
LauncherState.Fts => this.ftsPage,
LauncherState.UpdateWarn => this.updateWarnPage,
LauncherState.SteamDeckPrompt => this.steamDeckPromptPage,
_ => throw new ArgumentOutOfRangeException(nameof(this.state), this.state, null)
};
Expand All @@ -122,12 +116,11 @@ public LauncherState State
private readonly SettingsPage setPage;
private readonly OtpEntryPage otpEntryPage;
private readonly FtsPage ftsPage;
private readonly UpdateWarnPage updateWarnPage;
private readonly SteamDeckPromptPage steamDeckPromptPage;

private readonly Background background = new();

public LauncherApp(Storage storage, bool needsUpdateWarning, string frontierUrl, string? cutOffBootver)
public LauncherApp(Storage storage, string frontierUrl, string? cutOffBootver)
{
this.Storage = storage;

Expand All @@ -140,7 +133,6 @@ public LauncherApp(Storage storage, bool needsUpdateWarning, string frontierUrl,
this.otpEntryPage = new OtpEntryPage(this);
this.LoadingPage = new LoadingPage(this);
this.ftsPage = new FtsPage(this);
this.updateWarnPage = new UpdateWarnPage(this);
this.steamDeckPromptPage = new SteamDeckPromptPage(this);

if (!EnvironmentSettings.IsNoKillswitch && !string.IsNullOrEmpty(cutOffBootver))
Expand All @@ -158,14 +150,7 @@ public LauncherApp(Storage storage, bool needsUpdateWarning, string frontierUrl,
}
}

if (needsUpdateWarning)
{
this.State = LauncherState.UpdateWarn;
}
else
{
this.RunStartupTasks();
}
this.RunStartupTasks();

#if DEBUG
IsDebug = true;
Expand Down Expand Up @@ -261,12 +246,6 @@ public void StopLoading()
this.State = LauncherState.Main;
}

public void FinishFromUpdateWarn()
{
this.State = LauncherState.Main;
this.RunStartupTasks();
}

public void RunStartupTasks()
{
#if FLATPAK
Expand Down
2 changes: 1 addition & 1 deletion src/XIVLauncher.Core/LauncherClientConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace XIVLauncher.Core;
public readonly struct LauncherClientConfig
{
private const string LAUNCHER_CONFIG_URL = "https://kamori.goats.dev/Launcher/GetLauncherClientConfig";
private const string FRONTIER_FALLBACK = "https://launcher.finalfantasyxiv.com/v650/index.html?rc_lang={0}&time={1}";
private const string FRONTIER_FALLBACK = "https://launcher.finalfantasyxiv.com/v710/index.html?rc_lang={0}&time={1}";

public string frontierUrl { get; init; }
public string? cutOffBootver { get; init; }
Expand Down
20 changes: 3 additions & 17 deletions src/XIVLauncher.Core/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private static void Main(string[] args)
Loc.SetupWithFallbacks();

Dictionary<uint, string> apps = new Dictionary<uint, string>();
uint[] ignoredIds = { 0, STEAM_APP_ID, STEAM_APP_ID_FT};
uint[] ignoredIds = { 0, STEAM_APP_ID, STEAM_APP_ID_FT };
if (!ignoredIds.Contains(CoreEnvironmentSettings.SteamAppId))
{
apps.Add(CoreEnvironmentSettings.SteamAppId, "XLM");
Expand Down Expand Up @@ -294,22 +294,8 @@ private static void Main(string[] args)
StyleModelV1.DalamudStandard.Apply();
ImGui.GetIO().FontGlobalScale = Config.GlobalScale ?? 1.0f;

var needUpdate = false;

#if FLATPAK
if (Config.DoVersionCheck ?? false)
{
var versionCheckResult = UpdateCheck.CheckForUpdate().GetAwaiter().GetResult();

if (versionCheckResult.Success)
needUpdate = versionCheckResult.NeedUpdate;
}
#endif

needUpdate = CoreEnvironmentSettings.IsUpgrade ? true : needUpdate;

var launcherClientConfig = LauncherClientConfig.GetAsync().GetAwaiter().GetResult();
launcherApp = new LauncherApp(storage, needUpdate, launcherClientConfig.frontierUrl, launcherClientConfig.cutOffBootver);
launcherApp = new LauncherApp(storage, launcherClientConfig.frontierUrl, launcherClientConfig.cutOffBootver);

Invalidate(20);

Expand Down Expand Up @@ -370,7 +356,7 @@ private static void Main(string[] args)
if (Patcher is not null)
{
Patcher.CancelAllDownloads();
Task.Run(async() =>
Task.Run(async () =>
{
await PatchManager.UnInitializeAcquisition().ConfigureAwait(false);
Environment.Exit(0);
Expand Down
Binary file not shown.
42 changes: 0 additions & 42 deletions src/XIVLauncher.Core/UpdateCheck.cs

This file was deleted.

Loading
Loading