Fix warnings

This commit is contained in:
whimsical-c4lic0 2026-02-17 01:14:07 -06:00
parent f4479a77ba
commit fccee9a520
6 changed files with 959 additions and 942 deletions

View File

@ -159,6 +159,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// Retrieves user information from the API.
/// </summary>
/// <param name="endpoint">The user endpoint.</param>
/// <param name="cancellationToken"></param>
/// <returns>The user entity when available.</returns>
public async Task<UserEntities.User?> GetUserInfo(string endpoint, CancellationToken cancellationToken = default)
{
@ -413,6 +414,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// <param name="endpoint">The endpoint to query.</param>
/// <param name="username">Optional username context.</param>
/// <param name="folder">The creator folder path.</param>
/// <param name="cancellationToken"></param>
/// <returns>A mediaId-to-URL map.</returns>
public async Task<Dictionary<long, string>?> GetMedia(MediaType mediatype,
string endpoint,
@ -650,6 +652,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// <param name="username">The creator username.</param>
/// <param name="paidPostIds">A list to collect paid media IDs.</param>
/// <param name="statusReporter">Status reporter.</param>
/// <param name="cancellationToken"></param>
/// <returns>A paid post collection.</returns>
public async Task<PurchasedEntities.PaidPostCollection> GetPaidPosts(string endpoint, string folder,
string username,
@ -832,6 +835,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// <param name="folder">The creator folder path.</param>
/// <param name="paidPostIds">Paid post media IDs to skip.</param>
/// <param name="statusReporter">Status reporter.</param>
/// <param name="cancellationToken"></param>
/// <returns>A post collection.</returns>
public async Task<PostEntities.PostCollection> GetPosts(string endpoint, string folder, List<long> paidPostIds,
IStatusReporter statusReporter, CancellationToken cancellationToken = default)
@ -1021,6 +1025,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// </summary>
/// <param name="endpoint">The post endpoint.</param>
/// <param name="folder">The creator folder path.</param>
/// <param name="cancellationToken"></param>
/// <returns>A single post collection.</returns>
public async Task<SinglePostCollection> GetPost(string endpoint, string folder, CancellationToken cancellationToken = default)
{
@ -1169,6 +1174,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// <param name="folder">The creator folder path.</param>
/// <param name="paidPostIds">Paid post media IDs to skip.</param>
/// <param name="statusReporter">Status reporter.</param>
/// <param name="cancellationToken"></param>
/// <returns>A streams collection.</returns>
public async Task<StreamEntities.StreamsCollection> GetStreams(string endpoint, string folder,
List<long> paidPostIds,
@ -1321,6 +1327,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// <param name="endpoint">The archived posts endpoint.</param>
/// <param name="folder">The creator folder path.</param>
/// <param name="statusReporter">Status reporter.</param>
/// <param name="cancellationToken"></param>
/// <returns>An archived collection.</returns>
public async Task<ArchivedEntities.ArchivedCollection> GetArchived(string endpoint, string folder,
IStatusReporter statusReporter, CancellationToken cancellationToken = default)
@ -1475,6 +1482,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// <param name="endpoint">The messages endpoint.</param>
/// <param name="folder">The creator folder path.</param>
/// <param name="statusReporter">Status reporter.</param>
/// <param name="cancellationToken"></param>
/// <returns>A message collection.</returns>
public async Task<MessageEntities.MessageCollection> GetMessages(string endpoint, string folder,
IStatusReporter statusReporter, CancellationToken cancellationToken = default)
@ -1664,6 +1672,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// </summary>
/// <param name="endpoint">The paid message endpoint.</param>
/// <param name="folder">The creator folder path.</param>
/// <param name="cancellationToken"></param>
/// <returns>A single paid message collection.</returns>
public async Task<PurchasedEntities.SinglePaidMessageCollection> GetPaidMessage(string endpoint, string folder, CancellationToken cancellationToken = default)
{
@ -1810,6 +1819,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// <param name="folder">The creator folder path.</param>
/// <param name="username">The creator username.</param>
/// <param name="statusReporter">Status reporter.</param>
/// <param name="cancellationToken"></param>
/// <returns>A paid message collection.</returns>
public async Task<PurchasedEntities.PaidMessageCollection> GetPaidMessages(string endpoint, string folder,
string username,
@ -2034,6 +2044,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// </summary>
/// <param name="endpoint">The purchased tab endpoint.</param>
/// <param name="users">Known users map.</param>
/// <param name="cancellationToken"></param>
/// <returns>A username-to-userId map.</returns>
public async Task<Dictionary<string, long>> GetPurchasedTabUsers(string endpoint, Dictionary<string, long> users, CancellationToken cancellationToken = default)
{
@ -2202,6 +2213,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
/// <param name="endpoint">The purchased tab endpoint.</param>
/// <param name="folder">The base download folder.</param>
/// <param name="users">Known users map.</param>
/// <param name="cancellationToken"></param>
/// <returns>A list of purchased tab collections.</returns>
public async Task<List<PurchasedEntities.PurchasedTabCollection>> GetPurchasedTab(string endpoint, string folder,
Dictionary<string, long> users, CancellationToken cancellationToken = default)

View File

@ -36,7 +36,7 @@ internal sealed class AvaloniaDownloadEventHandler(
progressStart(description, maxValue, showSize);
try
{
AvaloniaProgressReporter reporter = new(progressIncrement, isCancellationRequested, cancellationToken);
AvaloniaProgressReporter reporter = new(progressIncrement, isCancellationRequested, CancellationToken);
return await work(reporter);
}
finally

View File

@ -24,7 +24,8 @@ public partial class CreatorConfigEditorViewModel : ViewModelBase
public void LoadFromConfig(Dictionary<string, CreatorConfig> configs)
{
Rows.Clear();
foreach (KeyValuePair<string, CreatorConfig> kvp in configs.OrderBy(c => c.Key, StringComparer.OrdinalIgnoreCase))
foreach (KeyValuePair<string, CreatorConfig> kvp in configs.OrderBy(c => c.Key,
StringComparer.OrdinalIgnoreCase))
{
Rows.Add(new CreatorConfigRowViewModel(kvp.Key, kvp.Value, OnDeleteRow, OnEditRow));
}
@ -37,6 +38,7 @@ public partial class CreatorConfigEditorViewModel : ViewModelBase
{
result[row.Username] = row.Config;
}
return result;
}
@ -53,24 +55,11 @@ public partial class CreatorConfigEditorViewModel : ViewModelBase
private void AddCreator()
{
Log.Information("AddCreator command executed");
Log.Information("ModalViewModel is null: {IsNull}", ModalViewModel == null);
_editingRow = null;
if (ModalViewModel != null)
{
Log.Information("Calling ModalViewModel.OpenForAdd()");
ModalViewModel.OpenForAdd();
Log.Information("After OpenForAdd - Modal IsOpen: {IsOpen}", ModalViewModel.IsOpen);
}
else
{
Log.Error("ModalViewModel is null, cannot open modal");
}
ModalViewModel.OpenForAdd();
}
private void OnDeleteRow(CreatorConfigRowViewModel row)
{
Rows.Remove(row);
}
private void OnDeleteRow(CreatorConfigRowViewModel row) => Rows.Remove(row);
private void OnEditRow(CreatorConfigRowViewModel row)
{

View File

@ -131,9 +131,9 @@ public partial class MainWindowViewModel(
private AppScreen _configReturnScreen = AppScreen.Loading;
private bool _isApplyingListSelection;
public ObservableCollection<ConfigFieldViewModel> ConfigFields { get; } = [];
private ObservableCollection<ConfigFieldViewModel> ConfigFields { get; } = [];
public ObservableCollection<ConfigCategoryViewModel> ConfigCategories { get; } = [];
private static ObservableCollection<ConfigCategoryViewModel> ConfigCategories => [];
public ObservableCollection<ConfigCategoryViewModel> ConfigCategoriesLeft { get; } = [];
@ -224,9 +224,12 @@ public partial class MainWindowViewModel(
public bool HasMediaSourcesError => !string.IsNullOrWhiteSpace(MediaSourcesError);
public string FfmpegPathDisplay => HidePrivateInfo && !string.IsNullOrWhiteSpace(FfmpegPath) ? "[Hidden for Privacy]" : FfmpegPath;
public string FfmpegPathDisplay =>
HidePrivateInfo && !string.IsNullOrWhiteSpace(FfmpegPath) ? "[Hidden for Privacy]" : FfmpegPath;
public string DownloadPathDisplay => HidePrivateInfo && !string.IsNullOrWhiteSpace(DownloadPath) ? "[Hidden for Privacy]" : DownloadPath;
public string DownloadPathDisplay => HidePrivateInfo && !string.IsNullOrWhiteSpace(DownloadPath)
? "[Hidden for Privacy]"
: DownloadPath;
public string FfmpegPathHelpText => GetConfigHelpText(nameof(Config.FFmpegPath));
@ -310,7 +313,9 @@ public partial class MainWindowViewModel(
{
string normalizedPath = NormalizePathForDisplay(path);
_actualFfmpegPath = normalizedPath;
FfmpegPath = HidePrivateInfo && !string.IsNullOrWhiteSpace(normalizedPath) ? "[Hidden for Privacy]" : normalizedPath;
FfmpegPath = HidePrivateInfo && !string.IsNullOrWhiteSpace(normalizedPath)
? "[Hidden for Privacy]"
: normalizedPath;
FfmpegPathError = string.Empty;
}
@ -318,7 +323,9 @@ public partial class MainWindowViewModel(
{
string normalizedPath = NormalizePathForDisplay(path);
_actualDownloadPath = normalizedPath;
DownloadPath = HidePrivateInfo && !string.IsNullOrWhiteSpace(normalizedPath) ? "[Hidden for Privacy]" : normalizedPath;
DownloadPath = HidePrivateInfo && !string.IsNullOrWhiteSpace(normalizedPath)
? "[Hidden for Privacy]"
: normalizedPath;
DownloadPathError = string.Empty;
}
@ -475,21 +482,7 @@ public partial class MainWindowViewModel(
private void AddCreatorConfig()
{
Log.Information("=== AddCreatorConfig command called ===");
Log.Information("CreatorConfigEditor is null: {IsNull}", CreatorConfigEditor == null);
if (CreatorConfigEditor != null)
{
Log.Information("CreatorConfigEditor.AddCreatorCommand is null: {IsNull}", CreatorConfigEditor.AddCreatorCommand == null);
Log.Information("ModalViewModel is null: {IsNull}", CreatorConfigEditor.ModalViewModel == null);
if (CreatorConfigEditor.ModalViewModel != null)
{
Log.Information("ModalViewModel.IsOpen before: {IsOpen}", CreatorConfigEditor.ModalViewModel.IsOpen);
}
CreatorConfigEditor.AddCreatorCommand.Execute(null);
if (CreatorConfigEditor.ModalViewModel != null)
{
Log.Information("ModalViewModel.IsOpen after: {IsOpen}", CreatorConfigEditor.ModalViewModel.IsOpen);
}
}
CreatorConfigEditor.AddCreatorCommand.Execute(null);
}
[RelayCommand]
@ -625,14 +618,15 @@ public partial class MainWindowViewModel(
0,
false);
CancellationTokenSource cancellationSource = _workCancellationSource;
AvaloniaDownloadEventHandler eventHandler = new(
AppendLog,
UpdateProgressStatus,
StartDownloadProgress,
IncrementDownloadProgress,
StopDownloadProgress,
() => _workCancellationSource?.IsCancellationRequested == true,
_workCancellationSource.Token);
() => cancellationSource.IsCancellationRequested,
cancellationSource.Token);
try
{
@ -762,6 +756,7 @@ public partial class MainWindowViewModel(
{
_actualFfmpegPath = value;
}
FfmpegPathError = string.Empty;
}
@ -771,6 +766,7 @@ public partial class MainWindowViewModel(
{
_actualDownloadPath = value;
}
DownloadPathError = string.Empty;
}
@ -936,7 +932,7 @@ public partial class MainWindowViewModel(
UpdateUserListsCollection();
UpdateIgnoredUsersListFieldOptions();
CreatorConfigEditor?.UpdateAvailableUsers(_allUsers.Keys);
CreatorConfigEditor.UpdateAvailableUsers(_allUsers.Keys);
SelectedListName = null;
@ -1100,8 +1096,8 @@ public partial class MainWindowViewModel(
private void UpdateIgnoredUsersListFieldOptions()
{
IEnumerable<string> listNames = _allLists.Keys
.OrderBy(listName => listName, StringComparer.OrdinalIgnoreCase);
List<string> listNames = _allLists.Keys
.OrderBy(listName => listName, StringComparer.OrdinalIgnoreCase).ToList();
foreach (ConfigFieldViewModel field in ConfigFields.Where(field => field.IsIgnoredUsersListField))
{
@ -1128,7 +1124,9 @@ public partial class MainWindowViewModel(
string downloadPath = ResolveDownloadPathForDisplay(config.DownloadPath);
_actualDownloadPath = downloadPath;
DownloadPath = HidePrivateInfo && !string.IsNullOrWhiteSpace(downloadPath) ? "[Hidden for Privacy]" : downloadPath;
DownloadPath = HidePrivateInfo && !string.IsNullOrWhiteSpace(downloadPath)
? "[Hidden for Privacy]"
: downloadPath;
ClearSpecialConfigErrors();

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,7 @@ namespace OF_DL.Gui.Views;
public partial class MainWindow : Window
{
private bool _hasInitialized;
public MainWindowViewModel? ViewModel => DataContext as MainWindowViewModel;
public MainWindow()
{