mirror of
https://github.com/R0m1k3/xtremobile.git
synced 2026-10-11 17:29:26 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
462bcc784c | ||
|
|
60c7f4cece | ||
|
|
9ce707a702 | ||
|
|
f105becd79 | ||
|
|
93d5741c0c | ||
|
|
2e88a56943 | ||
|
|
26bf240b76 | ||
|
|
186f9f89f9 | ||
|
|
3c37c6a6e6 | ||
|
|
c096532fec |
No files matched your search
@@ -37,6 +37,30 @@ jobs:
|
||||
|
||||
- run: flutter pub get
|
||||
|
||||
# Keystore fixe injecté via secrets : sans lui, Gradle signerait avec une
|
||||
# clé debug générée sur le runner (différente à chaque build) et l'APK ne
|
||||
# s'installerait pas par-dessus une version déjà présente sur l'appareil.
|
||||
- name: Set up release signing
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
||||
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
||||
run: |
|
||||
for v in KEYSTORE_BASE64 KEYSTORE_PASSWORD KEY_ALIAS KEY_PASSWORD; do
|
||||
if [ -z "${!v}" ]; then
|
||||
echo "::error::Secret ANDROID_$v manquant — impossible de signer l'APK avec une clé stable."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "$KEYSTORE_BASE64" | base64 -d > android/app/release.jks
|
||||
{
|
||||
echo "storeFile=release.jks"
|
||||
echo "storePassword=$KEYSTORE_PASSWORD"
|
||||
echo "keyAlias=$KEY_ALIAS"
|
||||
echo "keyPassword=$KEY_PASSWORD"
|
||||
} > android/key.properties
|
||||
|
||||
- name: Build release APK
|
||||
run: flutter build apk --release
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
# Construit un IPA *non signé* pour iPhone / iPad et le publie sur la GitHub
|
||||
# Release de la version courante, à côté de l'APK Android.
|
||||
#
|
||||
# L'IPA n'est volontairement pas signé : la signature est faite au moment de
|
||||
# l'installation par AltStore / SideStore / Sideloadly avec l'Apple ID de
|
||||
# l'utilisateur (voir IOS_GUIDE.md). Aucun compte développeur n'est donc
|
||||
# nécessaire pour produire ce fichier.
|
||||
#
|
||||
# Le job tourne sur un runner macOS (Xcode obligatoire) et consomme 10x plus
|
||||
# de minutes GitHub Actions qu'un runner Linux : il n'est donc pas déclenché
|
||||
# sur les pull requests.
|
||||
name: Build iOS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
# Un run macOS coûte 10x en minutes : inutile d'en lancer un pour une
|
||||
# modification qui ne touche que de la documentation.
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: stable
|
||||
flutter-version: 3.35.3
|
||||
cache: true
|
||||
|
||||
- name: Read app version from pubspec.yaml
|
||||
id: version
|
||||
run: echo "version=$(grep '^version:' pubspec.yaml | awk '{print $2}' | cut -d+ -f1)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- run: flutter pub get
|
||||
|
||||
# Régénère ios/ (absent du dépôt) et applique les réglages IPTV :
|
||||
# ATS, audio en arrière-plan, orientations iPad, bundle id.
|
||||
- name: Prepare iOS project
|
||||
run: ./scripts/prepare_ios.sh
|
||||
|
||||
- name: Generate iOS app icon
|
||||
run: dart run flutter_launcher_icons -f flutter_launcher_icons-ios.yaml
|
||||
|
||||
- name: Build release app (unsigned)
|
||||
run: flutter build ios --release --no-codesign
|
||||
|
||||
# Un IPA n'est qu'une archive zip contenant Payload/<App>.app.
|
||||
- name: Package unsigned IPA
|
||||
env:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
cd build/ios/iphoneos
|
||||
rm -rf Payload
|
||||
mkdir Payload
|
||||
cp -R Runner.app Payload/
|
||||
zip -qry "$GITHUB_WORKSPACE/xtremobile-v${VERSION}-unsigned.ipa" Payload
|
||||
|
||||
- name: Upload IPA artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: xtremobile-v${{ steps.version.outputs.version }}-ipa
|
||||
path: xtremobile-v${{ steps.version.outputs.version }}-unsigned.ipa
|
||||
|
||||
# Même tag que le workflow APK : l'IPA est ajouté à la release existante.
|
||||
- name: Publish GitHub Release
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ steps.version.outputs.version }}
|
||||
name: XtremMobile v${{ steps.version.outputs.version }}
|
||||
files: xtremobile-v${{ steps.version.outputs.version }}-unsigned.ipa
|
||||
# Les notes sont déjà produites par le workflow APK ; les régénérer
|
||||
# ici les ajouterait une seconde fois au corps de la release.
|
||||
generate_release_notes: false
|
||||
+13
@@ -32,6 +32,19 @@ migrate_working_dir/
|
||||
|
||||
# Web related
|
||||
|
||||
# iOS related (le projet Xcode est régénéré par scripts/prepare_ios.sh)
|
||||
**/ios/Flutter/App.framework
|
||||
**/ios/Flutter/Flutter.framework
|
||||
**/ios/Flutter/Flutter.podspec
|
||||
**/ios/Flutter/Generated.xcconfig
|
||||
**/ios/Flutter/ephemeral/
|
||||
**/ios/Flutter/flutter_export_environment.sh
|
||||
**/ios/Runner/GeneratedPluginRegistrant.*
|
||||
**/ios/Pods/
|
||||
**/ios/Podfile.lock
|
||||
**/ios/.symlinks/
|
||||
*.ipa
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
# Version iPhone / iPad — build et installation hors App Store
|
||||
|
||||
Ce guide explique comment produire XtremFlow pour iOS/iPadOS et l'installer sur
|
||||
un appareil **sans passer par l'App Store**.
|
||||
|
||||
---
|
||||
|
||||
## 1. Ce qui a été mis en place
|
||||
|
||||
Le dossier `ios/` n'est pas versionné : il est **régénéré au moment du build**
|
||||
par `scripts/prepare_ios.sh`, ce qui garantit qu'il correspond toujours à la
|
||||
version de Flutter utilisée. Le script applique ensuite les réglages
|
||||
indispensables à une app IPTV :
|
||||
|
||||
| Réglage | Pourquoi |
|
||||
|---|---|
|
||||
| `NSAllowsArbitraryLoads` | Les serveurs Xtream Codes sont presque toujours en `http://`. Sans cette exception, App Transport Security bloque **toutes** les requêtes API et tous les flux. |
|
||||
| `UIBackgroundModes: audio` | Le son continue quand l'écran est verrouillé. |
|
||||
| Orientations paysage + 4 sens sur iPad | Lecteur vidéo plein écran, rotation libre sur tablette. |
|
||||
| `NSLocalNetworkUsageDescription` | Autorisation iOS 14+ si le serveur IPTV est sur le réseau local. |
|
||||
| Cible iOS 13.0 | Minimum exigé par `media_kit` (libmpv/FFmpeg). |
|
||||
| Bundle id `com.xtremflow.mobile` | Aligné sur l'`applicationId` Android. |
|
||||
|
||||
Le code Dart est déjà entièrement portable (aucun appel spécifique Android), et
|
||||
`media_kit_libs_video` embarque déjà la variante iOS de libmpv : les codecs
|
||||
AC3 / EAC3 / DTS restent donc gérés comme sur Android.
|
||||
|
||||
## 2. Produire l'IPA
|
||||
|
||||
### Option A — GitHub Actions (aucun Mac nécessaire) ✅ recommandé
|
||||
|
||||
Le workflow `.github/workflows/build-ios.yml` tourne sur un runner macOS et
|
||||
publie un **IPA non signé** :
|
||||
|
||||
* automatiquement à chaque push sur `main`, joint à la GitHub Release de la
|
||||
version (à côté de l'APK) ;
|
||||
* à la demande via **Actions → Build iOS → Run workflow**, le fichier est alors
|
||||
disponible en artifact.
|
||||
|
||||
> ⚠️ Les runners macOS comptent **10× plus** de minutes GitHub Actions que les
|
||||
> runners Linux. C'est pourquoi le workflow ne se déclenche pas sur les pull
|
||||
> requests.
|
||||
|
||||
### Option B — En local, sur un Mac
|
||||
|
||||
```bash
|
||||
flutter pub get
|
||||
./scripts/prepare_ios.sh
|
||||
dart run flutter_launcher_icons -f flutter_launcher_icons-ios.yaml
|
||||
flutter build ios --release --no-codesign
|
||||
|
||||
cd build/ios/iphoneos
|
||||
mkdir -p Payload && cp -R Runner.app Payload/
|
||||
zip -qry ../../../xtremflow-unsigned.ipa Payload
|
||||
```
|
||||
|
||||
Un IPA n'est rien d'autre qu'une archive zip contenant `Payload/Runner.app`.
|
||||
|
||||
## 3. Installer sans l'App Store
|
||||
|
||||
C'est ici que se situe la vraie contrainte : elle ne vient pas du code mais
|
||||
d'Apple. Toute app iOS doit être **signée** par un certificat Apple avant de
|
||||
pouvoir se lancer. Quatre voies possibles :
|
||||
|
||||
| Méthode | Coût | Validité | Matériel requis |
|
||||
|---|---|---|---|
|
||||
| **AltStore / SideStore** (Apple ID gratuit) | 0 € | **7 jours**, renouvelés automatiquement en Wi-Fi | Un PC/Mac pour l'installation initiale |
|
||||
| **Sideloadly** (Apple ID gratuit) | 0 € | 7 jours, renouvellement manuel | Windows ou macOS, câble USB |
|
||||
| **Compte Apple Developer** | 99 €/an | **1 an** | Idem, mais plus de limites gênantes |
|
||||
| **TestFlight** | 99 €/an | 90 jours par build | Passe par App Store Connect (revue allégée) |
|
||||
|
||||
Limites du compte gratuit : **3 apps sideloadées maximum** et **10 App IDs par
|
||||
semaine**. Avec un compte payant, la signature tient un an et les limites
|
||||
disparaissent — c'est la meilleure option si l'app est utilisée au quotidien.
|
||||
|
||||
### Marche à suivre avec AltStore (gratuit, la plus courante)
|
||||
|
||||
1. Installer **AltServer** sur un PC Windows ou un Mac (altstore.io), plus
|
||||
iTunes + iCloud (versions du site Apple, pas du Microsoft Store) sur Windows.
|
||||
2. Brancher l'iPhone/iPad en USB, faire confiance à l'ordinateur.
|
||||
3. Dans AltServer : *Install AltStore* → choisir l'appareil → saisir son Apple ID.
|
||||
4. Sur l'appareil : **Réglages → Général → VPN et gestion de l'appareil** →
|
||||
faire confiance au profil développeur.
|
||||
5. Télécharger `xtremobile-vX.Y.Z-unsigned.ipa` depuis la GitHub Release.
|
||||
6. Dans AltStore sur l'appareil : **My Apps → + → sélectionner l'IPA**. AltStore
|
||||
signe l'app avec l'Apple ID et l'installe.
|
||||
7. Garder AltServer allumé sur le même Wi-Fi : AltStore renouvelle la signature
|
||||
avant l'expiration des 7 jours. **SideStore** fait la même chose sans PC une
|
||||
fois configuré.
|
||||
|
||||
### Avec Sideloadly
|
||||
|
||||
Plus simple mais sans renouvellement automatique : installer Sideloadly, brancher
|
||||
l'appareil, glisser l'IPA, saisir l'Apple ID, cliquer sur *Start*. À refaire tous
|
||||
les 7 jours.
|
||||
|
||||
### Si l'appareil n'est pas toujours sur le même réseau
|
||||
|
||||
C'est la limite d'AltStore : son renouvellement automatique exige qu'AltServer
|
||||
tourne sur **le même Wi-Fi** que l'appareil. Un iPad souvent hors du réseau
|
||||
domestique verra l'app expirer au bout de 7 jours, loin de tout ordinateur.
|
||||
|
||||
Deux réponses :
|
||||
|
||||
* **SideStore** — variante d'AltStore qui renouvelle la signature *depuis
|
||||
l'appareil*, sans AltServer ni réseau local. Un ordinateur reste nécessaire
|
||||
une seule fois, pour générer le fichier de pairage. Ensuite l'iPad se
|
||||
débrouille seul, en 4G comme en Wi-Fi. **C'est la seule voie gratuite adaptée
|
||||
à un appareil nomade** ; la marche à suivre est détaillée ci-dessous.
|
||||
* **Compte Apple Developer (99 €/an)** — la signature tient **un an** : il n'y a
|
||||
plus rien à renouveler, donc plus aucune contrainte de réseau.
|
||||
|
||||
### Marche à suivre avec SideStore (gratuit, appareil nomade)
|
||||
|
||||
L'ordinateur ne sert qu'à l'étape 1 ; ensuite l'iPad est autonome.
|
||||
|
||||
1. **Fichier de pairage** — sur un PC Windows ou un Mac, installer le générateur
|
||||
de pairage fourni par SideStore (`SideStore Pairing File Generator`,
|
||||
sidestore.io), brancher l'iPad en USB, accepter « Faire confiance à cet
|
||||
ordinateur », lancer l'outil : il produit un fichier `.mobiledevicepairing`.
|
||||
2. **Installer SideStore** — toujours depuis l'ordinateur, installer l'app
|
||||
SideStore sur l'iPad (l'outil d'installation de sidestore.io le fait avec ton
|
||||
Apple ID). Sur l'iPad : **Réglages → Général → VPN et gestion de l'appareil**
|
||||
→ faire confiance au profil développeur.
|
||||
3. **Activer le tunnel** — installer **StosVPN** depuis l'App Store et l'activer.
|
||||
SideStore l'utilise pour dialoguer avec le service d'installation d'iOS ; sans
|
||||
lui, le renouvellement échoue.
|
||||
4. **Configurer SideStore** — ouvrir SideStore sur l'iPad, importer le fichier de
|
||||
pairage de l'étape 1, saisir l'Apple ID.
|
||||
5. **Installer l'app** — télécharger `xtremobile-vX.Y.Z-unsigned.ipa` depuis la
|
||||
GitHub Release *directement sur l'iPad*, puis dans SideStore : **My Apps → +**
|
||||
→ sélectionner l'IPA. SideStore le signe et l'installe.
|
||||
|
||||
À partir de là, SideStore renouvelle la signature tout seul avant l'échéance des
|
||||
7 jours, sur n'importe quel réseau — Wi-Fi public, partage de connexion ou 4G.
|
||||
Il suffit que l'iPad ait accès à Internet au moins une fois par semaine.
|
||||
|
||||
Limites du compte Apple ID gratuit, qui subsistent : **3 apps sideloadées au
|
||||
maximum** et **10 App IDs par semaine**.
|
||||
|
||||
### Avec un compte Apple Developer (99 €/an)
|
||||
|
||||
La signature tient **un an** et l'app cesse d'expirer toutes les semaines. Deux
|
||||
approches :
|
||||
|
||||
* signer l'IPA avec Sideloadly/AltStore en utilisant l'Apple ID du compte payant
|
||||
(le plus simple, rien à changer dans le projet) ;
|
||||
* ou passer à une distribution **Ad Hoc** (jusqu'à 100 appareils enregistrés par
|
||||
leur UDID) : il faut alors ajouter un certificat et un profil de provisioning
|
||||
dans le workflow et remplacer `--no-codesign` par un `flutter build ipa
|
||||
--export-options-plist`.
|
||||
|
||||
### Cas particulier de l'Union européenne
|
||||
|
||||
Depuis iOS 17.4, l'UE autorise les **magasins alternatifs** (AltStore PAL,
|
||||
notamment). Y publier l'app exige tout de même un compte développeur payant et
|
||||
la notarisation Apple : intéressant pour distribuer à d'autres personnes, inutile
|
||||
pour un usage personnel.
|
||||
|
||||
### Ce qui n'est pas possible
|
||||
|
||||
Il n'existe **aucun** moyen d'installer une app iOS sans signature Apple sur un
|
||||
appareil non jailbreaké. Un simple lien de téléchargement, comme pour l'APK
|
||||
Android, n'existe pas sur iOS.
|
||||
|
||||
## 4. Points de vigilance
|
||||
|
||||
* **Mises à jour** : pas de mise à jour automatique. Il faut retélécharger l'IPA
|
||||
de la nouvelle release et refaire l'installation.
|
||||
* **Expiration** : une app signée avec un Apple ID gratuit s'ouvre encore après
|
||||
7 jours mais refuse de se lancer ; une réinstallation conserve les données.
|
||||
* **Personnalisation** : pour changer le nom affiché, le bundle id ou la cible
|
||||
de déploiement, modifier les variables en tête de `scripts/prepare_ios.sh` —
|
||||
ne pas éditer `ios/` à la main, il est régénéré à chaque build.
|
||||
* **Projet Xcode versionné** : si vous préférez committer le dossier `ios/`
|
||||
(pour le retoucher dans Xcode), générez-le une fois sur un Mac puis committez-le.
|
||||
`scripts/prepare_ios.sh` détecte sa présence, ne le régénère pas et se contente
|
||||
de réappliquer les réglages du tableau §1.
|
||||
@@ -1,6 +1,13 @@
|
||||
# XtremFlow - IPTV Web Application
|
||||
# XtremFlow - IPTV Application
|
||||
|
||||
High-performance, containerized IPTV Web Application using Flutter Web and Xtream Codes API.
|
||||
High-performance IPTV application built with Flutter and the Xtream Codes API,
|
||||
running on Android, iPhone and iPad.
|
||||
|
||||
## Installation
|
||||
|
||||
- **Android** : télécharger l'APK depuis la [dernière release](../../releases) et l'installer.
|
||||
- **iPhone / iPad** : un IPA non signé est publié sur la même release ; voir
|
||||
[`IOS_GUIDE.md`](IOS_GUIDE.md) pour l'installer sans passer par l'App Store.
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("kotlin-android")
|
||||
@@ -5,6 +7,18 @@ plugins {
|
||||
id("dev.flutter.flutter-gradle-plugin")
|
||||
}
|
||||
|
||||
// Signature release stable : android/key.properties (ignoré par git) pointe vers
|
||||
// un keystore fixe. Sans ce fichier, on retombe sur la clé debug locale pour que
|
||||
// `flutter run --release` continue de marcher. La CI DOIT fournir key.properties,
|
||||
// sinon chaque build serait signé avec une clé debug aléatoire et l'APK ne
|
||||
// s'installerait pas par-dessus une version existante.
|
||||
val keystoreProperties = Properties()
|
||||
val keystorePropertiesFile = rootProject.file("key.properties")
|
||||
val hasReleaseKeystore = keystorePropertiesFile.exists()
|
||||
if (hasReleaseKeystore) {
|
||||
keystorePropertiesFile.inputStream().use { keystoreProperties.load(it) }
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.xtremflow"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
@@ -30,11 +44,24 @@ android {
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
if (hasReleaseKeystore) {
|
||||
create("release") {
|
||||
storeFile = file(keystoreProperties.getProperty("storeFile"))
|
||||
storePassword = keystoreProperties.getProperty("storePassword")
|
||||
keyAlias = keystoreProperties.getProperty("keyAlias")
|
||||
keyPassword = keystoreProperties.getProperty("keyPassword")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
signingConfig = if (hasReleaseKeystore) {
|
||||
signingConfigs.getByName("release")
|
||||
} else {
|
||||
signingConfigs.getByName("debug")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
# Icônes iOS uniquement : le dossier ios/ étant régénéré à chaque build CI,
|
||||
# l'AppIcon doit être reconstruite après `scripts/prepare_ios.sh`.
|
||||
# Les icônes Android, elles, sont versionnées dans android/app/src/main/res.
|
||||
# Usage : dart run flutter_launcher_icons -f flutter_launcher_icons-ios.yaml
|
||||
flutter_launcher_icons:
|
||||
ios: true
|
||||
android: false
|
||||
image_path: "assets/images/logo_xtremflow.png"
|
||||
# L'App Store et iOS refusent une icône avec canal alpha.
|
||||
remove_alpha_ios: true
|
||||
@@ -80,6 +80,16 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
|
||||
final FocusNode _playPauseFocusNode = FocusNode();
|
||||
final FocusNode _prevFocusNode = FocusNode();
|
||||
final FocusNode _nextFocusNode = FocusNode();
|
||||
final FocusNode _channelListButtonFocusNode = FocusNode();
|
||||
|
||||
/// Focus D-pad de la chaîne active dans la sidebar : permet d'atterrir
|
||||
/// directement dessus à l'ouverture de la liste.
|
||||
final FocusNode _channelListItemFocusNode = FocusNode();
|
||||
|
||||
// [TiviMate] Channel List Sidebar
|
||||
bool _showChannelList = false;
|
||||
Timer? _channelListTimer;
|
||||
final ScrollController _channelListScrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -132,6 +142,8 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
|
||||
_controlsTimer = null;
|
||||
_stabilizationTimer?.cancel();
|
||||
_stabilizationTimer = null;
|
||||
_channelListTimer?.cancel();
|
||||
_channelListTimer = null;
|
||||
|
||||
final controller = _controller;
|
||||
_controller = null;
|
||||
@@ -339,15 +351,95 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
|
||||
|
||||
void _switchChannel(int index) {
|
||||
if (widget.channels == null) return;
|
||||
setState(() => _currentIndex = index);
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
_showChannelList = false; // close sidebar on switch
|
||||
});
|
||||
_channelListTimer?.cancel();
|
||||
_onUserInteraction(); // Ensure OSD shows up and timer resets on channel change
|
||||
_loadStream();
|
||||
}
|
||||
|
||||
/// Open/close the channel list sidebar
|
||||
void _toggleChannelList() {
|
||||
setState(() => _showChannelList = !_showChannelList);
|
||||
if (_showChannelList) {
|
||||
_scrollToCurrentChannel();
|
||||
_restartChannelListTimer();
|
||||
// Focus direct sur la chaîne en cours : la télécommande navigue dans la
|
||||
// liste sans étape intermédiaire. Second essai après l'animation de
|
||||
// scroll (300 ms), l'item actif pouvant ne pas encore être construit.
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted && _showChannelList) {
|
||||
_channelListItemFocusNode.requestFocus();
|
||||
}
|
||||
});
|
||||
Future.delayed(const Duration(milliseconds: 400), () {
|
||||
if (mounted &&
|
||||
_showChannelList &&
|
||||
!_channelListItemFocusNode.hasFocus) {
|
||||
_channelListItemFocusNode.requestFocus();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
_channelListTimer?.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/// (Re)arme l'auto-fermeture de la sidebar. Relancé à chaque interaction
|
||||
/// (focus D-pad, scroll) pour ne pas fermer la liste sous les doigts.
|
||||
void _restartChannelListTimer() {
|
||||
_channelListTimer?.cancel();
|
||||
_channelListTimer = Timer(const Duration(seconds: 6), () {
|
||||
if (mounted) setState(() => _showChannelList = false);
|
||||
});
|
||||
}
|
||||
|
||||
/// Scroll channel list to keep current channel visible
|
||||
void _scrollToCurrentChannel() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!_channelListScrollController.hasClients) return;
|
||||
const itemHeight = 64.0;
|
||||
final offset = (_currentIndex * itemHeight) -
|
||||
(_channelListScrollController.position.viewportDimension / 2) +
|
||||
(itemHeight / 2);
|
||||
_channelListScrollController.animateTo(
|
||||
offset.clamp(0, _channelListScrollController.position.maxScrollExtent),
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeOut,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
bool _handleKeyEvent(KeyEvent event) {
|
||||
if (event is! KeyDownEvent) return false;
|
||||
final key = event.logicalKey;
|
||||
|
||||
// Sidebar ouverte : Back/Menu la ferment, le reste part au système de
|
||||
// Focus (navigation + OK sur un item). On relance juste l'auto-fermeture.
|
||||
if (_showChannelList) {
|
||||
if (key == LogicalKeyboardKey.escape ||
|
||||
key == LogicalKeyboardKey.goBack ||
|
||||
key == LogicalKeyboardKey.contextMenu ||
|
||||
key == LogicalKeyboardKey.keyM) {
|
||||
_channelListTimer?.cancel();
|
||||
setState(() => _showChannelList = false);
|
||||
return true;
|
||||
}
|
||||
_restartChannelListTimer();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Menu key or 'M' → toggle channel list sidebar
|
||||
if (key == LogicalKeyboardKey.contextMenu ||
|
||||
key == LogicalKeyboardKey.keyM) {
|
||||
if (widget.streamType == model.StreamType.live &&
|
||||
widget.channels != null) {
|
||||
_toggleChannelList();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (key == LogicalKeyboardKey.channelUp) {
|
||||
if (widget.channels != null) {
|
||||
_switchChannel((_currentIndex + 1) % widget.channels!.length);
|
||||
@@ -397,6 +489,8 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
|
||||
_epgTimer?.cancel();
|
||||
_controlsTimer?.cancel();
|
||||
_stabilizationTimer?.cancel();
|
||||
_channelListTimer?.cancel();
|
||||
_channelListScrollController.dispose();
|
||||
_controller?.pause(); // Force stop audio immediately
|
||||
_controller?.dispose();
|
||||
_xtreamService?.dispose();
|
||||
@@ -404,6 +498,8 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
|
||||
_playPauseFocusNode.dispose();
|
||||
_prevFocusNode.dispose();
|
||||
_nextFocusNode.dispose();
|
||||
_channelListButtonFocusNode.dispose();
|
||||
_channelListItemFocusNode.dispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
@@ -419,7 +515,23 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
|
||||
// True black behind the video surface, never the warm ink.
|
||||
backgroundColor: Colors.black,
|
||||
body: GestureDetector(
|
||||
onTap: _onUserInteraction,
|
||||
onTap: () {
|
||||
if (_showChannelList) {
|
||||
_channelListTimer?.cancel();
|
||||
setState(() => _showChannelList = false);
|
||||
} else {
|
||||
_onUserInteraction();
|
||||
}
|
||||
},
|
||||
// Swipe from right edge → open channel list
|
||||
onHorizontalDragEnd: (details) {
|
||||
if (widget.streamType == model.StreamType.live &&
|
||||
widget.channels != null &&
|
||||
details.primaryVelocity != null &&
|
||||
details.primaryVelocity! < -300) {
|
||||
_toggleChannelList();
|
||||
}
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
// Video Surface
|
||||
@@ -509,6 +621,13 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
|
||||
|
||||
// OSD (EPG + Controls)
|
||||
if (_showControls) _buildOSD(title),
|
||||
|
||||
// [TiviMate] Channel list sidebar
|
||||
if (_showChannelList &&
|
||||
widget.streamType == model.StreamType.live &&
|
||||
widget.channels != null &&
|
||||
widget.channels!.isNotEmpty)
|
||||
_buildChannelListSidebar(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -611,6 +730,20 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
// Channel list sidebar (liste des chaînes de la catégorie)
|
||||
if (widget.streamType == model.StreamType.live &&
|
||||
widget.channels != null &&
|
||||
widget.channels!.isNotEmpty)
|
||||
TVFocusable(
|
||||
focusNode: _channelListButtonFocusNode,
|
||||
onPressed: _toggleChannelList,
|
||||
child: const Icon(
|
||||
Icons.playlist_play_rounded,
|
||||
color: AppColors.onSurface,
|
||||
size: 36,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
// Deinterlace Button (Switches to Native Player with forced Deinterlace)
|
||||
TVFocusable(
|
||||
@@ -774,4 +907,178 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// [TiviMate] Channel list sidebar — slide-in panel on the right
|
||||
Widget _buildChannelListSidebar() {
|
||||
final channels = widget.channels!;
|
||||
return Positioned(
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
width: 280,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.centerRight,
|
||||
end: Alignment.centerLeft,
|
||||
colors: [Color(0xE6000000), Color(0x99000000)],
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
// Header
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: AppColors.onSurface12),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.list,
|
||||
color: AppColors.onSurface70, size: 18),
|
||||
const SizedBox(width: 8),
|
||||
const Expanded(
|
||||
child: Text(
|
||||
'Chaînes',
|
||||
style: TextStyle(
|
||||
color: AppColors.onSurface,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
_channelListTimer?.cancel();
|
||||
setState(() => _showChannelList = false);
|
||||
},
|
||||
child: const Icon(Icons.close,
|
||||
color: AppColors.onSurface54, size: 18),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Channel list
|
||||
Expanded(
|
||||
child: NotificationListener<ScrollNotification>(
|
||||
onNotification: (_) {
|
||||
_restartChannelListTimer();
|
||||
return false;
|
||||
},
|
||||
child: ListView.builder(
|
||||
controller: _channelListScrollController,
|
||||
itemCount: channels.length,
|
||||
itemExtent: 64.0,
|
||||
itemBuilder: (context, index) {
|
||||
final ch = channels[index];
|
||||
final isActive = index == _currentIndex;
|
||||
return TVFocusable(
|
||||
// Le focusNode externe n'est posé que sur la chaîne
|
||||
// active ; la clé force un remontage quand isActive
|
||||
// change (TVFocusable ne gère pas didUpdateWidget).
|
||||
key: ValueKey('sidebar-ch-$index-$isActive'),
|
||||
focusNode: isActive ? _channelListItemFocusNode : null,
|
||||
scale: 1.0,
|
||||
borderRadius: BorderRadius.zero,
|
||||
onFocus: _restartChannelListTimer,
|
||||
onPressed: () {
|
||||
_channelListTimer?.cancel();
|
||||
_switchChannel(index);
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: isActive
|
||||
? AppColors.primaryFill.withValues(alpha: 0.6)
|
||||
: Colors.transparent,
|
||||
border: isActive
|
||||
? const Border(
|
||||
left: BorderSide(
|
||||
color: AppColors.primary,
|
||||
width: 3,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
// Logo
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
margin: const EdgeInsets.only(right: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.onSurface12,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: ch.streamIcon.isNotEmpty
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: ch.streamIcon,
|
||||
fit: BoxFit.contain,
|
||||
errorWidget: (_, __, ___) =>
|
||||
const Icon(Icons.tv,
|
||||
color: AppColors.onSurface38,
|
||||
size: 20),
|
||||
),
|
||||
)
|
||||
: const Icon(Icons.tv,
|
||||
color: AppColors.onSurface38, size: 20),
|
||||
),
|
||||
// Name + num
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
ch.name,
|
||||
style: TextStyle(
|
||||
color: isActive
|
||||
? AppColors.onSurface
|
||||
: AppColors.onSurface70,
|
||||
fontSize: 13,
|
||||
fontWeight: isActive
|
||||
? FontWeight.bold
|
||||
: FontWeight.normal,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
'CH ${index + 1}',
|
||||
style: const TextStyle(
|
||||
color: AppColors.onSurface38,
|
||||
fontSize: 11,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Active indicator
|
||||
if (isActive)
|
||||
const Icon(
|
||||
Icons.play_arrow,
|
||||
color: AppColors.primary,
|
||||
size: 18,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,11 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
|
||||
final FocusNode _sliderFocusNode = FocusNode();
|
||||
final FocusNode _backFocusNode = FocusNode();
|
||||
final FocusNode _audioFocusNode = FocusNode();
|
||||
final FocusNode _channelListButtonFocusNode = FocusNode();
|
||||
|
||||
/// Focus D-pad de la chaîne active dans la sidebar : permet d'atterrir
|
||||
/// directement dessus à l'ouverture de la liste.
|
||||
final FocusNode _channelListItemFocusNode = FocusNode();
|
||||
|
||||
bool _isLoading = true;
|
||||
bool _isFirstLoad = true; // true = black overlay; false = silent spinner
|
||||
@@ -605,6 +610,8 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
|
||||
_sliderFocusNode.dispose();
|
||||
_backFocusNode.dispose();
|
||||
_audioFocusNode.dispose();
|
||||
_channelListButtonFocusNode.dispose();
|
||||
_channelListItemFocusNode.dispose();
|
||||
|
||||
// Restore normal orientation
|
||||
SystemChrome.setPreferredOrientations([
|
||||
@@ -1054,15 +1061,36 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
|
||||
setState(() => _showChannelList = !_showChannelList);
|
||||
if (_showChannelList) {
|
||||
_scrollToCurrentChannel();
|
||||
_channelListTimer?.cancel();
|
||||
_channelListTimer = Timer(const Duration(seconds: 6), () {
|
||||
if (mounted) setState(() => _showChannelList = false);
|
||||
_restartChannelListTimer();
|
||||
// Focus direct sur la chaîne en cours : la télécommande navigue dans la
|
||||
// liste sans étape intermédiaire. Second essai après l'animation de
|
||||
// scroll (300 ms), l'item actif pouvant ne pas encore être construit.
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted && _showChannelList) {
|
||||
_channelListItemFocusNode.requestFocus();
|
||||
}
|
||||
});
|
||||
Future.delayed(const Duration(milliseconds: 400), () {
|
||||
if (mounted &&
|
||||
_showChannelList &&
|
||||
!_channelListItemFocusNode.hasFocus) {
|
||||
_channelListItemFocusNode.requestFocus();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
_channelListTimer?.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/// (Re)arme l'auto-fermeture de la sidebar. Relancé à chaque interaction
|
||||
/// (focus D-pad, scroll) pour ne pas fermer la liste sous les doigts.
|
||||
void _restartChannelListTimer() {
|
||||
_channelListTimer?.cancel();
|
||||
_channelListTimer = Timer(const Duration(seconds: 6), () {
|
||||
if (mounted) setState(() => _showChannelList = false);
|
||||
});
|
||||
}
|
||||
|
||||
/// Scroll channel list to keep current channel visible
|
||||
void _scrollToCurrentChannel() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
@@ -1111,6 +1139,21 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
|
||||
try {
|
||||
final key = event.logicalKey;
|
||||
|
||||
// Sidebar ouverte : Back/Menu la ferment, le reste part au système de
|
||||
// Focus (navigation + OK sur un item). On relance juste l'auto-fermeture.
|
||||
if (_showChannelList) {
|
||||
if (key == LogicalKeyboardKey.escape ||
|
||||
key == LogicalKeyboardKey.goBack ||
|
||||
key == LogicalKeyboardKey.contextMenu ||
|
||||
key == LogicalKeyboardKey.keyM) {
|
||||
_channelListTimer?.cancel();
|
||||
setState(() => _showChannelList = false);
|
||||
return true;
|
||||
}
|
||||
_restartChannelListTimer();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Explicit Play
|
||||
if (key == LogicalKeyboardKey.mediaPlay) {
|
||||
if (!_isPlaying) _player.play();
|
||||
@@ -1224,16 +1267,6 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
|
||||
}
|
||||
}
|
||||
|
||||
// OK / Select when channel list is open → switch to focused channel
|
||||
if (_showChannelList &&
|
||||
(key == LogicalKeyboardKey.enter ||
|
||||
key == LogicalKeyboardKey.select ||
|
||||
key == LogicalKeyboardKey.numpadEnter)) {
|
||||
// Channel list handles its own tap, this closes it
|
||||
setState(() => _showChannelList = false);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Menu key or 'M' → toggle channel list sidebar
|
||||
if (key == LogicalKeyboardKey.contextMenu ||
|
||||
key == LogicalKeyboardKey.keyM) {
|
||||
@@ -1597,6 +1630,19 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
// Channel list sidebar (liste des chaînes de la catégorie)
|
||||
if (widget.channels != null && widget.channels!.isNotEmpty)
|
||||
TVFocusable(
|
||||
focusNode: _channelListButtonFocusNode,
|
||||
onPressed: _toggleChannelList,
|
||||
onFocus: () => _noteFocus(_channelListButtonFocusNode),
|
||||
child: const Icon(
|
||||
Icons.playlist_play_rounded,
|
||||
color: AppColors.onSurface,
|
||||
size: 36,
|
||||
),
|
||||
),
|
||||
|
||||
// Disable Deinterlace Button
|
||||
if (widget.forceDeinterlace) ...[
|
||||
const SizedBox(width: 16),
|
||||
@@ -1945,15 +1991,28 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
|
||||
),
|
||||
// Channel list
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
child: NotificationListener<ScrollNotification>(
|
||||
onNotification: (_) {
|
||||
_restartChannelListTimer();
|
||||
return false;
|
||||
},
|
||||
child: ListView.builder(
|
||||
controller: _channelListScrollController,
|
||||
itemCount: channels.length,
|
||||
itemExtent: 64.0,
|
||||
itemBuilder: (context, index) {
|
||||
final ch = channels[index];
|
||||
final isActive = index == _currentIndex;
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
return TVFocusable(
|
||||
// Le focusNode externe n'est posé que sur la chaîne
|
||||
// active ; la clé force un remontage quand isActive
|
||||
// change (TVFocusable ne gère pas didUpdateWidget).
|
||||
key: ValueKey('sidebar-ch-$index-$isActive'),
|
||||
focusNode: isActive ? _channelListItemFocusNode : null,
|
||||
scale: 1.0,
|
||||
borderRadius: BorderRadius.zero,
|
||||
onFocus: _restartChannelListTimer,
|
||||
onPressed: () {
|
||||
_channelListTimer?.cancel();
|
||||
_switchChannel(index);
|
||||
},
|
||||
@@ -2041,6 +2100,7 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -98,6 +98,14 @@ class XtreamServiceMobile {
|
||||
/// changing any call site.
|
||||
final Map<String, model.Channel> _channelIndex = {};
|
||||
|
||||
/// Last non-empty live lists, keyed by category id ('' = all channels).
|
||||
///
|
||||
/// The fetchers swallow errors and return `[]`, so a refresh attempted while
|
||||
/// the network is down (typically right after a TV wakes from standby) would
|
||||
/// otherwise replace a good list with an empty screen.
|
||||
final Map<String, List<model.Channel>> _lastLiveChannels = {};
|
||||
List<model.Category>? _lastLiveCategories;
|
||||
|
||||
late final XmltvService _xmltv = XmltvService(cacheDir);
|
||||
|
||||
/// User-provided XMLTV URL (empty = not configured).
|
||||
@@ -200,7 +208,18 @@ class XtreamServiceMobile {
|
||||
|
||||
/// Get live channels for a category (with batch EPG support)
|
||||
/// If categoryId is empty, fetches ALL channels from all categories
|
||||
///
|
||||
/// Falls back to the last good list for this category when the fetch fails.
|
||||
Future<List<model.Channel>> getLiveChannels(String categoryId) async {
|
||||
final channels = await _fetchLiveChannels(categoryId);
|
||||
if (channels.isNotEmpty) {
|
||||
_lastLiveChannels[categoryId] = channels;
|
||||
return channels;
|
||||
}
|
||||
return _lastLiveChannels[categoryId] ?? channels;
|
||||
}
|
||||
|
||||
Future<List<model.Channel>> _fetchLiveChannels(String categoryId) async {
|
||||
try {
|
||||
final queryParams = {
|
||||
'username': _username,
|
||||
@@ -463,7 +482,18 @@ class XtreamServiceMobile {
|
||||
}
|
||||
|
||||
/// Get live TV categories
|
||||
///
|
||||
/// Falls back to the last good list when the fetch fails.
|
||||
Future<List<model.Category>> getLiveCategories() async {
|
||||
final categories = await _fetchLiveCategories();
|
||||
if (categories.isNotEmpty) {
|
||||
_lastLiveCategories = categories;
|
||||
return categories;
|
||||
}
|
||||
return _lastLiveCategories ?? categories;
|
||||
}
|
||||
|
||||
Future<List<model.Category>> _fetchLiveCategories() async {
|
||||
try {
|
||||
if (kDebugMode) print('🔍 Loading live TV categories with 8s timeout...');
|
||||
|
||||
|
||||
@@ -27,7 +27,11 @@ class MobileLiveTVTab extends ConsumerStatefulWidget {
|
||||
}
|
||||
|
||||
class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
with AutomaticKeepAliveClientMixin, WidgetsBindingObserver {
|
||||
/// Coming back to the foreground after this long refetches the channel list,
|
||||
/// so an app left running for days on a TV box picks up provider changes.
|
||||
static const _autoRefreshAfter = Duration(hours: 4);
|
||||
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
final TextEditingController _searchController = TextEditingController();
|
||||
final FocusNode _searchFocusNode = FocusNode();
|
||||
@@ -36,12 +40,16 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab>
|
||||
bool _isSearchEditing = false;
|
||||
bool _justReturnedFromPlayer =
|
||||
false; // Flag to prevent PopScope interception after player
|
||||
bool _isRefreshing = false;
|
||||
|
||||
Timer? _searchTimer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
// Anchor the auto-refresh clock to this first load.
|
||||
ref.read(liveCatalogRefreshedAtProvider);
|
||||
// [P1-1 FIX] Debounce search input to prevent per-keystroke rebuilds
|
||||
_searchTimer = null;
|
||||
_searchController.addListener(() {
|
||||
@@ -62,6 +70,7 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab>
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
_scrollController.dispose();
|
||||
_searchController.dispose();
|
||||
_searchFocusNode.dispose();
|
||||
@@ -72,6 +81,39 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab>
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (state != AppLifecycleState.resumed) return;
|
||||
final lastRefresh = ref.read(liveCatalogRefreshedAtProvider);
|
||||
if (DateTime.now().difference(lastRefresh) >= _autoRefreshAfter) {
|
||||
_refreshChannels();
|
||||
}
|
||||
}
|
||||
|
||||
/// Refetch categories and the open category's channels. The current lists
|
||||
/// stay on screen until the new ones arrive.
|
||||
Future<void> _refreshChannels() async {
|
||||
if (_isRefreshing) return;
|
||||
setState(() => _isRefreshing = true);
|
||||
|
||||
refreshLiveCatalog(ref);
|
||||
final categoryId = ref.read(mobileLiveTvUiStateProvider).selectedCategoryId;
|
||||
try {
|
||||
await Future.wait<Object>([
|
||||
ref.read(mobileLiveCategoriesProvider(widget.playlist).future),
|
||||
if (categoryId != null)
|
||||
ref.read(
|
||||
mobileLiveChannelsByCategoryProvider((widget.playlist, categoryId))
|
||||
.future,
|
||||
),
|
||||
]);
|
||||
} catch (_) {
|
||||
// Errors surface through the providers' own error states.
|
||||
} finally {
|
||||
if (mounted) setState(() => _isRefreshing = false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
@@ -210,197 +252,228 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab>
|
||||
|
||||
return SafeArea(
|
||||
bottom: false,
|
||||
child: CustomScrollView(
|
||||
controller: _scrollController,
|
||||
slivers: [
|
||||
// Floating Header (Search + Navigation)
|
||||
SliverAppBar(
|
||||
floating: false,
|
||||
pinned: true,
|
||||
snap: false,
|
||||
backgroundColor: const Color(0xFF000000), // Opaque black
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
toolbarHeight: _searchQuery.isNotEmpty ||
|
||||
_showFavoritesOnly ||
|
||||
!uiState.isCategoryView
|
||||
? 120.0
|
||||
: 110.0,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Container(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// Search Bar
|
||||
TVFocusable(
|
||||
scale: 1.0,
|
||||
focusColor: AppColors.onSurface,
|
||||
onPressed: () {
|
||||
setState(() => _isSearchEditing = true);
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) {
|
||||
_searchFocusNode.requestFocus();
|
||||
SystemChannels.textInput
|
||||
.invokeMethod('TextInput.show');
|
||||
});
|
||||
},
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
height: 48,
|
||||
decoration: AppDecorations.searchBar(context),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.search,
|
||||
color: AppDecorations.textSecondary(
|
||||
context),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: ExcludeFocus(
|
||||
excluding: !_isSearchEditing,
|
||||
child: TextField(
|
||||
cursorColor: AppColors.onSurface,
|
||||
controller: _searchController,
|
||||
focusNode: _searchFocusNode,
|
||||
readOnly: !_isSearchEditing,
|
||||
style: TextStyle(
|
||||
color: AppDecorations.textPrimary(
|
||||
context),
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
hintText:
|
||||
'Rechercher une chaîne...',
|
||||
border: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
isDense: true,
|
||||
),
|
||||
onSubmitted: (_) => setState(
|
||||
() => _isSearchEditing = false,
|
||||
child: RefreshIndicator(
|
||||
onRefresh: _refreshChannels,
|
||||
color: AppColors.primary,
|
||||
child: CustomScrollView(
|
||||
controller: _scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
// Floating Header (Search + Navigation)
|
||||
SliverAppBar(
|
||||
floating: false,
|
||||
pinned: true,
|
||||
snap: false,
|
||||
backgroundColor:
|
||||
const Color(0xFF000000), // Opaque black
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
toolbarHeight: _searchQuery.isNotEmpty ||
|
||||
_showFavoritesOnly ||
|
||||
!uiState.isCategoryView
|
||||
? 120.0
|
||||
: 110.0,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Container(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// Search Bar
|
||||
TVFocusable(
|
||||
scale: 1.0,
|
||||
focusColor: AppColors.onSurface,
|
||||
onPressed: () {
|
||||
setState(() => _isSearchEditing = true);
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) {
|
||||
_searchFocusNode.requestFocus();
|
||||
SystemChannels.textInput
|
||||
.invokeMethod('TextInput.show');
|
||||
});
|
||||
},
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
height: 48,
|
||||
decoration:
|
||||
AppDecorations.searchBar(context),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.search,
|
||||
color: AppDecorations.textSecondary(
|
||||
context),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: ExcludeFocus(
|
||||
excluding: !_isSearchEditing,
|
||||
child: TextField(
|
||||
cursorColor: AppColors.onSurface,
|
||||
controller: _searchController,
|
||||
focusNode: _searchFocusNode,
|
||||
readOnly: !_isSearchEditing,
|
||||
style: TextStyle(
|
||||
color:
|
||||
AppDecorations.textPrimary(
|
||||
context),
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
hintText:
|
||||
'Rechercher une chaîne...',
|
||||
border: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
isDense: true,
|
||||
),
|
||||
onSubmitted: (_) => setState(
|
||||
() => _isSearchEditing = false,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_searchQuery.isNotEmpty)
|
||||
GestureDetector(
|
||||
onTap: () =>
|
||||
_searchController.clear(),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color: AppDecorations.textSecondary(
|
||||
context),
|
||||
if (_searchQuery.isNotEmpty)
|
||||
GestureDetector(
|
||||
onTap: () =>
|
||||
_searchController.clear(),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color:
|
||||
AppDecorations.textSecondary(
|
||||
context),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Title / Navigation Row
|
||||
Row(
|
||||
children: [
|
||||
if (!showGrid ||
|
||||
_showFavoritesOnly ||
|
||||
_searchQuery.isNotEmpty) ...[
|
||||
// Title / Navigation Row
|
||||
Row(
|
||||
children: [
|
||||
if (!showGrid ||
|
||||
_showFavoritesOnly ||
|
||||
_searchQuery.isNotEmpty) ...[
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
color: AppDecorations.textPrimary(
|
||||
context),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_searchQuery.isNotEmpty) {
|
||||
_searchController.clear();
|
||||
} else if (_showFavoritesOnly) {
|
||||
setState(
|
||||
() => _showFavoritesOnly = false,
|
||||
);
|
||||
} else {
|
||||
uiNotifier.state = uiState.copyWith(
|
||||
isCategoryView: true,
|
||||
);
|
||||
}
|
||||
},
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
],
|
||||
Expanded(
|
||||
child: Text(
|
||||
_searchQuery.isNotEmpty
|
||||
? 'Résultats de recherche'
|
||||
: _showFavoritesOnly
|
||||
? 'Favoris'
|
||||
: showGrid
|
||||
? 'Catégories'
|
||||
: uiState
|
||||
.selectedCategory ??
|
||||
'Chaînes',
|
||||
style: TextStyle(
|
||||
color: AppDecorations.textPrimary(
|
||||
context),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Actualiser les chaînes',
|
||||
icon: _isRefreshing
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: Icon(
|
||||
Icons.refresh,
|
||||
color:
|
||||
AppDecorations.textSecondary(
|
||||
context),
|
||||
),
|
||||
onPressed: _isRefreshing
|
||||
? null
|
||||
: _refreshChannels,
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
color:
|
||||
AppDecorations.textPrimary(context),
|
||||
_showFavoritesOnly
|
||||
? Icons.favorite
|
||||
: Icons.favorite_border,
|
||||
color: _showFavoritesOnly
|
||||
? AppColors.live
|
||||
: AppDecorations.textSecondary(
|
||||
context),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_searchQuery.isNotEmpty) {
|
||||
_searchController.clear();
|
||||
} else if (_showFavoritesOnly) {
|
||||
setState(
|
||||
() => _showFavoritesOnly = false,
|
||||
);
|
||||
} else {
|
||||
onPressed: () => setState(() {
|
||||
_showFavoritesOnly =
|
||||
!_showFavoritesOnly;
|
||||
if (_showFavoritesOnly) {
|
||||
uiNotifier.state = uiState.copyWith(
|
||||
isCategoryView: true,
|
||||
isCategoryView: false,
|
||||
);
|
||||
}
|
||||
},
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
if (!_showFavoritesOnly) {
|
||||
uiNotifier.state = uiState.copyWith(
|
||||
isCategoryView: true);
|
||||
}
|
||||
}),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
],
|
||||
Expanded(
|
||||
child: Text(
|
||||
_searchQuery.isNotEmpty
|
||||
? 'Résultats de recherche'
|
||||
: _showFavoritesOnly
|
||||
? 'Favoris'
|
||||
: showGrid
|
||||
? 'Catégories'
|
||||
: uiState.selectedCategory ??
|
||||
'Chaînes',
|
||||
style: TextStyle(
|
||||
color:
|
||||
AppDecorations.textPrimary(context),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
_showFavoritesOnly
|
||||
? Icons.favorite
|
||||
: Icons.favorite_border,
|
||||
color: _showFavoritesOnly
|
||||
? AppColors.live
|
||||
: AppDecorations.textSecondary(
|
||||
context),
|
||||
),
|
||||
onPressed: () => setState(() {
|
||||
_showFavoritesOnly = !_showFavoritesOnly;
|
||||
if (_showFavoritesOnly) {
|
||||
uiNotifier.state = uiState.copyWith(
|
||||
isCategoryView: false,
|
||||
);
|
||||
}
|
||||
if (!_showFavoritesOnly) {
|
||||
uiNotifier.state = uiState.copyWith(
|
||||
isCategoryView: true);
|
||||
}
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Main Content Sliver
|
||||
if (showGrid)
|
||||
_buildCategorySliver(categories, uiNotifier, uiState)
|
||||
else
|
||||
_ChannelListView(
|
||||
playlist: widget.playlist,
|
||||
uiState: uiState,
|
||||
searchQuery: _searchQuery,
|
||||
showFavoritesOnly: _showFavoritesOnly,
|
||||
onPlay: (channel, channels, index) => _playChannel(
|
||||
context,
|
||||
channel,
|
||||
channels,
|
||||
widget.playlist,
|
||||
index,
|
||||
// Main Content Sliver
|
||||
if (showGrid)
|
||||
_buildCategorySliver(categories, uiNotifier, uiState)
|
||||
else
|
||||
_ChannelListView(
|
||||
playlist: widget.playlist,
|
||||
uiState: uiState,
|
||||
searchQuery: _searchQuery,
|
||||
showFavoritesOnly: _showFavoritesOnly,
|
||||
onPlay: (channel, channels, index) => _playChannel(
|
||||
context,
|
||||
channel,
|
||||
channels,
|
||||
widget.playlist,
|
||||
index,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -225,6 +225,7 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context); // Required for AutomaticKeepAliveClientMixin
|
||||
ref.listen<int>(fullCatalogRefreshTickProvider, (_, __) => _refresh());
|
||||
final settings = ref.watch(mobileSettingsProvider);
|
||||
final watchHistory = ref.watch(mobileWatchHistoryProvider);
|
||||
|
||||
|
||||
@@ -216,6 +216,7 @@ class _MobileSeriesTabState extends ConsumerState<MobileSeriesTab>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
ref.listen<int>(fullCatalogRefreshTickProvider, (_, __) => _refresh());
|
||||
final settings = ref.watch(mobileSettingsProvider);
|
||||
|
||||
if (_categories.isEmpty && !_isLoading) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
// import 'package:dio_cache_interceptor_hive_store/dio_cache_interceptor_hive_store.dart';
|
||||
import 'package:xtremobile/mobile/providers/mobile_settings_providers.dart';
|
||||
import 'package:xtremobile/mobile/providers/mobile_xtream_providers.dart';
|
||||
import 'package:xtremobile/mobile/widgets/tv_focusable.dart';
|
||||
import 'package:xtremobile/core/theme/app_decorations.dart';
|
||||
import 'package:xtremobile/core/theme/app_theme.dart';
|
||||
@@ -106,7 +107,7 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Version 1.6.1',
|
||||
'Version 1.7.2',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 13,
|
||||
color: AppDecorations.textSecondary(context),
|
||||
@@ -179,8 +180,7 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
_buildSettingItem(
|
||||
icon: Icons.public,
|
||||
title: 'EPG communautaire',
|
||||
subtitle:
|
||||
'Repli quand le fournisseur ne renvoie aucun programme',
|
||||
subtitle: 'Repli quand le fournisseur ne renvoie aucun programme',
|
||||
value: settings.useCommunityEpg ? 'Activé' : 'Désactivé',
|
||||
onTap: () => ref
|
||||
.read(mobileSettingsProvider.notifier)
|
||||
@@ -197,9 +197,8 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
onTap: () => _showKeyboardDialog(
|
||||
'URL XMLTV',
|
||||
_xmltvController,
|
||||
(val) => ref
|
||||
.read(mobileSettingsProvider.notifier)
|
||||
.setXmltvUrl(val),
|
||||
(val) =>
|
||||
ref.read(mobileSettingsProvider.notifier).setXmltvUrl(val),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -254,8 +253,8 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
|
||||
_buildSettingItem(
|
||||
icon: _isRefreshingCache ? Icons.hourglass_empty : Icons.refresh,
|
||||
title: 'Actualiser le cache',
|
||||
subtitle: 'Recharge films, séries et EPG',
|
||||
title: 'Forcer l\'actualisation',
|
||||
subtitle: 'Recharge chaînes, films, séries et EPG',
|
||||
value: _isRefreshingCache ? '...' : 'Appuyer',
|
||||
onTap: _isRefreshingCache ? null : _refreshCache,
|
||||
),
|
||||
@@ -319,15 +318,15 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
setState(() => _isRefreshingCache = true);
|
||||
|
||||
try {
|
||||
// final dir = await getApplicationDocumentsDirectory();
|
||||
// final cacheStore = HiveCacheStore(dir.path);
|
||||
// await cacheStore.clean();
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
refreshFullCatalog(ref);
|
||||
// Brief pause so the tap visibly registers on a TV remote.
|
||||
await Future.delayed(const Duration(milliseconds: 600));
|
||||
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Cache actualisé ! Relancez l\'app pour recharger.'),
|
||||
content:
|
||||
Text('Chaînes, films, séries et EPG en cours de rechargement'),
|
||||
backgroundColor: AppColors.success,
|
||||
duration: Duration(seconds: 3),
|
||||
),
|
||||
@@ -336,7 +335,8 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Erreur: $e'), backgroundColor: AppColors.error),
|
||||
SnackBar(
|
||||
content: Text('Erreur: $e'), backgroundColor: AppColors.error),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
@@ -390,54 +390,60 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
builder: (ctx, constraints) {
|
||||
return Row(
|
||||
children: segments.map((seg) {
|
||||
final (mode, icon, label) = seg;
|
||||
final selected = themeState.appThemeMode == mode;
|
||||
final accentColor = Theme.of(context).colorScheme.primary;
|
||||
return Expanded(
|
||||
child: TVFocusable(
|
||||
onPressed: () => notifier.setThemeMode(mode),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 2),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 7,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: selected
|
||||
? accentColor
|
||||
: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
size: 16,
|
||||
color: selected
|
||||
? AppColors.onSurface
|
||||
: AppDecorations.textSecondary(context),
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: selected
|
||||
? FontWeight.w700
|
||||
: FontWeight.w500,
|
||||
final (mode, icon, label) = seg;
|
||||
final selected = themeState.appThemeMode == mode;
|
||||
final accentColor =
|
||||
Theme.of(context).colorScheme.primary;
|
||||
return Expanded(
|
||||
child: TVFocusable(
|
||||
onPressed: () => notifier.setThemeMode(mode),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
margin:
|
||||
const EdgeInsets.symmetric(horizontal: 2),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 7,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: selected
|
||||
? accentColor
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
size: 16,
|
||||
color: selected
|
||||
? AppColors.onSurface
|
||||
: AppDecorations.textSecondary(context),
|
||||
: AppDecorations.textSecondary(
|
||||
context),
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 3),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: selected
|
||||
? FontWeight.w700
|
||||
: FontWeight.w500,
|
||||
color: selected
|
||||
? AppColors.onSurface
|
||||
: AppDecorations.textSecondary(
|
||||
context),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -483,7 +489,8 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: Theme.of(context).colorScheme.primary, size: 24),
|
||||
Icon(icon,
|
||||
color: Theme.of(context).colorScheme.primary, size: 24),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -514,7 +521,10 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary.withValues(alpha: 0.15),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
@@ -562,7 +572,8 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: Theme.of(context).colorScheme.primary, size: 24),
|
||||
Icon(icon,
|
||||
color: Theme.of(context).colorScheme.primary, size: 24),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -592,7 +603,8 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(Icons.edit, color: AppDecorations.textSecondary(context), size: 20),
|
||||
Icon(Icons.edit,
|
||||
color: AppDecorations.textSecondary(context), size: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -30,10 +30,44 @@ final mobileXtreamServiceProvider =
|
||||
}
|
||||
});
|
||||
|
||||
// A full catalogue refresh from the settings also drops the cached EPG.
|
||||
ref.listen<int>(
|
||||
fullCatalogRefreshTickProvider, (_, __) => service.clearCache());
|
||||
|
||||
ref.onDispose(service.dispose);
|
||||
return service;
|
||||
});
|
||||
|
||||
/// When the live catalogue was last fetched or explicitly refreshed.
|
||||
/// Drives the auto-refresh when the app comes back to the foreground.
|
||||
final liveCatalogRefreshedAtProvider =
|
||||
StateProvider<DateTime>((ref) => DateTime.now());
|
||||
|
||||
/// Bumped by the settings "force refresh". The movies and series tabs, which
|
||||
/// hold their lists in local state, listen to it to reload.
|
||||
final fullCatalogRefreshTickProvider = StateProvider<int>((ref) => 0);
|
||||
|
||||
/// Forces the live categories and channels to be refetched from the panel.
|
||||
///
|
||||
/// The Xtream service is kept: it falls back to its last good lists if the
|
||||
/// refetch fails, so a flaky network never empties the screen.
|
||||
void refreshLiveCatalog(WidgetRef ref) {
|
||||
ref.invalidate(mobileLiveCategoriesProvider);
|
||||
ref.invalidate(mobileLiveChannelsByCategoryProvider);
|
||||
ref.invalidate(mobileLiveChannelsProvider);
|
||||
ref.read(liveCatalogRefreshedAtProvider.notifier).state = DateTime.now();
|
||||
}
|
||||
|
||||
/// Forces the whole catalogue (live, movies, series) and the EPG to reload.
|
||||
void refreshFullCatalog(WidgetRef ref) {
|
||||
refreshLiveCatalog(ref);
|
||||
ref.invalidate(mobileMoviesProvider);
|
||||
ref.invalidate(mobileSeriesCategoriesProvider);
|
||||
ref.invalidate(mobileSeriesProvider);
|
||||
ref.invalidate(mobileSeriesInfoByPlaylistProvider);
|
||||
ref.read(fullCatalogRefreshTickProvider.notifier).state++;
|
||||
}
|
||||
|
||||
/// Mobile-specific live categories provider (for Live TV category grid)
|
||||
final mobileLiveCategoriesProvider =
|
||||
FutureProvider.family<List<model.Category>, PlaylistConfig>(
|
||||
@@ -43,9 +77,9 @@ final mobileLiveCategoriesProvider =
|
||||
});
|
||||
|
||||
/// Mobile-specific live channels provider (loads channels for a specific category)
|
||||
final mobileLiveChannelsByCategoryProvider = FutureProvider.family<
|
||||
List<model.Channel>,
|
||||
(PlaylistConfig, String)>((ref, params) async {
|
||||
final mobileLiveChannelsByCategoryProvider =
|
||||
FutureProvider.family<List<model.Channel>, (PlaylistConfig, String)>(
|
||||
(ref, params) async {
|
||||
final (playlist, categoryId) = params;
|
||||
final service = await ref.watch(mobileXtreamServiceProvider(playlist).future);
|
||||
return service.getLiveChannels(categoryId);
|
||||
@@ -79,8 +113,9 @@ final mobileLiveChannelsProvider =
|
||||
|
||||
for (int batchNum = 0; batchNum < totalBatches; batchNum++) {
|
||||
int startIdx = batchNum * batchSize;
|
||||
int endIdx =
|
||||
(startIdx + batchSize < categories.length) ? startIdx + batchSize : categories.length;
|
||||
int endIdx = (startIdx + batchSize < categories.length)
|
||||
? startIdx + batchSize
|
||||
: categories.length;
|
||||
final batch = categories.sublist(startIdx, endIdx);
|
||||
|
||||
print(
|
||||
@@ -120,7 +155,8 @@ final mobileLiveChannelsProvider =
|
||||
|
||||
/// Mobile-specific movies provider
|
||||
final mobileMoviesProvider =
|
||||
FutureProvider.family<List<model.VodItem>, PlaylistConfig>((ref, playlist) async {
|
||||
FutureProvider.family<List<model.VodItem>, PlaylistConfig>(
|
||||
(ref, playlist) async {
|
||||
final service = await ref.watch(mobileXtreamServiceProvider(playlist).future);
|
||||
return service.getMoviesByCategory(""); // Fetch all or default
|
||||
});
|
||||
@@ -134,8 +170,9 @@ final mobileSeriesCategoriesProvider =
|
||||
});
|
||||
|
||||
/// Mobile-specific series pagination provider
|
||||
final mobileSeriesProvider = FutureProvider.family<List<model.Series>,
|
||||
(PlaylistConfig, String?)>((ref, params) async {
|
||||
final mobileSeriesProvider =
|
||||
FutureProvider.family<List<model.Series>, (PlaylistConfig, String?)>(
|
||||
(ref, params) async {
|
||||
final (playlist, categoryId) = params;
|
||||
final service = await ref.watch(mobileXtreamServiceProvider(playlist).future);
|
||||
return service.getSeriesPaginated(categoryId: categoryId);
|
||||
@@ -161,7 +198,8 @@ class SeriesInfoRequest {
|
||||
}
|
||||
|
||||
final mobileSeriesInfoByPlaylistProvider =
|
||||
FutureProvider.family<model.SeriesInfo?, SeriesInfoRequest>((ref, request) async {
|
||||
FutureProvider.family<model.SeriesInfo?, SeriesInfoRequest>(
|
||||
(ref, request) async {
|
||||
final service =
|
||||
await ref.watch(mobileXtreamServiceProvider(request.playlist).future);
|
||||
return service.getSeriesInfo(request.seriesId);
|
||||
|
||||
+19
-5
@@ -1,7 +1,7 @@
|
||||
name: xtremobile
|
||||
description: High-performance IPTV Android Application with Xtream Codes API
|
||||
description: High-performance IPTV application (Android, iPhone, iPad) with Xtream Codes API
|
||||
publish_to: 'none'
|
||||
version: 1.7.0+14
|
||||
version: 1.7.2+16
|
||||
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
@@ -34,6 +34,13 @@ dependencies:
|
||||
media_kit: ^1.1.11
|
||||
media_kit_video: ^1.2.5
|
||||
media_kit_libs_video: ^1.0.5
|
||||
# Épinglé : tiré par media_kit_video (^3.0.2). À partir de 3.4.2, le plugin
|
||||
# iOS utilise FlutterSceneLifeCycleDelegate / addSceneDelegate, des API
|
||||
# apparues dans Flutter 3.38, sans relever sa contrainte `flutter:` — pub le
|
||||
# sélectionne donc et la compilation Swift échoue sur le Flutter 3.35.3 des
|
||||
# workflows. 3.4.1 est la dernière version sans ces appels.
|
||||
# À relâcher le jour où les workflows passeront à Flutter >= 3.38.
|
||||
volume_controller: 3.4.1
|
||||
|
||||
# UI Components
|
||||
google_fonts: ^6.2.1
|
||||
@@ -50,7 +57,11 @@ dependencies:
|
||||
path_provider: ^2.1.5
|
||||
video_player: ^2.10.1
|
||||
wakelock_plus: ^1.2.8
|
||||
device_info_plus: ^12.3.0
|
||||
# Épinglé : la 12.4.0 appelle NSProcessInfo.isiOSAppOnVision derrière un
|
||||
# `@available(iOS 26.1, *)`, ce qui exige le SDK d'Xcode 26.1 — plus récent
|
||||
# que celui du runner macOS. 12.3.0 est la dernière version sans cet appel.
|
||||
# À relâcher le jour où le workflow iOS utilisera un Xcode >= 26.1.
|
||||
device_info_plus: 12.3.0
|
||||
shelf_router: ^1.1.4
|
||||
shelf_static: ^1.1.3
|
||||
flutter_cache_manager: ^3.4.1
|
||||
@@ -70,9 +81,12 @@ dev_dependencies:
|
||||
|
||||
flutter_launcher_icons:
|
||||
android: true
|
||||
image_path: "assets/images/app-icon.png"
|
||||
ios: true
|
||||
image_path: "assets/images/logo_xtremflow.png"
|
||||
adaptive_icon_background: "#1a1a2e"
|
||||
adaptive_icon_foreground: "assets/images/app-icon.png"
|
||||
adaptive_icon_foreground: "assets/images/logo_xtremflow.png"
|
||||
# iOS refuse une icône comportant un canal alpha.
|
||||
remove_alpha_ios: true
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Prépare le dossier ios/ pour un build iPhone / iPad.
|
||||
#
|
||||
# Le dépôt ne versionne pas le projet Xcode : il est régénéré par
|
||||
# `flutter create` au moment du build (macOS uniquement), puis adapté aux
|
||||
# besoins de l'app IPTV (flux HTTP en clair, audio en arrière-plan, iPad).
|
||||
# Si un dossier ios/ est déjà présent dans le dépôt, il est conservé tel quel
|
||||
# et seuls les réglages ci-dessous lui sont réappliqués — le script est
|
||||
# idempotent et peut être relancé sans risque.
|
||||
#
|
||||
# Usage : ./scripts/prepare_ios.sh
|
||||
set -euo pipefail
|
||||
|
||||
BUNDLE_ID="com.xtremflow.mobile" # identique à l'applicationId Android
|
||||
DISPLAY_NAME="XtremFlow"
|
||||
DEPLOYMENT_TARGET="13.0" # minimum exigé par media_kit sur iOS
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
if [ "$(uname -s)" != "Darwin" ]; then
|
||||
echo "::error::Un build iOS ne peut être préparé que sur macOS (Xcode requis)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PBXPROJ="ios/Runner.xcodeproj/project.pbxproj"
|
||||
PLIST="ios/Runner/Info.plist"
|
||||
PODFILE="ios/Podfile"
|
||||
PLISTBUDDY=/usr/libexec/PlistBuddy
|
||||
|
||||
if [ ! -d "ios/Runner.xcodeproj" ]; then
|
||||
echo "==> Aucun dossier ios/ : génération du projet Xcode"
|
||||
# Garde-fou : `flutter create` ne doit recréer que la plateforme iOS. Si une
|
||||
# version de l'outil venait à réécrire le point d'entrée de l'app, on le
|
||||
# restaure — un main.dart écrasé produirait un IPA contenant le compteur
|
||||
# d'exemple de Flutter, sans que le build échoue.
|
||||
MAIN_BACKUP="$(mktemp)"
|
||||
cp lib/main.dart "$MAIN_BACKUP"
|
||||
flutter create --platforms=ios --org com.xtremflow --project-name xtremobile .
|
||||
if ! cmp -s lib/main.dart "$MAIN_BACKUP"; then
|
||||
echo "==> lib/main.dart réécrit par flutter create : restauration"
|
||||
cp "$MAIN_BACKUP" lib/main.dart
|
||||
fi
|
||||
rm -f "$MAIN_BACKUP"
|
||||
# `flutter create --org com.xtremflow` écrit com.xtremflow.xtremobile ; on
|
||||
# aligne sur l'applicationId Android (la cible RunnerTests suit le suffixe).
|
||||
sed -i '' "s/com\.xtremflow\.xtremobile/${BUNDLE_ID}/g" "$PBXPROJ"
|
||||
else
|
||||
echo "==> Dossier ios/ déjà présent : génération ignorée"
|
||||
fi
|
||||
|
||||
echo "==> Cible de déploiement : iOS ${DEPLOYMENT_TARGET}"
|
||||
perl -pi -e "s/IPHONEOS_DEPLOYMENT_TARGET = [0-9.]+;/IPHONEOS_DEPLOYMENT_TARGET = ${DEPLOYMENT_TARGET};/g" "$PBXPROJ"
|
||||
perl -pi -e "s/^#?\s*platform :ios.*/platform :ios, '${DEPLOYMENT_TARGET}'/" "$PODFILE"
|
||||
|
||||
# Les pods (dont libmpv de media_kit) doivent viser la même version qu'ici,
|
||||
# sinon CocoaPods refuse la résolution. Ajouté une seule fois.
|
||||
if ! grep -q "IPHONEOS_DEPLOYMENT_TARGET" "$PODFILE"; then
|
||||
perl -0pi -e "s/(flutter_additional_ios_build_settings\(target\))/\$1\n target.build_configurations.each do |config|\n config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '${DEPLOYMENT_TARGET}'\n end/" "$PODFILE"
|
||||
fi
|
||||
|
||||
echo "==> Info.plist"
|
||||
|
||||
plist_set() { # clé, type, valeur
|
||||
$PLISTBUDDY -c "Set :$1 $3" "$PLIST" 2>/dev/null || $PLISTBUDDY -c "Add :$1 $2 $3" "$PLIST"
|
||||
}
|
||||
plist_reset() { # supprime une clé composite avant de la reconstruire
|
||||
$PLISTBUDDY -c "Delete :$1" "$PLIST" 2>/dev/null || true
|
||||
}
|
||||
|
||||
plist_set CFBundleDisplayName string "$DISPLAY_NAME"
|
||||
plist_set CFBundleName string "$DISPLAY_NAME"
|
||||
|
||||
# Les serveurs Xtream Codes sont très souvent en http:// simple : sans cette
|
||||
# exception, App Transport Security bloque toutes les requêtes et tous les
|
||||
# flux vidéo, sans message d'erreur exploitable côté Dart.
|
||||
plist_reset NSAppTransportSecurity
|
||||
$PLISTBUDDY -c "Add :NSAppTransportSecurity dict" "$PLIST"
|
||||
$PLISTBUDDY -c "Add :NSAppTransportSecurity:NSAllowsArbitraryLoads bool true" "$PLIST"
|
||||
|
||||
# Lecture audio quand l'écran est verrouillé / l'app en arrière-plan.
|
||||
plist_reset UIBackgroundModes
|
||||
$PLISTBUDDY -c "Add :UIBackgroundModes array" "$PLIST"
|
||||
$PLISTBUDDY -c "Add :UIBackgroundModes:0 string audio" "$PLIST"
|
||||
|
||||
# Un serveur Xtream hébergé sur le réseau local déclenche la demande
|
||||
# d'autorisation « réseau local » d'iOS 14+ ; sans description, elle est refusée.
|
||||
plist_set NSLocalNetworkUsageDescription string "Nécessaire pour joindre un serveur IPTV hébergé sur votre réseau local."
|
||||
|
||||
# Orientations : paysage indispensable pour le lecteur, les quatre sens sur iPad.
|
||||
plist_reset UISupportedInterfaceOrientations
|
||||
$PLISTBUDDY -c "Add :UISupportedInterfaceOrientations array" "$PLIST"
|
||||
i=0
|
||||
for o in UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight; do
|
||||
$PLISTBUDDY -c "Add :UISupportedInterfaceOrientations:$i string $o" "$PLIST"
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
plist_reset "UISupportedInterfaceOrientations~ipad"
|
||||
$PLISTBUDDY -c "Add :UISupportedInterfaceOrientations~ipad array" "$PLIST"
|
||||
i=0
|
||||
for o in UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown \
|
||||
UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight; do
|
||||
$PLISTBUDDY -c "Add :UISupportedInterfaceOrientations~ipad:$i string $o" "$PLIST"
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
echo "==> Projet iOS prêt (bundle id : ${BUNDLE_ID})"
|
||||
Reference in new issue
Block a user