|
@@ -26,6 +26,7 @@ import 'package:photos/services/update_service.dart';
|
|
|
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
|
|
|
import 'package:photos/ui/components/action_sheet_widget.dart';
|
|
|
import 'package:photos/ui/components/buttons/button_widget.dart';
|
|
|
+import "package:photos/ui/components/dialog_widget.dart";
|
|
|
import 'package:photos/ui/components/models/button_type.dart';
|
|
|
import "package:photos/ui/map/enable_map.dart";
|
|
|
import "package:photos/ui/map/map_screen.dart";
|
|
@@ -892,6 +893,59 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
|
|
final gw = CastGateway(NetworkClient.instance.enteDio);
|
|
|
// stop any existing cast session
|
|
|
gw.revokeAllTokens().ignore();
|
|
|
+ final result = await showDialogWidget(
|
|
|
+ context: context,
|
|
|
+ title: S.of(context).playOnTv,
|
|
|
+ body:
|
|
|
+ "Auto Pair requires connecting to Google servers and only works with Chromecast supported devices. Google will not receive sensitive data, such as your photos.\n\nPair with PIN works for any large screen device you want to play your album on.",
|
|
|
+ buttons: [
|
|
|
+ ButtonWidget(
|
|
|
+ labelText: S.of(context).autoPair,
|
|
|
+ icon: Icons.cast_outlined,
|
|
|
+ buttonType: ButtonType.trailingIconPrimary,
|
|
|
+ buttonSize: ButtonSize.large,
|
|
|
+ shouldStickToDarkTheme: true,
|
|
|
+ buttonAction: ButtonAction.first,
|
|
|
+ shouldSurfaceExecutionStates: true,
|
|
|
+ isInAlert: true,
|
|
|
+ onTap: () async {
|
|
|
+ showToast(context, "Coming soon");
|
|
|
+ // await _castAlbum(gw);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ButtonWidget(
|
|
|
+ labelText: S.of(context).pairWithPin,
|
|
|
+ buttonType: ButtonType.trailingIconPrimary,
|
|
|
+ // icon for pairing with TV manually
|
|
|
+ icon: Icons.tv_outlined,
|
|
|
+ buttonSize: ButtonSize.large,
|
|
|
+ isInAlert: true,
|
|
|
+ shouldStickToDarkTheme: true,
|
|
|
+ buttonAction: ButtonAction.second,
|
|
|
+ shouldSurfaceExecutionStates: false,
|
|
|
+ ),
|
|
|
+ // cancel button
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ _logger.info("Cast result: $result");
|
|
|
+ if (result == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (result.action == ButtonAction.error) {
|
|
|
+ await showGenericErrorDialog(
|
|
|
+ context: context,
|
|
|
+ error: result.exception,
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (result.action == ButtonAction.first) {
|
|
|
+ showToast(context, "Coming soon");
|
|
|
+ }
|
|
|
+ if (result.action == ButtonAction.second) {
|
|
|
+ await _pairWithPin(gw);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Future<void> _pairWithPin(CastGateway gw) async {
|
|
|
await showTextInputDialog(
|
|
|
context,
|
|
|
title: context.l10n.playOnTv,
|