[+] Show alert in CI builds

pull/84/head
Clansty 2024-11-06 11:39:54 +08:00
parent 99d7fe5ca2
commit 11beb6676e
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
7 changed files with 59 additions and 3 deletions

View File

@ -29,7 +29,7 @@ jobs:
run: |
copy /y build-assets\SDEZ\* AquaMai\Libs
cd AquaMai
dotnet build -c Release
dotnet build -c Release /p:DefineConstants="CI"
- name: Make example config
shell: cmd

View File

@ -17,7 +17,7 @@ public class MessageHelper
_genericManager = genericManager;
}
public static void ShowMessage(string message, WindowSizeID size = WindowSizeID.Middle)
public static void ShowMessage(string message, WindowSizeID size = WindowSizeID.Middle, string title = null)
{
if (_genericManager is null)
{
@ -27,7 +27,9 @@ public class MessageHelper
_genericManager.Enqueue(0, WindowMessageID.CollectionAttentionEmptyFavorite, new WindowParam()
{
hideTitle = true,
hideTitle = title is null,
replaceTitle = true,
title = title,
replaceText = true,
text = message,
changeSize = true,

View File

@ -188,6 +188,9 @@ namespace AquaMai
Patch(typeof(TestProof));
Patch(typeof(PractiseMode));
Patch(typeof(HideSelfMadeCharts));
# if CI
Patch(typeof(CiBuildAlert));
# endif
// Apply patches based on the settings
ApplyPatches();
@ -198,6 +201,11 @@ namespace AquaMai
MelonLogger.Warning("===========================================================================");
}
# if CI
MelonLogger.Warning(Locale.CiBuildAlertTitle);
MelonLogger.Warning(Locale.CiBuildAlertContent);
# endif
MelonLogger.Msg(Locale.Loaded);
}

View File

@ -59,6 +59,24 @@ namespace AquaMai.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to You are using AquaMai CI build version. This version is built from the latest mainline code and may contain undocumented configuration changes or potential issues..
/// </summary>
internal static string CiBuildAlertContent {
get {
return ResourceManager.GetString("CiBuildAlertContent", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Important Notice: Test Version.
/// </summary>
internal static string CiBuildAlertTitle {
get {
return ResourceManager.GetString("CiBuildAlertTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Loaded!.
/// </summary>

View File

@ -95,4 +95,10 @@
<data name="RepeatEndTimeLessThenStartTime" xml:space="preserve">
<value>Repeat end time cannot be less than repeat start time</value>
</data>
<data name="CiBuildAlertTitle" xml:space="preserve">
<value>Important Notice: Test Version</value>
</data>
<data name="CiBuildAlertContent" xml:space="preserve">
<value>You are using AquaMai CI build version. This version is built from the latest mainline code and may contain undocumented configuration changes or potential issues.</value>
</data>
</root>

View File

@ -88,4 +88,10 @@
<data name="RepeatStartTimeNotSet" xml:space="preserve">
<value>请先设置循环开始时间</value>
</data>
<data name="CiBuildAlertTitle" xml:space="preserve">
<value>重要提示:测试版本</value>
</data>
<data name="CiBuildAlertContent" xml:space="preserve">
<value>您正在使用的是 AquaMai CI 构建版本。由于该版本基于最新的主线代码构建,可能包含未通知的配置文件变更或潜在问题。</value>
</data>
</root>

View File

@ -0,0 +1,16 @@
using AquaMai.Helpers;
using AquaMai.Resources;
using HarmonyLib;
using Process;
namespace AquaMai.UX;
public class CiBuildAlert
{
[HarmonyPatch(typeof(AdvertiseProcess), "OnStart")]
[HarmonyPostfix]
public static void OnStart(AdvertiseProcess __instance)
{
MessageHelper.ShowMessage(Locale.CiBuildAlertContent, title: Locale.CiBuildAlertTitle);
}
}