-
Notifications
You must be signed in to change notification settings - Fork 0
Develop #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #6
Conversation
…atorWindow Introduced AuthenticatorViewModel to manage authentication-related view models and navigation. Renamed LoginWindow to AuthenticatorWindow and updated references accordingly. Removed HomeViewModel and refactored MainViewModel to remove authentication logic, centralizing it in the new AuthenticatorViewModel.
Introduced new ViewModel classes for Account, Budget, Currencies, Debt, Feedback, FinBot, Notification, Reports, Settings, and Transactions. Updated MainViewModel to instantiate and manage these ViewModels, and added a CurrentCenterViewModel property. Modified MainWindow.xaml to bind the center content to CurrentCenterViewModel instead of a static NotificationView.
Refactored MainWindow to use view model-driven navigation with DataTemplates for dynamic content. Introduced LoginSuccessMessage and navigation message classes for decoupled communication. Updated TopBarViewModel to expose navigation events and commands, and MainViewModel to handle navigation logic. AuthenticatorWindow now listens for login success and opens MainWindow. Updated TopBarView and MainWindow XAML to bind to new navigation commands and view models.
Introduced TokenValidator utility using System.IdentityModel.Tokens.Jwt to check token validity. Updated LoginViewModel to validate tokens before using them, displaying an error and clearing invalid tokens. Added required NuGet package to project file.
Refactored App.xaml.cs to use Microsoft.Extensions.Hosting for dependency injection and Serilog for logging. Added global exception handling for UI and background errors. Updated project references to include required Serilog and hosting packages.
Introduced IAuthService and ISecureTokenStorage interfaces and updated AuthService and SecureTokenStorage to implement them. Registered all ViewModels and services with dependency injection in App.xaml.cs. Refactored AuthenticatorViewModel and LoginViewModel to use constructor injection and interfaces, and added logging throughout LoginViewModel. Updated AuthenticatorWindow to use DI for its ViewModel.
…ling Changed AuthenticatorWindow to be a singleton and set it as the startup window. Refactored LoginViewModel to use dependency-injected ISecureTokenStorage instead of instantiating SecureTokenStorage directly, improving testability and consistency. Also initialized view models in AuthenticatorViewModel constructor.
Introduces IApiService and ApiService for HTTP API communication, along with UserProfileDto for user profile data. Refactors MainViewModel, RegisterViewModel, OtpVerificationViewModel, and TopBarViewModel to use dependency injection and logging. Updates App.xaml.cs to register new services and view models as singletons or transients. MainWindow and AuthenticatorWindow now receive their dependencies via constructor injection, and MainWindow's DataContext is set programmatically. TopBarViewModel now loads user profile data on login success using the new API service.
…ndings Replaced hardcoded budget, currency, account, transaction, debt, and report lists in DashboardView.xaml with ItemsControl and data bindings to corresponding ViewModel collections. Added BudgetDashboard model and updated DashboardViewModel to provide sample data for budgets. Updated API service methods to return nullable types. Minor code cleanup and improved naming consistency.
…rd UI Moved dashboard-related classes to a new Dashboard namespace and added new models for accounts, currency rates, debts, memberships, reports, and transactions. Updated DashboardViewModel to use these new models and provide sample data. Refactored DashboardView.xaml to use the new models and improved the layout and styling of dashboard cards, including new styles for scrollbars and report format buttons. Adjusted MainWindow.xaml to start maximized and improved background handling.
Moved AccountType enum to a new Enums/AccountType.cs file and updated references in AccountModel. Removed unused using directives across multiple files for improved code clarity and maintainability. Minor formatting and whitespace adjustments were also made.
There was a problem hiding this 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 PR refactors the application startup to use .NET Generic Host and DI, rewires view/viewmodel wiring in XAML, and standardizes navigation via commands on the top bar.
- Moved from manual window instantiation to Host-based startup in App.xaml.cs
- Switched MainWindow and TopBarView to use DI-injected view models and ContentControls
- Added command bindings and removed hardcoded placeholders in DashboardView and other views
Reviewed Changes
Copilot reviewed 48 out of 48 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| App.xaml.cs | Configures Host, Serilog, DI registrations, and global error handling |
| Views/MainWindow.xaml & .cs | Replaced direct DataContext with DI constructor injection and ContentControl templates |
| Views/TopBarView.xaml | Updated design‐time VM, added navigation Command bindings |
| ViewModels/TopBarViewModel.cs | Introduced RelayCommands and navigation events |
| ViewModels/MainViewModel.cs | Subscribes to TopBarViewModel navigation events to switch center view |
Comments suppressed due to low confidence (2)
FinTrack/ViewModels/TopBarViewModel.cs:27
- There's a typo in the event name: NavigateToBudegtRequested should be NavigateToBudgetRequested to match other naming and avoid confusion.
public event Action? NavigateToBudegtRequested;
FinTrack/Core/TokenValidator.cs:14
- [nitpick] Variable name tokenHanler has a typo; rename to tokenHandler for clarity.
var tokenHanler = new JwtSecurityTokenHandler();
| _forgotPasswordViewModel.NavigateToLoginRequested += () => CurrentViewModel = _loginViewModel; | ||
| topBarViewModel.NavigateToDashboardRequested += () => CurrentCenterViewModel = _dashboardViewModel; | ||
| topBarViewModel.NavigateToAccountRequested += () => CurrentCenterViewModel = _accountViewModel; | ||
| topBarViewModel.NavigateToBudegtRequested += () => CurrentCenterViewModel = _budgetViewModel; |
Copilot
AI
Jul 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This subscription references NavigateToBudegtRequested (typo) instead of NavigateToBudgetRequested—navigation to the Budget view will never fire.
| topBarViewModel.NavigateToBudegtRequested += () => CurrentCenterViewModel = _budgetViewModel; | |
| topBarViewModel.NavigateToBudgetRequested += () => CurrentCenterViewModel = _budgetViewModel; |
| @@ -0,0 +1,6 @@ | |||
| namespace FinTrack.Messages | |||
| { | |||
| public class LoginSuccessMessag | |||
Copilot
AI
Jul 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class name is missing the final 'e'. Rename LoginSuccessMessag to LoginSuccessMessage to match usage elsewhere.
| public class LoginSuccessMessag | |
| public class LoginSuccessMessage |
| public string BorrowerName { get; set; } = string.Empty; | ||
| public string BorrowerIconPath { get; set; } = string.Empty; | ||
| public string Status { get; set; } = string.Empty; | ||
| public string StatusBrush { get; set; } = string.Empty; |
Copilot
AI
Jul 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StatusBrush is a string but XAML binds it to a Brush (BorderBrush). Change this property to type Brush or provide a converter to avoid runtime type mismatch.
| public string StatusBrush { get; set; } = string.Empty; | |
| public System.Windows.Media.Brush StatusBrush { get; set; } = System.Windows.Media.Brushes.Transparent; |
This pull request introduces significant changes to the
FinTrackproject, focusing on dependency injection, token management, new models and enums, and dashboard-related features. It also integrates logging and exception handling mechanisms using Serilog. Below is a categorized summary of the most important changes:Dependency Injection and Application Initialization
App.xaml.csto useMicrosoft.Extensions.Hostingfor dependency injection. Registered services, view models, and views, and set up global exception handling with Serilog for logging critical errors. ([FinTrack/App.xaml.csL1-R108](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-0481ab71b37b244c8c2477227d0b66e0607e955ac4b03a362e8311401aef4596L1-R108))Token Management
ISecureTokenStorageinterface and implemented it inSecureTokenStorageto manage token storage securely. ([[1]](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-de9de02a172dc8e33285c0f02d15ec9761c7dd38f54d1d9f86c0ae7e6a9e9b50R1-R9),[[2]](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-d6899d8598428e5d00291491299594d31697fd9f5647a4aaabfae8912185f378L7-R7))TokenValidatorclass to validate JWT tokens, checking expiration and handling errors gracefully. ([FinTrack/Core/TokenValidator.csR1-R31](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-300ab41693115092051c68b912443db2767b4f677f4c628556eb93421d7cb4ccR1-R31))New Models and Enums
UserProfileDtoto represent user profile data. ([FinTrack/Dtos/UserProfileDto.csR1-R12](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-d74a8f00a65da3f549d084f4ac9f1c4c847c2ef164081063f8aef6ad0a9d39d2R1-R12))AccountTypeandTransactionTypeto standardize account and transaction classifications. ([[1]](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-d3b0305932c86809a0583fff77af86743858a43bc5ebfaf16f2d2a00f91aae19R1-R13),[[2]](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-f59108c4abe4d02f8bd7d15e7835f2e57b0278844f02cbeb37967c0437b786baR1-R4))Dashboard Models
AccountDashboard,BudgetDashboard,CurrencyRateDashboard,DebtDashboard,MembershipDashboard,ReportDashboard,TransactionDashboard) to support UI features like progress bars, currency rates, and transaction details. ([[1]](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-298fd706ddbefd2923f54bf8bdc008d2ca658157b84dc3f8b5ccb12483a1edeeR1-R12),[[2]](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-2b427dcb37dcca2d608e6357eba95c60c07618aecf848186da3c477ac0f5d92cR1-R13),[[3]](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-a059b13876a0587b4d3858c10975033b0dbf5de019dbeb83fe85f1f253c223a3R1-R15),[[4]](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-89723f9efe4e745341fd94ef11fdb0545c9e9648a3d8cc23d1b7fc2f76de5ef6R1-R16),[[5]](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-5bdd72bab376828c3dc968aaca109d49530d160f2f84d1c0eb3aed5c676d0c28R1-R10),[[6]](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-f80feadaf2c117ddb233235920d2f5b4a39131b97ce677eb8357ccbf656238b2R1-R9),[[7]](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-f0fe1ca489d876d73f74da8bc6873ccb3456c78636f46028bf30577ff2d8d066R1-R15))Project Dependencies
FinTrack.csprojto include new dependencies forMicrosoft.Extensions.Hosting, Serilog, and JWT token handling. ([FinTrack/FinTrack.csprojR52-R59](https://github.com/EnesEfeTokta/FinTrackForWindows/pull/6/files#diff-cc8192be7c37bfd6c92d02156a8c7cab2489666b7a2da65a90b2ab5bba8befcdR52-R59))