π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob] Fix cast button refresh state
Neeraj Gupta06e43bf276f0
diff --git a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dartindex 4a3d9450ac..3ca2f6c2a4 100644--- a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart+++ b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart@@ -93,6 +93,8 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {late bool isInternalUser;late GalleryType galleryType;+ final ValueNotifier<int> castNotifier = ValueNotifier<int>(0);+@overridevoid initState() {super.initState();@@ -328,14 +330,16 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {Tooltip(message: "Cast album",child: IconButton(- icon: castService.getActiveSessions().isNotEmpty- ? const Icon(Icons.cast_connected_rounded)- : const Icon(Icons.cast_outlined),+ icon: ValueListenableBuilder<int>(+ valueListenable: castNotifier,+ builder: (context, value, child) {+ return castService.getActiveSessions().isNotEmpty+ ? const Icon(Icons.cast_connected_rounded)+ : const Icon(Icons.cast_outlined);+ },+ ),onPressed: () async {await _castChoiceDialog();- if (mounted) {- setState(() {});- }},),),@@ -728,6 +732,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {await castService.closeActiveCasts();},);+ castNotifier.value++;return;}@@ -785,7 +790,10 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {String lastCode = '';Future<bool> _castPair(- BuildContext bContext, CastGateway gw, String code) async {+ BuildContext bContext,+ CastGateway gw,+ String code,+ ) async {try {if (lastCode == code) {return false;@@ -810,6 +818,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {);_logger.info("Casted album with token $castToken");// showToast(bContext, S.of(context).pairingComplete);+ castNotifier.value++;return true;} catch (e, s) {lastCode = '';@@ -823,6 +832,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {} else {await showGenericErrorDialog(context: bContext, error: e);}+ castNotifier.value++;return false;}}