diff --git a/mobile/ios/Runner/Info.plist b/mobile/ios/Runner/Info.plist index 037996520..cdbc23774 100644 --- a/mobile/ios/Runner/Info.plist +++ b/mobile/ios/Runner/Info.plist @@ -105,5 +105,14 @@ UIApplicationSupportsIndirectInputEvents + NSBonjourServices + + _googlecast._tcp + F5BCEC64._googlecast._tcp + + + NSLocalNetworkUsageDescription + ${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi + network. diff --git a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart index 1026bd7fd..aa09e49b2 100644 --- a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart +++ b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart @@ -2,6 +2,8 @@ import 'dart:async'; import 'dart:io'; import 'dart:math' as math; +import "package:cast/device.dart"; +import "package:cast/discovery_service.dart"; import "package:flutter/cupertino.dart"; import 'package:flutter/material.dart'; import 'package:logging/logging.dart'; @@ -576,6 +578,9 @@ class _GalleryAppBarWidgetState extends State { ), ); } + if (widget.collection != null) { + actions.add(castWidget(context)); + } if (items.isNotEmpty) { actions.add( PopupMenuButton( @@ -642,6 +647,39 @@ class _GalleryAppBarWidgetState extends State { return actions; } + Widget castWidget(BuildContext context) { + return FutureBuilder>( + future: CastDiscoveryService().search(), + builder: (context, snapshot) { + if (snapshot.hasError) { + return Center( + child: Text( + 'Error: ${snapshot.error.toString()}', + ), + ); + } else if (!snapshot.hasData) { + return const Center( + child: CircularProgressIndicator(), + ); + } + + if (snapshot.data!.isEmpty) { + return const Text('No device'); + } + + return Column( + children: snapshot.data!.map((device) { + return Text(device.name); + + }).toList(), + ); + }, + ); + } + + Future _connectToYourApp( + BuildContext contect, CastDevice device,) async {} + Future onCleanUncategorizedClick(BuildContext buildContext) async { final actionResult = await showChoiceActionSheet( context,