瀏覽代碼

[mob] Disable auto-cast for iOS (#1633)

## Description

## Tests
Tested on sim
Neeraj Gupta 1 年之前
父節點
當前提交
a39e6b54cc
共有 2 個文件被更改,包括 29 次插入25 次删除
  1. 1 1
      mobile/ios/Runner/Info.plist
  2. 28 24
      mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart

+ 1 - 1
mobile/ios/Runner/Info.plist

@@ -108,7 +108,7 @@
 		<key>NSBonjourServices</key>
                 <array>
                   <string>_googlecast._tcp</string>
-                  <string>F5BCEC64._googlecast._tcp</string>
+                  <string>_F5BCEC64._googlecast._tcp</string>
                 </array>
 
                 <key>NSLocalNetworkUsageDescription</key>

+ 28 - 24
mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart

@@ -738,34 +738,38 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
 
     // stop any existing cast session
     gw.revokeAllTokens().ignore();
-    final result = await showDialog<ButtonAction?>(
-      context: context,
-      barrierDismissible: true,
-      builder: (BuildContext context) {
-        return const CastChooseDialog();
-      },
-    );
-    if (result == null) {
-      return;
-    }
-    // wait to allow the dialog to close
-    await Future.delayed(const Duration(milliseconds: 100));
-    if (result == ButtonAction.first) {
-      await showDialog(
+    if (!Platform.isAndroid) {
+      await _pairWithPin(gw, '');
+    } else {
+      final result = await showDialog<ButtonAction?>(
         context: context,
         barrierDismissible: true,
-        builder: (BuildContext bContext) {
-          return AutoCastDialog(
-            (device) async {
-              await _castPair(bContext, gw, device);
-              Navigator.pop(bContext);
-            },
-          );
+        builder: (BuildContext context) {
+          return const CastChooseDialog();
         },
       );
-    }
-    if (result == ButtonAction.second) {
-      await _pairWithPin(gw, '');
+      if (result == null) {
+        return;
+      }
+      // wait to allow the dialog to close
+      await Future.delayed(const Duration(milliseconds: 100));
+      if (result == ButtonAction.first) {
+        await showDialog(
+          context: context,
+          barrierDismissible: true,
+          builder: (BuildContext bContext) {
+            return AutoCastDialog(
+              (device) async {
+                await _castPair(bContext, gw, device);
+                Navigator.pop(bContext);
+              },
+            );
+          },
+        );
+      }
+      if (result == ButtonAction.second) {
+        await _pairWithPin(gw, '');
+      }
     }
   }