-
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
Merged
Merged
Develop #6
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
636b02e
refactor(*.xaml, *.cs): Refactor authentication flow to use Authentic…
EnesEfeTokta e27b618
feat(*.cs): Add ViewModels and update MainViewModel and MainWindow
EnesEfeTokta b9333d0
feat(*.cs): Implement navigation and messaging for main window
EnesEfeTokta 6f1a0c4
feat(*.cs): Add JWT token validation to login flow
EnesEfeTokta 8396d45
feat(*.cs): Integrate Serilog and DI with generic host in WPF app
EnesEfeTokta c067a74
feat(*.cs): Add DI, interfaces, and logging to authentication flow
EnesEfeTokta a74b1c4
refactor(*.cs): Refactor authentication window and token storage hand…
EnesEfeTokta 24e756d
feat(*.cs): Add API service and dependency injection improvements
EnesEfeTokta 93e0d9b
refactor(*.xaml, *.cs): Refactor DashboardView to use dynamic data bi…
EnesEfeTokta 9d1beb9
refactor(*.xaml, *.cs): Refactor dashboard models and enhance dashbo…
EnesEfeTokta 114983c
refactor(*.cs): Refactor AccountType enum and clean up unused usings
EnesEfeTokta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,111 @@ | ||
| using System.Windows; | ||
| using CommunityToolkit.Mvvm.Messaging; | ||
| using FinTrack.Core; | ||
| using FinTrack.Services; | ||
| using FinTrack.Services.Api; | ||
| using FinTrack.ViewModels; | ||
| using FinTrack.Views; | ||
| using Microsoft.Extensions.DependencyInjection; | ||
| using Microsoft.Extensions.Hosting; | ||
| using Microsoft.Extensions.Logging; | ||
| using Serilog; | ||
| using System.Windows; | ||
|
|
||
| namespace FinTrack | ||
| { | ||
| public partial class App : Application | ||
| { | ||
| protected override void OnStartup(StartupEventArgs e) | ||
| private readonly IHost _host; | ||
|
|
||
| public App() | ||
| { | ||
| _host = Host.CreateDefaultBuilder() | ||
| .UseSerilog((context, services, configuration) => | ||
| { | ||
| configuration.ReadFrom.Configuration(context.Configuration); | ||
| }) | ||
| .ConfigureServices((context, services) => | ||
| { | ||
| ConfigureServices(services); | ||
| }) | ||
| .Build(); | ||
|
|
||
| SetupGlobalExceptionHandling(); | ||
| } | ||
|
|
||
| private void ConfigureServices(IServiceCollection services) | ||
| { | ||
| services.AddSingleton<IMessenger>(WeakReferenceMessenger.Default); | ||
|
|
||
| services.AddSingleton<MainWindow>(); | ||
| services.AddSingleton<AuthenticatorWindow>(); | ||
|
|
||
| services.AddSingleton<MainViewModel>(); | ||
| services.AddSingleton<LoginViewModel>(); | ||
|
|
||
| services.AddTransient<TopBarViewModel>(); | ||
| services.AddTransient<BottomBarViewModel>(); | ||
|
|
||
| services.AddTransient<RegisterViewModel>(); | ||
| services.AddTransient<OtpVerificationViewModel>(); | ||
| services.AddTransient<ForgotPasswordViewModel>(); | ||
| services.AddTransient<ApplicationRecognizeSlideViewModel>(); | ||
| services.AddTransient<AuthenticatorViewModel>(); | ||
| services.AddTransient<DashboardViewModel>(); | ||
| services.AddTransient<BudgetViewModel>(); | ||
| services.AddTransient<AccountViewModel>(); | ||
| services.AddTransient<TransactionsViewModel>(); | ||
| services.AddTransient<ReportsViewModel>(); | ||
| services.AddTransient<FinBotViewModel>(); | ||
| services.AddTransient<CurrenciesViewModel>(); | ||
| services.AddTransient<DebtViewModel>(); | ||
| services.AddTransient<SettingsViewModel>(); | ||
| services.AddTransient<FeedbackViewModel>(); | ||
| services.AddTransient<NotificationViewModel>(); | ||
|
|
||
| services.AddSingleton<IAuthService, AuthService>(); | ||
| services.AddSingleton<ISecureTokenStorage, SecureTokenStorage>(); | ||
| services.AddSingleton<IApiService, ApiService>(); | ||
| } | ||
|
|
||
| protected override async void OnStartup(StartupEventArgs e) | ||
| { | ||
| await _host.StartAsync(); | ||
|
|
||
| var logger = _host.Services.GetRequiredService<ILogger<App>>(); | ||
| logger.LogInformation("Uygulama başlatıldı ve Host çalışıyor."); | ||
|
|
||
| var window = _host.Services.GetRequiredService<AuthenticatorWindow>(); | ||
| window.Show(); | ||
|
|
||
| base.OnStartup(e); | ||
| new LoginWindow().Show(); | ||
| } | ||
|
|
||
| private void SetupGlobalExceptionHandling() | ||
| { | ||
| DispatcherUnhandledException += (sender, e) => | ||
| { | ||
| var logger = _host.Services.GetRequiredService<ILogger<App>>(); | ||
| logger.LogCritical(e.Exception, "YAKALANAMAYAN UI HATASI!"); | ||
|
|
||
| MessageBox.Show("Beklenmedik bir hata oluştu. Uygulama kapanacak. Detaylar log dosyasına yazıldı.", "Kritik Hata", MessageBoxButton.OK, MessageBoxImage.Error); | ||
| e.Handled = true; | ||
| Shutdown(); | ||
| }; | ||
|
|
||
| AppDomain.CurrentDomain.UnhandledException += (sender, e) => | ||
| { | ||
| var logger = _host.Services.GetRequiredService<ILogger<App>>(); | ||
| logger.LogCritical(e.ExceptionObject as Exception, "YAKALANAMAYAN ARKA PLAN HATASI!"); | ||
| }; | ||
| } | ||
|
|
||
| protected override async void OnExit(ExitEventArgs e) | ||
| { | ||
| using (_host) | ||
| { | ||
| await _host.StopAsync(TimeSpan.FromSeconds(5)); | ||
| } | ||
| base.OnExit(e); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| namespace FinTrack.Core | ||
| { | ||
| public interface ISecureTokenStorage | ||
| { | ||
| void SaveToken(string token); | ||
| string? GetToken(); | ||
| void ClearToken(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| using System.IdentityModel.Tokens.Jwt; | ||
|
|
||
| namespace FinTrack.Core | ||
| { | ||
| public static class TokenValidator | ||
| { | ||
| public static bool IsTokenValid(string token) | ||
| { | ||
| if (string.IsNullOrWhiteSpace(token)) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| var tokenHanler = new JwtSecurityTokenHandler(); | ||
|
|
||
| try | ||
| { | ||
| var jwtToken = tokenHanler.ReadJwtToken(token); | ||
|
|
||
| var expiration = jwtToken.ValidTo; | ||
|
|
||
| return expiration > DateTime.UtcNow; | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"Token validation failed: {ex.Message}"); | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| namespace FinTrack.Dtos | ||
| { | ||
| public class UserProfileDto | ||
| { | ||
| public int Id { get; set; } | ||
| public string UserName { get; set; } = string.Empty; | ||
| public string Email { get; set; } = string.Empty; | ||
| public string ProfilePicture { get; set; } = string.Empty; | ||
| public string Role { get; set; } = string.Empty; | ||
| public string MembershipType { get; set; } = string.Empty; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| namespace FinTrack.Enums | ||
| { | ||
| public enum AccountType | ||
| { | ||
| Checking, | ||
| Savings, | ||
| CreditCard, | ||
| Cash, | ||
| Investment, | ||
| Loan, | ||
| Other, | ||
| } // Kontrol, Tasarruf, Kredi Kartı, Nakit, Yatırım, Kredi, Diğer | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| namespace FinTrack.Enums | ||
| { | ||
| public enum TransactionType { Income, Expense } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| namespace FinTrack.Messages | ||
| { | ||
| public class LoginSuccessMessage { } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| namespace FinTrack.Messages | ||
| { | ||
| public class LoginSuccessMessag | ||
| { | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| using System.Windows.Media; | ||
|
|
||
| namespace FinTrack.Models.Dashboard | ||
| { | ||
| public class AccountDashboard | ||
| { | ||
| public string Name { get; set; } = string.Empty; | ||
| public double Percentage { get; set; } | ||
| public string Balance { get; set; } = string.Empty; | ||
| public Brush ProgressBarBrush { get; set; } = Brushes.Transparent; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| using System.Windows.Media; | ||
|
|
||
| namespace FinTrack.Models.Dashboard | ||
| { | ||
| public class BudgetDashboard | ||
| { | ||
| public string Name { get; set; } = string.Empty; | ||
| public string DueDate { get; set; } = string.Empty; | ||
| public string Amount { get; set; } = string.Empty; | ||
| public string RemainingTime { get; set; } = string.Empty; | ||
| public Brush StatusBrush { get; set; } = Brushes.Transparent; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| namespace FinTrack.Models.Dashboard | ||
| { | ||
| public class CurrencyRateDashboard | ||
| { | ||
| public string FromCurrencyFlagUrl { get; set; } = string.Empty; | ||
| public string FromCurrencyCountry { get; set; } = string.Empty; | ||
| public string FromCurrencyName { get; set; } = string.Empty; | ||
| public string FromCurrencyAmount { get; set; } = string.Empty; | ||
| public string ToCurrencyFlagUrl { get; set; } = string.Empty; | ||
| public string ToCurrencyCountry { get; set; } = string.Empty; | ||
| public string ToCurrencyName { get; set; } = string.Empty; | ||
| public string ToCurrencyAmount { get; set; } = string.Empty; | ||
| public double ToCurrencyImageHeight { get; set; } = 20; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||
| namespace FinTrack.Models.Dashboard | ||||||
| { | ||||||
| public class DebtDashboard | ||||||
| { | ||||||
| public string LenderName { get; set; } = string.Empty; | ||||||
| public string LenderIconPath { get; set; } = string.Empty; | ||||||
| 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; | ||||||
|
||||||
| public string StatusBrush { get; set; } = string.Empty; | |
| public System.Windows.Media.Brush StatusBrush { get; set; } = System.Windows.Media.Brushes.Transparent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| namespace FinTrack.Models.Dashboard | ||
| { | ||
| public class MembershipDashboard | ||
| { | ||
| public string Level { get; set; } = string.Empty; | ||
| public string StartDate { get; set; } = string.Empty; | ||
| public string RenewalDate { get; set; } = string.Empty; | ||
| public string Price { get; set; } = string.Empty; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| namespace FinTrack.Models.Dashboard | ||
| { | ||
| public class ReportDashboard | ||
| { | ||
| public string Name { get; set; } = string.Empty; | ||
| public string IconPath { get; set; } = "/Assets/Icons/report.png"; | ||
| public string[] Formats { get; set; } = { "PDF", "WORD", "TEXT", "XML", "EXCEL", "MD" }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| using FinTrack.Enums; | ||
| using System.Windows.Media; | ||
|
|
||
| namespace FinTrack.Models.Dashboard | ||
| { | ||
| public class TransactionDashboard | ||
| { | ||
| public string DateText { get; set; } = string.Empty; | ||
| public string Description { get; set; } = string.Empty; | ||
| public string Amount { get; set; } = string.Empty; | ||
| public string Category { get; set; } = string.Empty; | ||
| public TransactionType Type { get; set; } = TransactionType.Expense; | ||
| public Brush DateBadgeBrush => Type == TransactionType.Income ? Brushes.Green : Brushes.Red; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.