mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-20 05:28:05 +02:00
Multi-IPTV : déclarer l'IPTV active de façon synchrone dans AuthedHttp
AuthedHttp lisait l'IPTV dans localStorage, écrit par un écouteur Riverpod enregistré tardivement : après un changement d'IPTV l'en-tête X-Playlist-Id pouvait rester périmé. AuthedHttp.usePlaylist pose l'IPTV en mémoire dès la sélection et à chaque construction du tableau de bord. Auto NBA reçoit la playlist, recharge sa règle quand elle change et nomme l'IPTV sur laquelle les matchs sont enregistrés. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a6322b57b8
commit
6368fd6ee2
6 files changed
+58
-7
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../auth/providers/auth_provider.dart';
|
||||
import '../../../core/api/authed_http.dart';
|
||||
import '../../../core/models/playlist_config.dart';
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/widgets/glass_container.dart';
|
||||
@@ -43,6 +44,8 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Toutes les requêtes /api/* de ce tableau de bord visent cette IPTV.
|
||||
AuthedHttp.usePlaylist(widget.playlist.id, json: widget.playlist.toJson());
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.background,
|
||||
body: Stack(
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../../core/services/playlist_api_service.dart';
|
||||
import '../../../core/api/authed_http.dart';
|
||||
import '../../../core/models/playlist_config.dart';
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
@@ -163,6 +164,10 @@ class PlaylistSelectionScreen extends ConsumerWidget {
|
||||
child: _PlaylistCard(
|
||||
playlist: playlist,
|
||||
onTap: () {
|
||||
AuthedHttp.usePlaylist(
|
||||
playlist.id,
|
||||
json: playlist.toJson(),
|
||||
);
|
||||
selectPlaylist(ref, playlist);
|
||||
context.go('/dashboard');
|
||||
},
|
||||
|
||||
@@ -52,6 +52,8 @@ class _RecordingsTabState extends State<RecordingsTab>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Guide, enregistrements, season passes et Auto NBA visent cette IPTV.
|
||||
AuthedHttp.usePlaylist(widget.playlist.id);
|
||||
return Container(
|
||||
color: Colors.black,
|
||||
child: Column(
|
||||
@@ -112,7 +114,7 @@ class _RecordingsTabState extends State<RecordingsTab>
|
||||
_EpgGuideView(playlist: widget.playlist),
|
||||
_RecordingsListView(playlist: widget.playlist),
|
||||
const _SeasonPassesView(),
|
||||
const _AutoNbaView(),
|
||||
_AutoNbaView(playlist: widget.playlist),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -1752,7 +1754,9 @@ const _mois = [
|
||||
];
|
||||
|
||||
class _AutoNbaView extends StatefulWidget {
|
||||
const _AutoNbaView();
|
||||
/// IPTV dont la règle est affichée et qui capture les matchs choisis.
|
||||
final PlaylistConfig playlist;
|
||||
const _AutoNbaView({required this.playlist});
|
||||
@override
|
||||
State<_AutoNbaView> createState() => _AutoNbaViewState();
|
||||
}
|
||||
@@ -1773,6 +1777,21 @@ class _AutoNbaViewState extends State<_AutoNbaView> {
|
||||
_load();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant _AutoNbaView oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
// Autre IPTV : autre règle, autres matchs choisis.
|
||||
if (oldWidget.playlist.id != widget.playlist.id) {
|
||||
AuthedHttp.usePlaylist(widget.playlist.id);
|
||||
setState(() {
|
||||
_rule = null;
|
||||
_games = [];
|
||||
_diag = null;
|
||||
});
|
||||
_load();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _load() async {
|
||||
setState(() {
|
||||
_isLoading = _rule == null;
|
||||
@@ -2427,7 +2446,8 @@ class _AutoNbaViewState extends State<_AutoNbaView> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Matchs NBA en direct sur beIN Sports FR',
|
||||
'Matchs NBA en direct sur beIN Sports FR · '
|
||||
'enregistrés sur « ${widget.playlist.name} »',
|
||||
style: GoogleFonts.fraunces(
|
||||
color: AppColors.onSurface54,
|
||||
fontSize: 13,
|
||||
|
||||
Reference in new issue
Block a user