π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Ignore hidden gallery scrollbar hit targets
ashil-pilota244ce3f8c17
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/scroll_bar_with_use_notifier.dart b/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/scroll_bar_with_use_notifier.dartindex 03ee439862..a02d4d071d 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/scroll_bar_with_use_notifier.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/scroll_bar_with_use_notifier.dart@@ -291,8 +291,9 @@ class _MaterialScrollbarState extends RawScrollbarState<_MaterialScrollbar> {@overridevoid updateScrollbarPainter() {+ final thumbColor = _thumbColor.resolve(_states);scrollbarPainter- ..color = _thumbColor.resolve(_states)+ ..color = thumbColor..trackColor = _trackColor.resolve(_states)..trackBorderColor = _trackBorderColor.resolve(_states)..textDirection = Directionality.of(context)@@ -308,7 +309,7 @@ class _MaterialScrollbarState extends RawScrollbarState<_MaterialScrollbar> {..minLength = widget.minScrollbarLength..padding = widget.scrollbarPadding ?? MediaQuery.paddingOf(context)..scrollbarOrientation = widget.scrollbarOrientation- ..ignorePointer = !enableGestures;+ ..ignorePointer = !enableGestures || thumbColor.a == 0;}@override@@ -387,7 +388,7 @@ class _ThumbTargetScrollbarPainter extends ScrollbarPainter {if (super.hitTestOnlyThumbInteractive(position, kind)) {return true;}- if (kind != PointerDeviceKind.touch || color.a == 0) {+ if (kind != PointerDeviceKind.touch) {return false;}final orientation =diff --git a/mobile/apps/photos/test/ui/viewer/gallery/scroll_bar_with_use_notifier_test.dart b/mobile/apps/photos/test/ui/viewer/gallery/scroll_bar_with_use_notifier_test.dartindex 425312fef2..5bfeb15db3 100644--- a/mobile/apps/photos/test/ui/viewer/gallery/scroll_bar_with_use_notifier_test.dart+++ b/mobile/apps/photos/test/ui/viewer/gallery/scroll_bar_with_use_notifier_test.dart@@ -22,6 +22,8 @@ void main() {WidgetTester tester, {VoidCallback? onPhotoTap,bool thumbVisibility = true,+ bool? showThumb,+ double contentHeight = 12000,TextDirection textDirection = TextDirection.ltr,}) async {await tester.pumpWidget(@@ -39,6 +41,7 @@ void main() {inUseNotifier: inUseNotifier,interactive: true,thumbVisibility: thumbVisibility,+ showThumb: showThumb,minScrollbarLength: 36,thickness: 8,scrollbarPadding: const EdgeInsets.only(right: 3),@@ -47,7 +50,7 @@ void main() {child: GestureDetector(behavior: HitTestBehavior.opaque,onTap: onPhotoTap,- child: const SizedBox(height: 12000, width: 400),+ child: SizedBox(height: contentHeight, width: 400),),),),@@ -101,6 +104,41 @@ void main() {},);+ testWidgets("hidden thumb leaves short-gallery taps and swipes alone", (+ tester,+ ) async {+ var photoTaps = 0;+ await pumpScrollbar(+ tester,+ thumbVisibility: false,+ showThumb: false,+ contentHeight: 1500,+ onPhotoTap: () => photoTaps++,+ );+ controller.jumpTo(300);+ await tester.pump();+ await tester.pump(const Duration(seconds: 1));+ expect(painter(tester).fadeoutOpacityAnimation.value, 1);+ expect(painter(tester).color.a, 0);++ final gesture = await tester.startGesture(const Offset(392, 240));+ await gesture.moveBy(const Offset(0, -20));+ await tester.pump();+ await gesture.moveBy(const Offset(0, -60));+ await tester.pump();+ expect(inUseNotifier.value, isFalse);+ expect(controller.offset, greaterThan(300));+ await gesture.up();+ await tester.pumpAndSettle();++ controller.jumpTo(300);+ await tester.pump();+ await tester.pump(const Duration(milliseconds: 300));+ await tester.tapAt(const Offset(392, 240));+ await tester.pump();+ expect(photoTaps, 1);+ });+testWidgets("inward target follows the thumb and keeps an acquired drag",(tester) async {