Skip to content

Conversation

@EnesEfeTokta
Copy link
Owner

This pull request introduces several new features and improvements related to debt management and video handling in the application. The main highlights are the addition of camera/video recording capabilities, enhancements to the debt model for supporting video evidence, and new API integrations for video streaming and marking debts as defaulted. There are also supporting updates in dependency management and UI logic.

New Features: Camera and Video Support

  • Added a new CameraService implementing ICameraService for capturing and recording videos using the user's camera, leveraging Emgu.CV and WPF integration. This includes frame capture, video recording, and resource management. (FinTrack/Services/Camera/CameraService.cs, FinTrack/Services/Camera/ICameraService.cs, FinTrack/App.xaml.cs) [1] [2] [3] [4]
  • Registered CameraService in the application's dependency injection container.

Debt Model and Business Logic Enhancements

  • Extended DebtDto and DebtModel to include the VideoMetadataId property, enabling association of debts with video evidence. (FinTrack/Dtos/DebtDtos/DebtDto.cs, FinTrack/Models/Debt/DebtModel.cs, FinTrack/Services/Debts/DebtStore.cs) [1] [2] [3]
  • Added new computed properties and logic in DebtModel for controlling the visibility of UI actions such as "Watch Collateral Video" and "Mark as Defaulted," based on debt status, user role, and due date. (FinTrack/Models/Debt/DebtModel.cs) [1] [2] [3]

API and Service Integrations

  • Implemented new methods in ApiService and DebtStore for streaming video files and marking debts as defaulted via API, including interface updates. (FinTrack/Services/Api/ApiService.cs, FinTrack/Services/Api/IApiService.cs, FinTrack/Services/Debts/DebtStore.cs, FinTrack/Services/Debts/IDebtStore.cs) [1] [2] [3] [4]
  • Updated API base URLs for local development. (FinTrack/Services/Api/ApiService.cs, FinTrack/Services/AuthService.cs) [1] [2]

Dependency and Infrastructure Updates

  • Added new NuGet packages for video processing (Emgu.CV.Bitmap, Emgu.CV.runtime.windows), UI enhancements (ReactiveUI.WPF), and image handling (System.Drawing.Common). (FinTrack/FinTrackForWindows.csproj) [1] [2]

UI and Status Improvements

  • Improved status color coding in DebtModel for better visual distinction and updated status text for the "Defaulted" state. (FinTrack/Models/Debt/DebtModel.cs) [1] [2]

Let me know if you want to see how to use the new camera or video features in the UI, or if you need details about the API changes!

Introduces camera/video recording support using Emgu.CV and ReactiveUI, enabling borrowers to record and upload collateral videos for debts. Adds new services (CameraService, ICameraService), view models (VideoRecorderViewModel), and views (VideoRecorderWindow, VideoPlayerWindow, KeyEntryWindow) for video capture and playback. DebtModel and DebtDto are updated to support video metadata. DebtViewModel now supports video upload, marking debts as defaulted, and secure video viewing for lenders. Filtering and charting improvements are added to Account, Budget, and Transactions view models. Updates dependencies in the project file to support new features.
Removed unused and redundant using statements across multiple files and reordered some for consistency. This improves code readability and reduces unnecessary dependencies.
@EnesEfeTokta EnesEfeTokta requested a review from Copilot August 5, 2025 13:26
@EnesEfeTokta EnesEfeTokta self-assigned this Aug 5, 2025
@EnesEfeTokta EnesEfeTokta added the enhancement New feature or request label Aug 5, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces comprehensive video recording and debt management capabilities to the FinTrack application. The main purpose is to enable borrowers to record guarantee videos using their camera and allow lenders to view these videos when debts are defaulted.

Key changes include:

  • Implementation of camera/video recording service with OpenCV integration for capturing and recording videos directly in the application
  • Enhancement of debt management workflow with video evidence support and new status-based UI controls
  • Addition of video streaming capabilities and debt defaulting functionality through new API endpoints

Reviewed Changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
VideoRecorderWindow.xaml/.cs New video recording interface with camera preview and commitment text display
VideoPlayerWindow.xaml/.cs New video playback window with automatic cleanup of temporary files
VideoRecorderViewModel.cs ViewModel managing camera operations, recording state, and file handling
KeyEntryWindow.xaml/.cs New dialog for entering encryption keys to access guarantee videos
DebtView.xaml Updated UI with new buttons for marking debts as defaulted and viewing guarantee videos
DebtViewModel.cs Enhanced with camera service integration and video upload/viewing logic
DebtModel.cs Added video metadata support and computed properties for UI visibility
CameraService.cs/ICameraService.cs New service implementing camera capture and video recording using Emgu.CV
DebtStore.cs/IDebtStore.cs Extended with methods for marking debts as defaulted and streaming videos
ApiService.cs/IApiService.cs Added file streaming capabilities for video content
TransactionsView.xaml Enhanced with advanced filtering options and chart visualizations
TransactionsViewModel.cs Major refactoring to support filtering and LiveCharts integration
BudgetView.xaml/BudgetViewModel.cs Added filtering capabilities for budget management
AccountView.xaml/AccountViewModel.cs Added filtering options for account listings


