Skip to content

Commit

Permalink
Fix and derequire type text in confirmation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JustArchi committed Mar 20, 2024
1 parent 915d26a commit 44bea85
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions ArchiSteamFarm/Steam/Data/Confirmation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion ArchiSteamFarm/Steam/Security/MobileAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 44bea85

Please sign in to comment.