Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Add hook to show cast devices

Neeraj Guptaf645fff31c53
diff --git a/mobile/ios/Runner/Info.plist b/mobile/ios/Runner/Info.plist
index 037996520e..cdbc237749 100644
--- a/mobile/ios/Runner/Info.plist
+++ b/mobile/ios/Runner/Info.plist
@@ -105,5 +105,14 @@
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
+ <key>NSBonjourServices</key>
+ <array>
+ <string>_googlecast._tcp</string>
+ <string>F5BCEC64._googlecast._tcp</string>
+ </array>
+
+ <key>NSLocalNetworkUsageDescription</key>
+ <string>${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi
+ network.</string>
</dict>
</plist>
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 1026bd7fd4..aa09e49b29 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<GalleryAppBarWidget> {
),
);
}
+ if (widget.collection != null) {
+ actions.add(castWidget(context));
+ }
if (items.isNotEmpty) {
actions.add(
PopupMenuButton(
@@ -642,6 +647,39 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
return actions;
}
+ Widget castWidget(BuildContext context) {
+ return FutureBuilder<List<CastDevice>>(
+ 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<void> _connectToYourApp(
+ BuildContext contect, CastDevice device,) async {}
+
Future<void> onCleanUncategorizedClick(BuildContext buildContext) async {
final actionResult = await showChoiceActionSheet(
context,