chore: integrate Hive for local storage management

- Added `hive_ce` and `hive_ce_flutter` dependencies for enhanced local storage capabilities.
- Refactored the main application to initialize Hive and migrate existing data.
- Updated storage service implementations to utilize Hive for managing application settings and task queues.
- Removed the deprecated `StorageService` class to streamline the codebase and improve maintainability.
This commit is contained in:
cogwheel0
2025-10-01 16:55:44 +05:30
parent 7d17c97d7e
commit 80129c5711
14 changed files with 723 additions and 741 deletions

View File

@@ -0,0 +1,35 @@
import 'package:hive_ce/hive.dart';
/// Logical names for Hive boxes used by the app.
final class HiveBoxNames {
static const String preferences = 'preferences_v1';
static const String caches = 'caches_v1';
static const String attachmentQueue = 'attachment_queue_v1';
static const String metadata = 'metadata_v1';
}
/// Well-known keys stored inside Hive boxes.
final class HiveStoreKeys {
// Metadata
static const String migrationVersion = 'migration_version';
// Cache entries
static const String localConversations = 'local_conversations';
static const String attachmentQueueEntries = 'attachment_queue_entries';
static const String taskQueue = 'outbound_task_queue_v1';
}
/// Grouped Hive boxes that remain open for the app lifecycle.
class HiveBoxes {
HiveBoxes({
required this.preferences,
required this.caches,
required this.attachmentQueue,
required this.metadata,
});
final Box<dynamic> preferences;
final Box<dynamic> caches;
final Box<dynamic> attachmentQueue;
final Box<dynamic> metadata;
}