π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Revert "Zoom image sliding bug (#1523)"
ashilkn8e73fb3c399b
diff --git a/android/.gitignore b/android/.gitignoreindex f12b17c551..bc2100d8f7 100644--- a/android/.gitignore+++ b/android/.gitignore@@ -5,6 +5,3 @@ gradle-wrapper.jar/gradlew.bat/local.propertiesGeneratedPluginRegistrant.java--# Signing config files-*.jks\ No newline at end of filediff --git a/lib/ui/viewer/file/detail_page.dart b/lib/ui/viewer/file/detail_page.dartindex 46db449c58..779243c27b 100644--- a/lib/ui/viewer/file/detail_page.dart+++ b/lib/ui/viewer/file/detail_page.dart@@ -73,6 +73,7 @@ class DetailPage extends StatefulWidget {class _DetailPageState extends State<DetailPage> {static const kLoadLimit = 100;final _logger = Logger("DetailPageState");+ bool _shouldDisableScroll = false;List<EnteFile>? _files;late PageController _pageController;final _selectedIndexNotifier = ValueNotifier(0);@@ -171,6 +172,14 @@ class _DetailPageState extends State<DetailPage> {file,autoPlay: shouldAutoPlay(),tagPrefix: widget.config.tagPrefix,+ shouldDisableScroll: (value) {+ if (_shouldDisableScroll != value) {+ setState(() {+ _logger.fine('setState $_shouldDisableScroll to $value');+ _shouldDisableScroll = value;+ });+ }+ },playbackCallback: (isPlaying) {Future.delayed(Duration.zero, () {_toggleFullScreen(shouldEnable: isPlaying);@@ -199,7 +208,9 @@ class _DetailPageState extends State<DetailPage> {}_preloadEntries();},- physics: const FastScrollPhysics(speedFactor: 4.0),+ physics: _shouldDisableScroll+ ? const NeverScrollableScrollPhysics()+ : const FastScrollPhysics(speedFactor: 4.0),controller: _pageController,itemCount: _files!.length,);diff --git a/lib/ui/viewer/file/file_widget.dart b/lib/ui/viewer/file/file_widget.dartindex 754cb1a678..6e6dcc7f17 100644--- a/lib/ui/viewer/file/file_widget.dart+++ b/lib/ui/viewer/file/file_widget.dart@@ -8,6 +8,7 @@ import "package:photos/ui/viewer/file/zoomable_live_image_new.dart";class FileWidget extends StatelessWidget {final EnteFile file;final String? tagPrefix;+ final Function(bool)? shouldDisableScroll;final Function(bool)? playbackCallback;final BoxDecoration? backgroundDecoration;final bool? autoPlay;@@ -15,6 +16,7 @@ class FileWidget extends StatelessWidget {const FileWidget(this.file, {this.autoPlay,+ this.shouldDisableScroll,this.playbackCallback,this.tagPrefix,this.backgroundDecoration,@@ -30,6 +32,7 @@ class FileWidget extends StatelessWidget {file.fileType == FileType.image) {return ZoomableLiveImageNew(file,+ shouldDisableScroll: shouldDisableScroll,tagPrefix: tagPrefix,backgroundDecoration: backgroundDecoration,key: key ?? ValueKey(fileKey),diff --git a/lib/ui/viewer/file/zoomable_image.dart b/lib/ui/viewer/file/zoomable_image.dartindex 66a60e719b..4186b1d510 100644--- a/lib/ui/viewer/file/zoomable_image.dart+++ b/lib/ui/viewer/file/zoomable_image.dart@@ -25,6 +25,7 @@ import 'package:photos/utils/thumbnail_util.dart';class ZoomableImage extends StatefulWidget {final EnteFile photo;+ final Function(bool)? shouldDisableScroll;final String? tagPrefix;final Decoration? backgroundDecoration;final bool shouldCover;@@ -32,6 +33,7 @@ class ZoomableImage extends StatefulWidget {const ZoomableImage(this.photo, {Key? key,+ this.shouldDisableScroll,required this.tagPrefix,this.backgroundDecoration,this.shouldCover = false,@@ -51,14 +53,23 @@ class _ZoomableImageState extends State<ZoomableImage>bool _loadedLargeThumbnail = false;bool _loadingFinalImage = false;bool _loadedFinalImage = false;+ ValueChanged<PhotoViewScaleState>? _scaleStateChangedCallback;+ bool _isZooming = false;PhotoViewController _photoViewController = PhotoViewController();- double? _initialScale;@overridevoid initState() {_photo = widget.photo;_logger = Logger("ZoomableImage");_logger.info('initState for ${_photo.generatedID} with tag ${_photo.tag}');+ _scaleStateChangedCallback = (value) {+ if (widget.shouldDisableScroll != null) {+ widget.shouldDisableScroll!(value != PhotoViewScaleState.initial);+ }+ _isZooming = value != PhotoViewScaleState.initial;+ debugPrint("isZooming = $_isZooming, currentState $value");+ // _logger.info('is reakky zooming $_isZooming with state $value');+ };super.initState();}@@ -80,6 +91,7 @@ class _ZoomableImageState extends State<ZoomableImage>if (_imageProvider != null) {content = PhotoViewGallery.builder(gaplessPlayback: true,+ scaleStateChangedCallback: _scaleStateChangedCallback,backgroundDecoration: widget.backgroundDecoration as BoxDecoration?,builder: (context, index) {return PhotoViewGalleryPageOptions(@@ -99,24 +111,21 @@ class _ZoomableImageState extends State<ZoomableImage>content = const EnteLoadingWidget();}- dragFunction(d) => {- if (d.delta.dy > dragSensitivity)- {- {Navigator.of(context).pop()},- }- else if (d.delta.dy < (dragSensitivity * -1))- {- showDetailsSheet(context, widget.photo),- },- };-- verticalDragCallback(d) {- if (_initialScale == null ||- _photoViewController.scale! <= _initialScale!) {- dragFunction(d);- }- }-+ final GestureDragUpdateCallback? verticalDragCallback = _isZooming+ ? null+ : (d) => {+ if (!_isZooming)+ {+ if (d.delta.dy > dragSensitivity)+ {+ {Navigator.of(context).pop()},+ }+ else if (d.delta.dy < (dragSensitivity * -1))+ {+ showDetailsSheet(context, widget.photo),+ },+ },+ };return GestureDetector(onVerticalDragUpdate: verticalDragCallback,child: content,@@ -257,8 +266,9 @@ class _ZoomableImageState extends State<ZoomableImage>required ImageProvider? previewImageProvider,required ImageProvider finalImageProvider,}) async {- final bool shouldFixPosition =- previewImageProvider != null && _photoViewController.scale != null;+ final bool shouldFixPosition = previewImageProvider != null &&+ _isZooming &&+ _photoViewController.scale != null;ImageInfo? finalImageInfo;if (shouldFixPosition) {final prevImageInfo = await getImageInfo(previewImageProvider);@@ -275,9 +285,6 @@ class _ZoomableImageState extends State<ZoomableImage>initialPosition: newPosition,initialScale: scale,);- setState(() {- _initialScale = scale;- });}final bool canUpdateMetadata = _photo.canEditMetaInfo;// forcefully get finalImageInfo is dimensions are not available in metadatadiff --git a/lib/ui/viewer/file/zoomable_live_image.dart b/lib/ui/viewer/file/zoomable_live_image.dartindex 28564f673e..f7e2aa55af 100644--- a/lib/ui/viewer/file/zoomable_live_image.dart+++ b/lib/ui/viewer/file/zoomable_live_image.dart@@ -16,12 +16,14 @@ import 'package:video_player/video_player.dart';class ZoomableLiveImage extends StatefulWidget {final EnteFile enteFile;+ final Function(bool)? shouldDisableScroll;final String? tagPrefix;final Decoration? backgroundDecoration;const ZoomableLiveImage(this.enteFile, {Key? key,+ this.shouldDisableScroll,required this.tagPrefix,this.backgroundDecoration,}) : super(key: key);@@ -43,9 +45,8 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>@overridevoid initState() {_enteFile = widget.enteFile;- _logger.info(- 'initState for ${_enteFile.generatedID} with tag ${_enteFile.tag} and name ${_enteFile.displayName}',- );+ _logger.info('initState for ${_enteFile.generatedID} with tag ${_enteFile+ .tag} and name ${_enteFile.displayName}');super.initState();}@@ -75,6 +76,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>content = ZoomableImage(_enteFile,tagPrefix: widget.tagPrefix,+ shouldDisableScroll: widget.shouldDisableScroll,backgroundDecoration: widget.backgroundDecoration,);}@@ -136,8 +138,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>}Future<File?> _getLivePhotoVideo() async {- if (_enteFile.isRemoteFile &&- !(await isFileCached(_enteFile, liveVideo: true))) {+ if (_enteFile.isRemoteFile && !(await isFileCached(_enteFile, liveVideo: true))) {showShortToast(context, S.of(context).downloading);}@@ -205,4 +206,5 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>}});}+}diff --git a/lib/ui/viewer/file/zoomable_live_image_new.dart b/lib/ui/viewer/file/zoomable_live_image_new.dartindex 73a7f629b7..598ae60e02 100644--- a/lib/ui/viewer/file/zoomable_live_image_new.dart+++ b/lib/ui/viewer/file/zoomable_live_image_new.dart@@ -17,12 +17,14 @@ import 'package:photos/utils/toast_util.dart';class ZoomableLiveImageNew extends StatefulWidget {final EnteFile enteFile;+ final Function(bool)? shouldDisableScroll;final String? tagPrefix;final Decoration? backgroundDecoration;const ZoomableLiveImageNew(this.enteFile, {Key? key,+ this.shouldDisableScroll,required this.tagPrefix,this.backgroundDecoration,}) : super(key: key);@@ -79,6 +81,7 @@ class _ZoomableLiveImageNewState extends State<ZoomableLiveImageNew>content = ZoomableImage(_enteFile,tagPrefix: widget.tagPrefix,+ shouldDisableScroll: widget.shouldDisableScroll,backgroundDecoration: widget.backgroundDecoration,);}