Skip to content

Conversation

@Iamlooker
Copy link
Member

No description provided.

This is to make sense of some things which are not clear in fdroid index
This is to make sense of some things which are not clear in fdroid index
Remove some functions from Application class

Add a local syncable for faster testing

Remove author dao, add back in near future
This is to improve donate table, we will not be saving any values if there is no donation
This is to improve graphic table, we will not be saving any values if there is no graphics
This improves querying all performance by 2ms (-50%)

Insert is still 2 times slower than legacy
…once

TODO: Might need to add a max size to inserts in future
Window size is set to 500
This fixes both of these entity not storing and other issues with it

Version Entity is also stored for now

Still need to test integrity
Encrypt passwords in database and also store them in separate table
Trade type-safety for performance by replacing enum with int def
This should improve insertion time by a little as index is no longer needed
Separate the code of interest in insertion of index data
Use `PRAGMA synchronous = OFF` to reduce synchronosity and improve performance

Use `PRAGMA journal_mode = WAL` to improve read/write asynchronosity
Needed to rename some table columns
Signed-off-by: LooKeR <mohit2002ss@gmail.com>
This commit updates the encryption logic to correctly use the secret key and initialization vector (IV) as separate components, rather than combining them into a single `Key` object.

- The `Key` inline class now only holds the secret key bytes.
- Encryption now returns a `Pair` containing the encrypted data (`Encrypted`) and the generated IV (`ByteArray`).
- Decryption requires both the `Key` and the IV as input.
- The `AuthenticationEntity` is updated to store the encrypted password and its corresponding IV separately.
- The encryption test suite is updated to reflect these changes and includes a test for decryption with an incorrect IV.
Uncommented the `SortOrder.SIZE` case in the `context.sortOrderName` extension function for Preferences.
Modified `TabsFragment` to use a new `supportedSortOrders()` function to define the available sort options in the UI, rather than using all `SortOrder` enum entries.
Added the `SIZE` enum constant to `SortOrder.kt`.
Introduced the `supportedSortOrders()` function in `SortOrder.kt` to explicitly list the sort orders supported in the application's UI.
This commit introduces two new entities to the local database:
- `InstalledEntity`: Stores information about installed applications including version code, version name, signature, and package name.
- `AntiFeatureAppRelation`: Represents the relationship between anti-features and applications, including the tag, reason, application ID, and version code.

It also adds `InstalledEntity` and `AntiFeatureAppRelation` to the list of entities in `DroidifyDatabase` and updates the database schema accordingly.
This commit introduces a raw query mechanism in the `AppDao` to support dynamic filtering and sorting of app data.

- Replaces the static `stream()` query with a raw query approach using `SimpleSQLiteQuery`.
- Adds a new `stream()` function that accepts parameters for `sortOrder`, `searchQuery`, `repoId`, `category`, and `antiFeature`.
- Constructs the SQL query dynamically based on the provided parameters.
- Includes logic for filtering by repository ID, category (including inverse filtering), and anti-feature (including inverse filtering).
- Implements search functionality with weighted sorting based on name, summary, package name, and description.
- Supports sorting by update date, added date, size, and name.
- Adds a new `installedStream()` query to retrieve installed apps, prioritizing those with available updates.
This commit simplifies the `RepoDao` by removing the manual deletion of authentication records when a repository is deleted.

Instead, it leverages Room's `onDelete = CASCADE` functionality in the `AuthenticationEntity`'s foreign key definition. This ensures that when a `RepoEntity` is deleted, its associated `AuthenticationEntity` records are automatically removed from the database.

The `deleteRepo` and `deleteAuth` methods in `RepoDao` have been removed as they are no longer necessary. Additionally, `stream()` and `repo()` methods have been added to `RepoDao` for observing repository data.
This commit simplifies the `RepoDao` by removing the manual deletion of authentication records when a repository is deleted.

Instead, it leverages Room's `onDelete = CASCADE` functionality in the `AuthenticationEntity`'s foreign key definition. This ensures that when a `RepoEntity` is deleted, its associated `AuthenticationEntity` records are automatically removed from the database.

The `deleteRepo` and `deleteAuth` methods in `RepoDao` have been removed as they are no longer necessary. Additionally, `stream()` and `repo()` methods have been added to `RepoDao` for observing repository data.
# Conflicts:
#	app/src/main/kotlin/com/looker/droidify/data/local/model/AuthenticationEntity.kt
This commit refactors the `AppDao` to provide more flexible and robust querying options for application data.

Key changes:

- **Renamed `_rawQueryAppEntities` to `_rawStreamAppEntities`**: This clarifies the function's purpose of returning a Flow of entities.
- **Added `_rawQueryAppEntities`**: A new suspend function that directly returns a List of entities, for non-streaming use cases.
- **Introduced `query` function**: A new public suspend function that mirrors the functionality of `stream` but returns a `List<AppEntity>` instead of a `Flow`.
- **Enhanced `searchQuery` private function**:
    - Now accepts lists for `categoriesToInclude`, `categoriesToExclude`, `antiFeaturesToInclude`, and `antiFeaturesToExclude` to allow filtering by multiple criteria.
    - Uses `DISTINCT` in the SQL query to avoid duplicate app entries.
    - Corrected join condition for `category_app_relation` from `app.id = category_app_relation.appId` to `app.id = category_app_relation.id`.
    - Corrected table name for anti-features from `anti_feature_app_relation` to `anti_features_app_relation`.
    - Improved SQL query construction for category and anti-feature filtering using `IN` and `NOT IN` clauses.
    - Ensured `ORDER BY` clause is always present, even if `searchQuery` is null.
    - Prefixed table names in `ORDER BY` clause (e.g., `app.lastUpdated`) for clarity and to avoid ambiguity.
- **Updated `stream` function**: Now utilizes the refactored `searchQuery` function and passes through all new filtering parameters.
- **Updated database schema**:
    - Changed `onDelete` action for the foreign key in the `authentication` table to `CASCADE`.
- **Updated Room tests**:
    - Simplified setup by removing legacy database initialization.
    - Added tests for new sorting and category filtering functionalities in `AppDao`.
@Iamlooker Iamlooker merged commit 249df47 into main Jun 8, 2025
@Iamlooker Iamlooker deleted the room-entity branch July 16, 2025 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants