Commit Graph

11 Commits

Author SHA1 Message Date
natreex
e1abcd9490 Add offline mode logic for chapter operations and refactor IPC handlers
- Integrate `OfflineContext` into `TextEditor` and `ScribeChapterComponent` to handle offline scenarios for chapter CRUD operations.
- Add conditional logic to switch between server API requests and offline IPC handlers (`db:chapter:add`, `db:chapter:remove`, `db:chapter:content:save`, `db:chapter:update`).
- Refactor and rename IPC handlers (`db:chapter:create` to `db:chapter:add`, `db:chapter:delete` to `db:chapter:remove`) for consistency.
- Update UI to disable certain actions when offline (e.g., GhostWriter button).
2025-11-26 22:03:22 -05:00
natreex
9648d9e9be Upgrade database schema to version 2 and remove unused meta_* columns
- Increment `SCHEMA_VERSION` to 2 in `schema.ts`.
- Remove all `meta_*` columns from database tables.
- Add migration logic to handle schema upgrades and clean up unused columns.
- Modify database models and repository methods to exclude `meta_*` fields for stricter typings and improved structure.
- Refactor and optimize query statements across repositories to align with new schema changes.
2025-11-26 19:17:40 -05:00
natreex
ac95e00127 Integrate offline support and improve error handling across app
- Add `OfflineContext` to manage offline state and interactions within components.
- Refactor session logic in `ScribeControllerBar` and `page.tsx` to handle offline scenarios (e.g., check connectivity before enabling GPT features).
- Enhance offline PIN setup and verification with better flow and error messaging.
- Optimize database IPC handlers to initialize and sync data in offline mode.
- Refactor code to clean up redundant logs and ensure stricter typings.
- Improve consistency and structure in handling online and offline operations for smoother user experience.
2025-11-26 15:25:53 -05:00
natreex
9e51cc93a8 Remove SyncService and introduce context-based offline mode and state management
- Delete `SyncService` and its associated bidirectional synchronization logic.
- Add multiple context providers (`OfflineProvider`, `AlertProvider`, `LangContext`, `UserContext`, `SessionContext`, `WorldContext`, `SettingBookContext`) for contextual state management.
- Implement `SecureStorage` for OS-level secure data encryption and replace dependency on `SyncService` synchronization.
- Update localization files (`en.json`, `fr.json`) with offline mode and error-related strings.
2025-11-19 22:01:24 -05:00
natreex
71d13e2b12 Refactor IPC handlers to enforce consistent return types and enhance type definitions
- Update return types for IPC handlers in `character.ipc.ts`, `chapter.ipc.ts`, and `location.ipc.ts` for stricter type safety.
- Introduce new type definitions for better structure and clarity.
- Remove redundant console logs and unnecessary comments for cleaner code.
2025-11-18 23:01:52 -05:00
natreex
b56f45d1ba Add ipc/character.ipc.ts and ipc/location.ipc.ts for character and location database interactions
- Introduce IPC handlers in `ipc/character.ipc.ts` and `ipc/location.ipc.ts` for CRUD operations, attributes management, and related actions.
- Register character and location IPC modules in `main.ts` for global accessibility.
- Utilize `createHandler` pattern for consistent and modular IPC handler implementation.
- Enhance type definitions for character and location functionalities, improving code consistency.
2025-11-18 22:47:20 -05:00
natreex
75e5d71c74 Add ipc/chapter.ipc.ts to handle chapter-related database interactions
- Introduce IPC handlers in `ipc/chapter.ipc.ts` for chapter CRUD, content management, and related operations.
- Register chapter IPC module in `main.ts` for application-wide access.
- Enhance type definitions for chapter functionalities, improving code consistency.
- Refactor `ipc/book.ipc.ts` to include new `UpdateStoryData` interface and additional story update handler.
2025-11-18 22:42:18 -05:00
natreex
361a1b0b7c Refactor ipc/book.ipc.ts for streamlined IPC handlers and additional type definitions
- Reorganize and reformat IPC handlers for improved readability and structure.
- Add missing type definitions for `StoryData`, `AddWorldElementData`, `SetAIGuideLineData`, and others.
- Simplify handler functions by enforcing consistent parameter usage and return types.
- Remove outdated comments, redundant logic, and placeholder TODOs.
2025-11-18 22:26:59 -05:00
natreex
0bafaadecc Add user data synchronization and database IPC handlers
- Introduce `db:user:sync` to synchronize user data with the local database during initialization.
- Add `db:user:info` and `db:user:update` IPC handlers for fetching and updating user information.
- Update `User` model and repository to support extended user fields and improved structure.
- Dynamically import user models in main process to avoid circular dependencies.
- Refactor database initialization in the app to include user sync logic with error handling.
2025-11-18 22:17:22 -05:00
natreex
d018e75be4 Remove DataService and OfflineDataService, refactor book and character operations to use streamlined handlers in LocalSystem
- Delete `data.service.ts` and `offline-data.service.ts`, consolidating functionality into `LocalSystem`.
- Refactor book, character, and conversation operations to adopt unified, multilingual, and session-enabled IPC handlers in `LocalSystem`.
- Simplify redundant legacy methods, enhancing maintainability and consistency.
2025-11-18 21:02:38 -05:00
natreex
d46aecc80d Integrate session management, multilingual IPC handlers, and Book database operations
- Add `LocalSystem` with handlers for session retrieval (`userId`, `lang`) and error handling.
- Extend IPC handlers to support multilingual operations (`fr`, `en`) and session data injection
2025-11-18 19:51:17 -05:00