Fix and derequire type text in confirmation

Even if we have it always available, we don't need use it 99.9% of time, and even in 0.1% it's only supportive attribute for debugging. Make it optional, will help with robustness.
This commit is contained in:
Archi
2024-03-20 21:51:28 +01:00
parent 915d26adfa
commit 44bea85296
2 changed files with 3 additions and 4 deletions

View File

@@ -36,9 +36,8 @@ public sealed class Confirmation {
public EConfirmationType ConfirmationType { get; private init; }
[JsonInclude]
[JsonPropertyName("type_text")]
[JsonRequired]
public string ConfirmationTypeText { get; private init; } = "";
[JsonPropertyName("type_name")]
public string? ConfirmationTypeName { get; private init; }
[JsonInclude]
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]

View File

@@ -183,7 +183,7 @@ public sealed class MobileAuthenticator : IDisposable {
}
foreach (Confirmation? confirmation in response.Confirmations.Where(static confirmation => (confirmation.ConfirmationType == Confirmation.EConfirmationType.Unknown) || !Enum.IsDefined(confirmation.ConfirmationType))) {
Bot.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.WarningUnknownValuePleaseReport, nameof(confirmation.ConfirmationType), $"{confirmation.ConfirmationType} ({confirmation.ConfirmationTypeText})"));
Bot.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.WarningUnknownValuePleaseReport, nameof(confirmation.ConfirmationType), $"{confirmation.ConfirmationType} ({confirmation.ConfirmationTypeName ?? "null"})"));
}
return response.Confirmations;