2024-05-08 05:03:49 -04:00
|
|
|
import 'package:flutter/foundation.dart' show immutable;
|
2025-12-22 15:04:04 +08:00
|
|
|
import 'package:hive_ce/hive.dart';
|
2024-09-17 23:19:05 -04:00
|
|
|
import 'package:vaani/features/per_book_settings/models/book_settings.dart';
|
2025-11-28 17:05:35 +08:00
|
|
|
import 'package:vaani/features/settings/models/models.dart';
|
2024-05-08 05:03:49 -04:00
|
|
|
|
|
|
|
|
@immutable
|
|
|
|
|
class AvailableHiveBoxes {
|
|
|
|
|
const AvailableHiveBoxes._();
|
|
|
|
|
|
2025-12-22 15:04:04 +08:00
|
|
|
static Future<void> init() async {
|
|
|
|
|
/// Box for storing user preferences as [AppSettings]
|
|
|
|
|
await Hive.openBox<AppSettings>('userPrefs');
|
|
|
|
|
|
|
|
|
|
/// Box for storing [ApiSettings]
|
|
|
|
|
await Hive.openBox<ApiSettings>('apiSettings');
|
|
|
|
|
|
|
|
|
|
/// stores the a list of [AudiobookShelfServer]
|
|
|
|
|
|
|
|
|
|
await Hive.openBox<AudiobookShelfServer>('audiobookShelfServer');
|
|
|
|
|
|
|
|
|
|
/// stores the a list of [AuthenticatedUser]
|
|
|
|
|
|
|
|
|
|
await Hive.openBox<AuthenticatedUser>('authenticatedUser');
|
|
|
|
|
|
|
|
|
|
/// stores the a list of [BookSettings]
|
|
|
|
|
|
|
|
|
|
await Hive.openBox<BookSettings>('bookSettings');
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-08 05:03:49 -04:00
|
|
|
/// Box for storing user preferences as [AppSettings]
|
2025-12-22 15:04:04 +08:00
|
|
|
static final userPrefsBox = Hive.box<AppSettings>('userPrefs');
|
2024-05-08 05:03:49 -04:00
|
|
|
|
|
|
|
|
/// Box for storing [ApiSettings]
|
2025-12-22 15:04:04 +08:00
|
|
|
static final apiSettingsBox = Hive.box<ApiSettings>('apiSettings');
|
2024-05-08 05:03:49 -04:00
|
|
|
|
|
|
|
|
/// stores the a list of [AudiobookShelfServer]
|
|
|
|
|
static final serverBox =
|
2025-12-22 15:04:04 +08:00
|
|
|
Hive.box<AudiobookShelfServer>('audiobookShelfServer');
|
2024-05-08 05:03:49 -04:00
|
|
|
|
|
|
|
|
/// stores the a list of [AuthenticatedUser]
|
|
|
|
|
static final authenticatedUserBox =
|
2025-12-22 15:04:04 +08:00
|
|
|
Hive.box<AuthenticatedUser>('authenticatedUser');
|
2024-09-17 23:19:05 -04:00
|
|
|
|
|
|
|
|
/// stores the a list of [BookSettings]
|
|
|
|
|
static final individualBookSettingsBox =
|
2025-12-22 15:04:04 +08:00
|
|
|
Hive.box<BookSettings>('bookSettings');
|
2024-05-08 05:03:49 -04:00
|
|
|
}
|