-
Notifications
You must be signed in to change notification settings - Fork 145
Refactor/compose #1143
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
Draft
Iamlooker
wants to merge
111
commits into
main
Choose a base branch
from
refactor/compose
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Refactor/compose #1143
Conversation
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
Signed-off-by: LooKeR <[email protected]>
- Deleted unused `DroidifyDatabase` JSON schema. - Cleaned up legacy file to reduce repository clutter. Signed-off-by: LooKeR <[email protected]>
This commit introduces the concrete implementations for `RepoRepository` and `AppRepository`. **RepoRepositoryImpl:** - Manages repository data, including fetching individual repos, all repos, and their mirrors. - Handles enabling/disabling repositories by updating `SettingsRepository`. - `sync` and `syncAll` methods are currently placeholders. **AppRepositoryImpl:** - Manages application data. - Fetches apps by package name and author. - Retrieves packages associated with an app. - Allows adding/removing apps from favourites by interacting with `SettingsRepository`. - Utilizes the locale from `SettingsRepository` for localized data. **Data Model Updates:** - `AppEntity` now has `toMetadata` and `toApp` extension functions for converting to domain models, incorporating locale. - `ScreenshotEntity`'s `toScreenshots` function now accepts a locale parameter. - `VersionEntity`'s `toPackages` function now accepts a locale parameter. - `GraphicEntity`'s `toGraphics` function now accepts a locale parameter. - `Settings` data class now includes `enabledRepoIds`. **DAO and Datastore Updates:** - `RepoDao` now includes a `mirrors` function to fetch mirrors for a specific repository. - `PreferenceSettingsRepository` now includes methods for managing enabled repository IDs (`setRepoEnabled`, `getEnabledRepoIds`, `isRepoEnabled`) and persists them in DataStore. - `SettingsRepository` interface is updated to include methods for managing enabled repository IDs. **Domain Layer Adjustments:** - `AppRepository` interface no longer includes `getApps()` (likely replaced or handled by other methods). - `App` domain model fields (`links`, `screenshots`, `graphics`, `donation`, `packages`) are now nullable to better reflect potential missing data. Signed-off-by: LooKeR <[email protected]>
- Renamed `RepoRepositoryImpl` and `AppRepositoryImpl` to `LocalRepoRepository` and `LocalAppRepository` respectively for clarity. - Added Hilt modules for injecting these repository implementations (`RepoBinding`). - Enhanced `sync` methods in `V1Syncable` and `EntrySyncable` to handle empty index files. - Introduced `apps` stream with filtering and sorting capabilities in `AppRepository`. - Updated DAO and model layers to support minimal app listing with suggested versions. - Improved modularization by moving repository classes to data package. Signed-off-by: LooKeR <[email protected]>
- Integrated authentication support in `RepoRepository` with username/password handling. - Added `insertRepo` method for saving repos alongside encrypted authentication data. - Updated `AuthenticationEntity` to include decryption with `Key`. - Refined `toRepo` to pass authentication details to domain model. - Enhanced test cases to align with encryption changes. Signed-off-by: LooKeR <[email protected]>
- Updated imports across the app to use `com.looker.droidify.data.model` instead of `com.looker.droidify.domain.model`. - Moved all domain models (`Fingerprint`, `Repo`, `PackageName`, etc.) to `data.model` package. - Refined affected extension functions and test cases to align with new model locations. - Removed unused `@OptIn(ExperimentalEncodingApi::class)` annotation in `AesEncryption`. Signed-off-by: LooKeR <[email protected]>
- Removed the obsolete `RBLogAPI` class and its dependencies. - Refactored `RBLogWorker` to use `Downloader` and a temporary file for log fetching and parsing. - Introduced a new `RBData` serialization class and updated related mapping logic. - Simplified `PrivacyRepository` by modifying the `upsertRBLogs` method to take a list of `RBLogEntity`. - Updated `RBLogDao` to replace varargs with bulk operations for consistency. - Enhanced `NetworkModule` by removing unused `RBLogAPI` provisioning. - Added `tempFile` utility for managing temporary files during log processing. - Streamlined and updated associated components to align with the new backend approach. Signed-off-by: LooKeR <[email protected]>
This commit introduces a new file `docs/tasks.md` which outlines a prioritized list of actionable improvement tasks for the Droid-ify project. The tasks cover areas such as: - Architecture Improvements (Database Migration, Clean Architecture, Sync System) - UI Improvements (Jetpack Compose Migration, Navigation Enhancement) - Performance Improvements (App Startup, Download/Installation) - Code Quality Improvements (Testing, Static Analysis) - Security Improvements (Data Protection, APK Verification) - Feature Improvements (Repository Management, App Management) - Documentation Improvements (Code Documentation, User Documentation) - Technical Debt Reduction (Dependency Management, Code Cleanup) The `STATUS.md` file, which previously provided a project status update, has been removed as its content is now superseded by the more comprehensive task list and ongoing development. Signed-off-by: LooKeR <[email protected]>
- Introduced `requirements.md` to outline functional and non-functional requirements. - Covered key areas including repository management, app management, privacy features, performance, security, usability, compatibility, and technical standards. - Provided a detailed overview of expected behavior, architectural principles, and code quality expectations for the Droid-ify project. Signed-off-by: LooKeR <[email protected]>
- Introduced detailed `plan.md` outlining the improvement roadmap for the Droid-ify project. - Covered areas including architecture modernization, UI migration to Jetpack Compose, performance optimization, security enhancements, advanced features, and documentation updates. - Provided rationale, actionable steps, and a timeline divided into short, medium, and long-term priorities. - Emphasized incremental implementation and continuous delivery for stability. Signed-off-by: LooKeR <[email protected]>
…talled apps - Introduced `InstalledDao` with methods for streaming, fetching, inserting, updating, and deleting installed app records. - Added `InstalledEntity` to represent installed app data, with updated schema including `version`, `versionCode`, and `signature`. - Implemented extension functions to convert between `InstalledItem` domain model and `InstalledEntity`. - Updated `DroidifyDatabase` to include `installedDao` integration. - Marked database migration to Room as complete in `docs/tasks.md`. Signed-off-by: LooKeR <[email protected]>
- Introduced `BaseDatabaseTest` to provide a foundation for Room database testing with Robolectric and test dispatchers. - Added `InstalledDaoTest` with test cases for CRUD operations, streaming data, and handling edge cases. - Updated schema for `DroidifyDatabase` with adjustments to `installed` and `rblog` tables. - Marked completion of database testing tasks in `docs/tasks.md`. - Included new test dependencies in `gradle/libs.versions.toml` and `app/build.gradle.kts`. Signed-off-by: LooKeR <[email protected]>
- Introduced `InstalledRepository` interface to standardize handling of installed apps. - Implemented `LocalInstalledRepository` with Room database integration for CRUD operations and streaming data. - Updated `InstalledAppReceiver`, `AppDetailViewModel`, and `SyncService` to use `InstalledRepository` for app management. - Replaced all usages of `InstalledAdapter` with `InstalledRepository`, removing deprecated logic. - Added Hilt binding for `InstalledRepository` in `RepoBinding` module. - Updated `docs/tasks.md` to mark removal of legacy database classes as completed. Signed-off-by: LooKeR <[email protected]>
- Replaced references to legacy architecture with descriptions of the new Room-based implementation. - Updated structure and components under `data/local/`, including DAOs, entities, and converters. - Documented database initialization with performance optimizations (e.g., `PRAGMA` settings). - Marked the legacy database as replaced and removed outdated references. - Completed the task to reflect these documentation updates in `docs/tasks.md`. Signed-off-by: LooKeR <[email protected]>
- Removed Clean Architecture implementation tasks from `docs/tasks.md`. - Updated the `docs/plan.md` to state no changes for Clean Architecture for now, while retaining rationale for maintainability and adaptability. - Simplified documentation to reflect current project priorities. Signed-off-by: LooKeR <[email protected]>
- Added documentation to `RepoEntity` explaining the `enabled` flag's storage and update logic. - Stated that the `deleted` flag is unnecessary due to data cleanup when repos are deleted or disabled. Signed-off-by: LooKeR <[email protected]>
…al sync - Updated `docs/tasks.md` to indicate completion of Index V2 implementation. - Marked incremental sync for improved performance as completed. Signed-off-by: LooKeR <[email protected]>
Signed-off-by: LooKeR <[email protected]>
- Introduced `SyncIntegrationTest` to verify compatibility and migration between V1 and V2 implementations. - Covered tests for V1-to-V2 conversion, data consistency across implementations, and incremental sync functionality. - Ensured tests validate real-world scenarios, including package data consistency and incremental changes. - Updated `docs/tasks.md` to mark the completion of comprehensive testing tasks for V1 and V2 implementations. Signed-off-by: LooKeR <[email protected]>
- Migrated to Jetpack Compose with Material 3 design system implementation. - Introduced `AppDetailScreen`, `HomeScreen`, and `RepositoryScreen` as placeholders for redesigned UI. - Added reusable Compose components, including custom buttons in `Buttons.kt`. - Implemented a dynamic theming system supporting light, dark, and AMOLED modes in `Theme.kt`. - Updated dependencies in `gradle/libs.versions.toml` and `app/build.gradle.kts` to include Compose libraries. - Marked tasks for Jetpack Compose migration and design system creation as completed in `docs/tasks.md`. Signed-off-by: LooKeR <[email protected]>
…efinitions - Removed deprecated button components from `Buttons.kt`. - Centralized typographic definitions in new `Type.kt`. - Introduced expanded color schemes in `Color.kt`, supporting various contrast levels. - Refactored `Theme.kt` to utilize dynamic, high, medium, and default contrast themes, with dynamic color support. - Applied consistent naming for build types in `build.gradle.kts` with a new helper function. Signed-off-by: LooKeR <[email protected]>
- Introduced `FilePath` value class to represent file paths, improving type safety and URL construction for app icons, graphics, and screenshots. - Updated `App`, `AppMinimal`, `Graphics`, `Metadata`, and `Screenshots` data classes to use `FilePath` for icon and image URLs. - Added `@Immutable` annotation to various data model classes for Compose stability. - Modified `LocalRepoRepository` to use `Int` for repository IDs and updated methods for fetching and deleting repositories. `getRepos()` is now a `Flow` property named `repos`. - Refactored `LocalAppRepository`'s `apps` function to be a suspend function returning `List<AppMinimal>` and added a `categories` flow. - Optimized `AppDao` queries for fetching apps by conditionally joining tables based on filter parameters. - Updated `RepoDao` to support fetching a single repository by ID as a suspend function and added methods to retrieve categories. - Enhanced `IndexDao`'s `upsertRepo` to correctly return the ID of the updated or inserted repository. - Added `webBaseUrl` to `RepoEntity` and `RepoV2` to store the base URL for web resources. - Adjusted `AndroidManifest.xml` to set `allowBackup` to `false` and updated the main activity to `MainComposeActivity`. - Removed `RepositoryScreen.kt` as it's no longer used. - Bumped Kotlin JVM toolchain to 17 in `app/build.gradle.kts`. - Added `coil-compose` dependency. Signed-off-by: LooKeR <[email protected]>
- Introduced `AppListScreen` and `AppListViewModel` to display a filterable and searchable list of applications. - Implemented app item display with icon, name, summary, and version information. - Added category filtering and a search bar to `AppListScreen`. - Created `RepoListScreen` and `RepoListViewModel` for managing repositories. - Implemented repository item display with icon, name, description, and an enable/disable toggle. - Added `MainComposeActivity` to host the new Compose screens and initialize default repositories if none exist. Signed-off-by: LooKeR <[email protected]>
…functions - Moved `AppDetailScreen.kt` from `screens/appdetail` to `compose/appDetail`. - Moved `HomeScreen.kt` from `screens/home` to `compose/home`. - Created new placeholder files `SettingScreen.kt` in `compose/settings` and `RepoDetailScreen.kt` in `compose/repoDetail`. - Added `logQuery` function in `LogQueries.kt` for debugging Room queries. - Modified `tempFile` extension function in `File.kt` to ensure file deletion in a finally block and to return a generic type `T`. Signed-off-by: LooKeR <[email protected]>
- Implemented navigation between `AppListScreen`, `AppDetailScreen`, `RepoListScreen`, `RepoDetailScreen`, `RepoEditScreen`, and `SettingsScreen` using Jetpack Navigation Compose. - Defined serializable route objects and helper functions for navigating to each screen. - Updated `MainComposeActivity` to use `NavHost` for managing navigation. - Modified `AppListScreen` and `RepoListScreen` to handle item clicks and navigate to detail screens. - Added `packageName` to `AppMinimal` and updated `AppEntity.toAppMinimal` to include it. - Removed unused `compose.ui.test.junit4` dependency. Signed-off-by: LooKeR <[email protected]>
- Introduced `RepoEditScreen.kt` for adding and editing repository details. - Added `RepoEditViewModel.kt` to manage UI state, validation, and repository saving logic. - Implemented input fields for address, fingerprint, username, and password with real-time validation. - Added functionality to check repository reachability before saving. - Included an option to skip the repository check. - Displayed a loading indicator during repository checks. - Integrated `RepoEditScreen` into the navigation graph in `RepoEditNavigation.kt` and `MainComposeActivity.kt`. - Updated `LocalRepoRepository.kt` and `RepoRepository.kt` to include a method for observing a single repository by ID. Signed-off-by: LooKeR <[email protected]>
- Introduced `RepoDetailScreen` to display repository information and allow actions like enabling/disabling, editing, and deleting. - Created `RepoDetailViewModel` to manage UI state, handle repository operations (enable, delete), and bind/unbind `SyncService`. - Added `LastUpdatedCard` to display the last synced timestamp with relative date formatting. - Implemented `UnsyncedRepoState` to provide UI for repositories that haven't been synced or enabled. - Made `timestamp` nullable in `RepoEntity` and `Repo` to reflect unsynced state, updating database schema and related logic. - Updated `LocalRepoRepository` to handle nullable timestamps and combine with enabled state from settings. - Adjusted `IndexDownloader` and `EntrySyncable` to correctly handle potentially null `versionInfo` or `timestamp`. - Added new string resources for repository states and actions. - Included `ic_sync_disabled.xml` drawable. - Refined navigation for `RepoDetailScreen`. Signed-off-by: LooKeR <[email protected]>
…ation - Introduced `RepoEditErrorState` to centralize all error states for the repository editing screen. - Replaced individual error `StateFlow`s (`addressError`, `fingerprintError`, `usernamePasswordError`) with a single `errorState` `StateFlow` in `RepoEditViewModel`. - `isFormValid` in `RepoEditScreen` is now a `derivedStateOf` based on `errorState.hasError`. - Validation logic for address, fingerprint, username, and password fields in `RepoEditViewModel` now returns error strings directly instead of updating separate `MutableStateFlow`s. - `RepoEditScreen` now uses `derivedStateOf` to determine if specific fields have errors, improving Compose performance. - Simplified address uniqueness check by fetching all repository and mirror addresses directly from `RepoRepository` via a new `addresses` Flow. - Added `addresses` Flow to `RepoRepository` and corresponding `mirrors()` Flow to `RepoDao` to provide a stream of all known repository and mirror URLs. - Refactored `stripPathSuffix` in `RepoEditViewModel` for clarity and correctness. - Removed unused `encodeCredentials` and path manipulation extension properties from `RepoEditViewModel`. Signed-off-by: LooKeR <[email protected]>
- Introduced `EncryptionStorage` to manage the lifecycle of encryption keys using DataStore. - Integrated `EncryptionStorage` into `LocalRepoRepository` to retrieve encryption keys for authenticating repository access. - Encryption keys are now generated and stored if not already present, ensuring secure data handling. - Modified `LocalRepoRepository` to use a flow of `Key` from `EncryptionStorage` for dynamic key updates. - Added `EncryptionStorage` to the Dagger Hilt dependency graph in `DatastoreModule.kt`. Signed-off-by: LooKeR <[email protected]>
Fix: Handle nullable VersionInfo in EntrySyncableTest
This commit updates the following dependencies to their latest versions: - Kotlin from 2.2.20 to 2.2.21 - Jackson from 2.20.0 to 2.20.1 - Room from 2.8.2 to 2.8.3 - Compose BOM from 2025.10.00 to 2025.10.01
This commit adds `style` and `linkStyle` parameters to the `toAnnotatedString` function. This allows callers to provide custom `SpanStyle`s for the main text and for hyperlinks when converting HTML to an `AnnotatedString`.
Refactor the `insertIndex` function to perform database insertions and updates in batches instead of iterating and executing one by one. This improves performance by reducing the number of individual database transactions. Key changes include: - Processing authors, apps, versions, and other entities in lists. - Using new batch insert/upsert methods (`insertApps`, `upsertApps`, `insertLinks`, etc.). - Introducing `appIdsByPackageNames` to fetch existing apps in a single query. - Grouping repository-specific data insertions into a new `insertRepoScopeData` transaction.
This commit refactors the `Syncable` interface to use a callback block for reporting sync progress instead of a direct return value. The `sync` function in the `Syncable` interface now takes a `block: (SyncState) -> Unit` parameter to emit different states of the synchronization process, such as download, parsing, and completion statuses. A new `SyncState` sealed interface has been introduced to represent the various stages and outcomes (Success/Failure) of the sync lifecycle. This provides a more detailed and observable mechanism for callers to track sync progress and handle results or errors. The implementations of `Syncable` (`V1Syncable`, `EntrySyncable`, `LocalSyncable`) and their consumers (`RepoRepository`, tests) have been updated to adopt this new state-based callback approach.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Staling till motivation is back