App: scelta canale YouTube MLTV/società, privacy e condivisione link.
Premium Full può forzare il canale piattaforma; visibilità non in elenco o privato; share_url unificato per Match Live TV e YouTube. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
54
mobile/lib/shared/watch_share.dart
Normal file
54
mobile/lib/shared/watch_share.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import 'models/stream_session.dart';
|
||||
|
||||
String? watchShareUrl(StreamSession session) {
|
||||
return session.shareUrl ?? session.youtubeWatchUrl ?? session.watchPageUrl;
|
||||
}
|
||||
|
||||
String watchShareLabel(StreamSession session) {
|
||||
if (session.platform == 'youtube') {
|
||||
return 'Guarda la diretta su YouTube';
|
||||
}
|
||||
return 'Guarda la diretta su Match Live TV';
|
||||
}
|
||||
|
||||
Future<void> shareWatchLink(
|
||||
BuildContext context, {
|
||||
required StreamSession session,
|
||||
required String title,
|
||||
}) async {
|
||||
final url = watchShareUrl(session);
|
||||
if (url == null || url.isEmpty) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Link diretta non ancora disponibile')),
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
await Share.share(
|
||||
'${watchShareLabel(session)}:\n$url',
|
||||
subject: title,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> copyWatchLink(BuildContext context, StreamSession session) async {
|
||||
final url = watchShareUrl(session);
|
||||
if (url == null || url.isEmpty) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Link diretta non ancora disponibile')),
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
await Clipboard.setData(ClipboardData(text: url));
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Link copiato')),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user