Merge pull request #1743 from bluepilledgreat/bugfix/emoji-http-check

Handle not being able to fetch emoji preset
This commit is contained in:
pizzaboxer 2024-05-12 20:53:18 +01:00 committed by GitHub
commit 47e1ea9a73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 4 deletions

View File

@ -4,6 +4,7 @@ using System.Windows.Forms;
using Microsoft.Win32;
using Bloxstrap.Integrations;
using Bloxstrap.Resources;
namespace Bloxstrap
{
@ -1189,10 +1190,21 @@ namespace Bloxstrap
Directory.CreateDirectory(contentFonts);
try
{
var response = await App.HttpClient.GetAsync(App.Settings.Prop.EmojiType.GetUrl());
response.EnsureSuccessStatusCode();
await using var fileStream = new FileStream(emojiFontLocation, FileMode.CreateNew);
await response.Content.CopyToAsync(fileStream);
}
catch (HttpRequestException ex)
{
App.Logger.WriteLine(LOG_IDENT, $"Failed to fetch emoji preset from Github");
App.Logger.WriteException(LOG_IDENT, ex);
Frontend.ShowMessageBox(string.Format(Strings.Bootstrapper_EmojiPresetFetchFailed, App.Settings.Prop.EmojiType), MessageBoxImage.Warning);
App.Settings.Prop.EmojiType = EmojiType.Default;
}
}
// check custom font mod
// instead of replacing the fonts themselves, we'll just alter the font family manifests

View File

@ -133,6 +133,15 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Failed to fetch the {0} emoji preset. Your preferred emoji type has been set back to default..
/// </summary>
public static string Bootstrapper_EmojiPresetFetchFailed {
get {
return ResourceManager.GetString("Bootstrapper.EmojiPresetFetchFailed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You must first install Bloxstrap before uninstalling..
/// </summary>

View File

@ -142,6 +142,9 @@ Would you like to switch to the default channel ({1})?</value>
<data name="Bootstrapper.DeeplinkTempEnabled" xml:space="preserve">
<value>Roblox was launched via a deeplink, however the desktop app is required for deeplink launching to work. Because you've opted to disable the desktop app, it will temporarily be re-enabled for this launch only.</value>
</data>
<data name="Bootstrapper.EmojiPresetFetchFailed" xml:space="preserve">
<value>Could not apply the {0} emoji mod preset because of a network error. To try again, please reconfigure the option in the Bloxstrap Menu.</value>
</data>
<data name="Bootstrapper.FirstRunUninstall" xml:space="preserve">
<value>You must first install Bloxstrap before uninstalling.</value>
</data>