Commit Graph

23 Commits

Author SHA1 Message Date
3d789c0352 Implemented a repository-based data layer for expenses and updated Room entities.
The `ExpenseRepository` was introduced to handle data fetching with a caching strategy, utilizing a new `Resource` sealed class to represent Loading, Success, and Error states.

Key changes include:
- Added `ExpenseRepository` to manage data flow between the local database and remote API.
- Updated `MainViewModel` to use the repository and expose expenses via a `StateFlow<Resource<List<Expense>>>`.
- Enhanced Room entities (`Expense`, `ExpenseShare`, `User`) with `@PrimaryKey` annotations and added a `Converters` class to handle `List<String>` types.
- Expanded `AppDatabase` to include DAOs for `Expense`, `ExpenseShare`, and `User`.
- Updated `DashboardScreen` to reactively display loading indicators, error messages, and cached/remote expense data.
2026-03-04 11:56:57 +01:00
37d8e8cc74 Refined network configuration and login UI
The login screen now labels the server input as "Server-Domain", and the network provider has been updated to automatically prepend the HTTPS protocol. The database version has been incremented, and a network security configuration has been added to allow user certificates for debugging. Additionally, the encrypted shared preferences storage name was updated.
v0.1.0-alpha.1
2026-03-03 16:30:21 +01:00
f3f83b7ca9 Implemented expense tracking and data fetching
The `Expense` entity and its associated API endpoints have been updated, and a new `ExpenseShare` entity with a corresponding DAO has been added.

The `MainViewModel` now includes logic to fetch expenses from the server upon successful session validation. The `DashboardScreen` has been updated to display a list of expenses using a `LazyColumn` and a new `ExpenseItem` component. Additionally, the `APIService` has been expanded to include CRUD operations for expenses and user information.
2026-03-01 16:55:09 +01:00
552f604200 Updated RefreshResponse field names and token handling
The `RefreshResponse` data class has been updated to use `access_token` and `refresh_token` to match the API response. Consequently, `MainViewModel` now uses these updated field names when saving new tokens to storage. Debug print statements for access and refresh tokens have also been removed.
2026-02-27 22:21:13 +01:00
f01357987c Cleaned up AndroidManifest.xml
The manifest has been simplified by removing unused namespace declarations and redundant activity labels. Extraneous whitespace and empty lines were also removed for better readability.
2026-02-27 20:35:32 +01:00
b4229c29c4 Cleaned up unused imports
Removed several unused Compose and utility imports from `MainActivity.kt`, `LoginViewModel.kt`, and `APIService.kt` to improve code cleanliness.
2026-02-27 20:06:49 +01:00
d05d93a0d7 Refactored UI components and extracted screens into separate files.
The UI logic from `MainActivity.kt` has been moved into a new `AppContent` composable, and individual screens (`LoginScreen`, `DashboardScreen`, `AccountSelectionScreen`) have been extracted to their own files within the `ui.screens` package.

Additional changes:
- Updated `MainActivity` to use the new `AppContent` structure and handled back navigation for new account logins.
- Fixed a field name mismatch in `RefreshRequest` within `APIService.kt`, changing `refreshToken` to `refresh_token`.
- Minor formatting update in `README.md`.
2026-02-27 20:04:05 +01:00
37e125945b Added a README.md file 2026-02-27 19:34:07 +01:00
463e9b6258 Updated .gitignore
The `.gitignore` file has been reorganized and expanded to include standard exclusions for build artifacts, Kotlin/Java project files, Android Studio metadata, keys/secrets, and OS-generated files.
2026-02-27 19:26:25 +01:00
e99e951232 Updated Login and Git configuration
The `LoginViewModel` now trims whitespace from usernames during the login request and account creation process.

The `.gitignore` file has been updated to exclude `.jks` files and the `/app/release` directory.
2026-02-27 19:23:04 +01:00
ca1ad57f7e Implemented session validation and token refreshing
Added a `SessionState` sealed class to track the connection status and integrated it into the `DashboardScreen`. The dashboard now triggers a session validation on launch, showing a loading indicator during the check.

The `MainViewModel` has been updated with a `validateSession` function that:
- Pings the server using the stored access token.
- Attempts to refresh the token if a 401 Unauthorized response is received.
- Updates the `TokenStorage` with new tokens upon successful refresh.
- Redirects to logout if both tokens are invalid.

Additionally, the `APIService` was expanded with `ping` and `refresh` endpoints, and the `AppDatabase` version was incremented.
2026-02-27 19:04:28 +01:00
8ad212ee76 Integrated TokenStorage into MainViewModel
MainViewModel now accepts a `TokenStorage` instance. When an account is deleted, its associated tokens are now cleared from storage. MainActivity has been updated to initialize and provide the `TokenStorage` to the view model.
2026-02-27 18:33:34 +01:00
dc9f4121e0 Added account deletion and improved login case-insensitivity
The Dashboard now includes a "Löschen" (Delete) button that allows users to remove the currently selected account via the `MainViewModel`.

The login process has been updated to convert usernames to lowercase before authentication to ensure consistency. Additionally, spacing adjustments were made to the Dashboard UI layout.
2026-02-27 18:28:17 +01:00
d94b3f74de Improved account management and navigation
The app now supports adding a new account without logging out of the current session. A `BackHandler` has been implemented in the `LoginScreen` and `DashboardScreen` to improve navigation flow, and the `LoginScreen` now accepts an optional `onBack` callback.
2026-02-27 18:15:18 +01:00
aa10114767 Added LICENSE and updated gitignore
The CC0 1.0 Universal license has been added to the project. The `.gitignore` configuration was consolidated by moving the `/app/build` exclusion to the root `.gitignore` and removing the redundant `app/.gitignore` file.
2026-02-27 17:42:49 +01:00
465a699b30 Implemented network-based authentication and secure token storage
- Replaced mock login logic in `LoginViewModel` with actual API calls using Retrofit.
- Integrated `EncryptedSharedPreferences` via a new `TokenStorage` class to securely persist access and refresh tokens.
- Added `RetrofitProvider` and `APIService` to handle network requests and JSON serialization.
- Updated `Account` entity and database schema (version 2) to include user roles, enabling destructive migration for development.
- Added necessary internet permissions and allowed cleartext traffic in `AndroidManifest.xml`.
- Included dependencies for Retrofit, OkHttp logging, and AndroidX Security.
2026-02-27 17:33:34 +01:00
13d0df0864 feat: Add User and Expense entities with DAOs
This commit introduces the `User` and `Expense` data classes as Room entities. Each entity is accompanied by its corresponding Data Access Object (DAO) with methods for `getAll`, `insert`, and `delete` operations.

Additionally, unused comments were removed from `MainViewModel` and an unnecessary preview was removed from `MainActivity`.
2026-02-21 22:42:13 +01:00
9e0101642a Extended Login and UI</div>
The login process has been expanded to include fields for Server URL, Username, and Password, replacing the previous User ID-only login.

The UI now utilizes `navigationBarsPadding` to prevent overlap with system navigation elements on the Login, Account Selection, and generic screens. The `Account` entity has been updated to include a `serverUrl`.
2026-02-21 00:20:40 +01:00
885d95991e Edited Name and icon 2026-02-20 22:49:28 +01:00
a3ec3f16e1 Added Room 2026-02-20 22:23:22 +01:00
89c8a4b985 Started Login Process 2026-02-20 21:30:57 +01:00
534f844196 Added first datatypes 2026-02-20 21:09:43 +01:00
2f99cf1500 Initial commit 2026-02-20 20:51:05 +01:00