if (!_cameraService.InitializeCamera())
{
// TODO: Show a user-friendly error message.
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace the TODO comment with actual error handling. Consider showing a MessageBox or setting an error property to inform the user why camera initialization failed.

Suggested change
// TODO: Show a user-friendly error message.
MessageBox.Show("Kamera başlatılamadı. Lütfen kameranın bağlı ve başka bir uygulama tarafından kullanılmadığından emin olun.", "Kamera Hatası", MessageBoxButton.OK, MessageBoxImage.Error);

Copilot uses AI. Check for mistakes.
Comment on lines +30 to +34
Console.WriteLine($"Temporary video file deleted successfully: {_tempVideoPath}");
}
catch (Exception ex)
{
Console.WriteLine($"Could not delete temporary video file: {_tempVideoPath}. Error: {ex.Message}");
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace Console.WriteLine with proper logging using ILogger. Console output may not be visible in production WPF applications and doesn't follow the project's logging patterns.

Suggested change
Console.WriteLine($"Temporary video file deleted successfully: {_tempVideoPath}");
}
catch (Exception ex)
{
Console.WriteLine($"Could not delete temporary video file: {_tempVideoPath}. Error: {ex.Message}");
_logger.LogInformation("Temporary video file deleted successfully: {TempVideoPath}", _tempVideoPath);
}
catch (Exception ex)
{
_logger.LogError(ex, "Could not delete temporary video file: {TempVideoPath}. Error: {ErrorMessage}", _tempVideoPath, ex.Message);

Copilot uses AI. Check for mistakes.
Comment on lines +30 to +34
Console.WriteLine($"Temporary video file deleted successfully: {_tempVideoPath}");
}
catch (Exception ex)
{
Console.WriteLine($"Could not delete temporary video file: {_tempVideoPath}. Error: {ex.Message}");
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace Console.WriteLine with proper logging using ILogger. Console output may not be visible in production WPF applications and doesn't follow the project's logging patterns.

Suggested change
Console.WriteLine($"Temporary video file deleted successfully: {_tempVideoPath}");
}
catch (Exception ex)
{
Console.WriteLine($"Could not delete temporary video file: {_tempVideoPath}. Error: {ex.Message}");
_logger.LogInformation("Temporary video file deleted successfully: {TempVideoPath}", _tempVideoPath);
}
catch (Exception ex)
{
_logger.LogError(ex, "Could not delete temporary video file: {TempVideoPath}", _tempVideoPath);

Copilot uses AI. Check for mistakes.

private readonly ILogger<CameraService> _logger;

public Action<BitmapSource>? OnFrameReady { get; set; }
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using an event instead of an Action property for better encapsulation and thread safety. This would prevent external code from setting the callback to null accidentally.

Suggested change
public Action<BitmapSource>? OnFrameReady { get; set; }
public event Action<BitmapSource>? OnFrameReady;

Copilot uses AI. Check for mistakes.
IsTextSearchEnabled="True"
ItemsSource="{Binding DataContext.Categories, RelativeSource={RelativeSource AncestorType=UserControl}}"
Text="{Binding Category, UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding DataContext.CategoriesForForm, RelativeSource={RelativeSource AncestorType=UserControl}}" Text="{Binding Category, UpdateSourceTrigger=PropertyChanged}"
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line appears to be missing proper formatting with the Text binding on the same line as ItemsSource. This should be split into separate lines for better readability.

Suggested change
ItemsSource="{Binding DataContext.CategoriesForForm, RelativeSource={RelativeSource AncestorType=UserControl}}" Text="{Binding Category, UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding DataContext.CategoriesForForm, RelativeSource={RelativeSource AncestorType=UserControl}}"
Text="{Binding Category, UpdateSourceTrigger=PropertyChanged}"

Copilot uses AI. Check for mistakes.
CommandParameter="{Binding}">
<Image Source="/Assets/Images/Icons/edit.png" Width="16" Height="16"/>
</Button>
CommandParameter="{Binding}"/>
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The edit button is missing its Image child element, which would make it invisible to users. Compare with the pattern used in other buttons in the same file.

Suggested change
CommandParameter="{Binding}"/>
CommandParameter="{Binding}">
<Image Source="/Assets/Icons/edit.png" Width="20" Height="20" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Button>

Copilot uses AI. Check for mistakes.
CommandParameter="{Binding}">
<Image Source="/Assets/Images/Icons/delete.png" Width="16" Height="16"/>
</Button>
CommandParameter="{Binding}"/>
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The delete button is missing its Image child element, which would make it invisible to users. Compare with the pattern used in other buttons in the same file.

Suggested change
CommandParameter="{Binding}"/>
CommandParameter="{Binding}">
<Image Source="/Assets/Icons/delete.png" Width="16" Height="16" Stretch="Uniform"/>
</Button>

Copilot uses AI. Check for mistakes.
@EnesEfeTokta EnesEfeTokta merged commit 17843c8 into main Aug 5, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants