Integrazione YouTube Live: OAuth squadra, canale piattaforma Light e UI.

Collegamento da Dettagli squadra e admin per il refresh token Match Live TV; API e app mobile allineate ai piani Light/Full.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-02 19:36:56 +02:00
parent 1a84d6ae42
commit 994c1e3c09
28 changed files with 557 additions and 28 deletions

View File

@@ -76,25 +76,52 @@ class _StepTransmissionState extends ConsumerState<StepTransmission> {
void _onYoutubeTap(Team? team) {
if (team == null) return;
if (team.canUseYoutube && team.youtubeConnected) {
if (team.isYoutubeReady) {
setState(() => _platform = 'youtube');
return;
}
if (team.canUseYoutube && !team.youtubeConnected) {
if (team.canUseYoutube && team.youtubeMode == 'team') {
showPremiumRequiredDialog(
context,
message: 'Collega il canale YouTube dalla dashboard sul sito, poi seleziona YouTube qui.',
billingUrl: team.billingUrl,
message: 'Collega il canale YouTube dalla pagina Dettagli squadra sul sito, poi seleziona YouTube qui.',
billingUrl: team.staffManageUrl ?? team.billingUrl,
);
return;
}
if (team.canUseYoutube && team.youtubeMode == 'matchlivetv_light') {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text(
'YouTube sul canale Match Live TV non è ancora attivo. Riprova più tardi o usa Match Live TV.',
),
),
);
return;
}
showPremiumRequiredDialog(
context,
message: 'YouTube Live è incluso nel piano Premium Full.',
message: 'YouTube Live richiede Premium Light o Full.',
billingUrl: team.billingUrl,
);
}
String _youtubeSubtitle(Team? team) {
if (team == null || !team.canUseYoutube) {
return 'Premium Light o Full';
}
if (team.isYoutubeReady) {
final label = team.youtubeChannelTitle;
if (team.youtubeUsesPlatformChannel) {
return label != null ? 'Canale $label' : 'Canale Match Live TV';
}
return label != null ? 'Canale $label' : 'Canale collegato';
}
if (team.youtubeMode == 'matchlivetv_light') {
return 'Canale Match Live TV (in attivazione)';
}
return 'Collega canale sul sito';
}
void _onExternalPremiumTap(String platform, Team? team) {
showPremiumRequiredDialog(
context,
@@ -112,7 +139,7 @@ class _StepTransmissionState extends ConsumerState<StepTransmission> {
loading: () => const Center(child: CircularProgressIndicator(color: AppTheme.primaryRed)),
error: (_, __) => const Center(child: Text('Errore caricamento squadra')),
data: (team) {
final youtubeSelectable = team != null && team.canUseYoutube && team.youtubeConnected;
final youtubeSelectable = team != null && team.isYoutubeReady;
return SingleChildScrollView(
padding: ScreenInsets.contentPadding(context, horizontal: 20, vertical: 12),
@@ -147,14 +174,10 @@ class _StepTransmissionState extends ConsumerState<StepTransmission> {
const SizedBox(height: 8),
_PlatformCard(
title: 'YouTube Live',
subtitle: team?.canUseYoutube == true
? (team!.youtubeConnected
? 'Canale collegato'
: 'Collega canale sul sito')
: 'Premium Full — collegamento canale',
subtitle: _youtubeSubtitle(team),
selected: _platform == 'youtube',
enabled: youtubeSelectable,
badge: team?.canUseYoutube == true ? null : 'Full',
badge: team?.canUseYoutube == true ? null : 'Premium',
onTap: () => _onYoutubeTap(team),
),
const SizedBox(height: 8),