feat: add XtreamServiceMobile for Xtream Codes API communication with caching and DNS resolution for mobile.

This commit is contained in:
Michael committed 2025-12-26 22:32:01 +01:00
1 parent 80320d0eae
commit 5dd83019d3
8 files changed
+107 -177

No files matched your search

+7 -2
View File
@@ -20,8 +20,13 @@ class HiveService {
await Hive.initFlutter();
// Register adapters
Hive.registerAdapter(AppUserAdapter());
Hive.registerAdapter(PlaylistConfigAdapter());
// Register adapters
if (!Hive.isAdapterRegistered(0)) {
Hive.registerAdapter(AppUserAdapter());
}
if (!Hive.isAdapterRegistered(1)) {
Hive.registerAdapter(PlaylistConfigAdapter());
}
// Open boxes WITHOUT encryption on Web
// Note: On Web, IndexedDB is already isolated by origin,
+4 -3
View File
@@ -7,9 +7,7 @@ class PlaylistApiService {
/// Get all playlists for current user
Future<List<PlaylistConfig>> getPlaylists() async {
try {
if (!HiveService.playlistsBox.isOpen) {
await HiveService.init();
}
await HiveService.init();
return HiveService.playlistsBox.values.toList();
} catch (e) {
print('Error fetching playlists from Hive: $e');
@@ -25,6 +23,7 @@ class PlaylistApiService {
required String password,
}) async {
try {
await HiveService.init();
final id = const Uuid().v4();
final playlist = PlaylistConfig(
id: id,
@@ -52,6 +51,7 @@ class PlaylistApiService {
required String password,
}) async {
try {
await HiveService.init();
if (!HiveService.playlistsBox.containsKey(id)) {
return null;
}
@@ -79,6 +79,7 @@ class PlaylistApiService {
/// Delete a playlist
Future<bool> deletePlaylist(String id) async {
try {
await HiveService.init();
await HiveService.playlistsBox.delete(id);
return true;
} catch (e) {