Description
The current implementation relies on manual JSON file I/O for data persistence. This approach is becoming difficult to maintain, lacks thread safety, and does not support complex queries or indexing.
We need to migrate the storage engine to Room (SQLite) to improve performance, data integrity, and to leverage structured data observation (Flow/LiveData).
Technical Implementation Plan
Dependency Updates
Add androidx.room dependencies to app/build.gradle.
Configure KSP (Kotlin Symbol Processing) for annotation handling.
Define the Database version (starting at 1).
Schema Definition
Convert existing JSON data models into Room @Entity classes.
Implement @Dao (Data Access Objects) for CRUD operations.
Create the @Database abstract class to provide the singleton instance.
Data Migration Logic. Create a Migration Utility to:
Read existing .json files from Internal Storage.
Map JSON objects to Room Entity objects.
Bulk insert into the new database.
Securely delete the legacy JSON files post-verification.
Repository Refactor
Update the Repository Pattern to inject the new DAO.
Replace manual file-parsing logic with Room query calls.
(Optional) Expose data as Flow for reactive UI updates.
**Description**
The current implementation relies on manual JSON file I/O for data persistence. This approach is becoming difficult to maintain, lacks thread safety, and does not support complex queries or indexing.
We need to migrate the storage engine to Room (SQLite) to improve performance, data integrity, and to leverage structured data observation (Flow/LiveData).
**Technical Implementation Plan**
1. Dependency Updates
- [ ] Add androidx.room dependencies to app/build.gradle.
- [ ] Configure KSP (Kotlin Symbol Processing) for annotation handling.
- [ ] Define the Database version (starting at 1).
2. Schema Definition
- [ ] Convert existing JSON data models into Room @Entity classes.
- [ ] Implement @Dao (Data Access Objects) for CRUD operations.
- [ ] Create the @Database abstract class to provide the singleton instance.
3. Data Migration Logic. Create a Migration Utility to:
- [ ] Read existing .json files from Internal Storage.
- [ ] Map JSON objects to Room Entity objects.
- [ ] Bulk insert into the new database.
- [ ] Securely delete the legacy JSON files post-verification.
4. Repository Refactor
- [ ] Update the Repository Pattern to inject the new DAO.
- [ ] Replace manual file-parsing logic with Room query calls.
- [ ] (Optional) Expose data as Flow<T> for reactive UI updates.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Description
The current implementation relies on manual JSON file I/O for data persistence. This approach is becoming difficult to maintain, lacks thread safety, and does not support complex queries or indexing.
We need to migrate the storage engine to Room (SQLite) to improve performance, data integrity, and to leverage structured data observation (Flow/LiveData).
Technical Implementation Plan
Add androidx.room dependencies to app/build.gradle.
Configure KSP (Kotlin Symbol Processing) for annotation handling.
Define the Database version (starting at 1).
Convert existing JSON data models into Room @Entity classes.
Implement @Dao (Data Access Objects) for CRUD operations.
Create the @Database abstract class to provide the singleton instance.
Update the Repository Pattern to inject the new DAO.
Replace manual file-parsing logic with Room query calls.
(Optional) Expose data as Flow for reactive UI updates.