From 02e4b81db72ed57cf0e3688499cd15c4474a307b Mon Sep 17 00:00:00 2001 From: Michael Stromer Date: Wed, 7 Aug 2024 12:10:28 -0400 Subject: [PATCH 1/9] Update YPLibraryView.swift --- Source/Pages/Gallery/YPLibraryView.swift | 40 ++++++++++++++++-------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/Source/Pages/Gallery/YPLibraryView.swift b/Source/Pages/Gallery/YPLibraryView.swift index 916e29c6..b29ca87f 100644 --- a/Source/Pages/Gallery/YPLibraryView.swift +++ b/Source/Pages/Gallery/YPLibraryView.swift @@ -234,20 +234,34 @@ internal final class YPLibraryView: UIView { // MARK: - Private Methods private func setupLayout() { - subviews( - collectionContainerView.subviews( - collectionView - ), - YPConfig.showsLibraryButtonInTitle ? UIView() : showAlbumsButton, - line, - assetViewContainer.subviews( - assetZoomableView - ), - progressView, - maxNumberWarningView.subviews( - maxNumberWarningLabel + if YPConfig.library.isBulkUploading { + subviews( + collectionContainerView.subviews( + collectionView + ), + YPConfig.showsLibraryButtonInTitle ? UIView() : showAlbumsButton, + line, + progressView, + maxNumberWarningView.subviews( + maxNumberWarningLabel + ) ) - ) + } else { + subviews( + collectionContainerView.subviews( + collectionView + ), + YPConfig.showsLibraryButtonInTitle ? UIView() : showAlbumsButton, + line, + assetViewContainer.subviews( + assetZoomableView + ), + progressView, + maxNumberWarningView.subviews( + maxNumberWarningLabel + ) + ) + } collectionContainerView.fillContainer() collectionView.fillHorizontally().bottom(0) From a17aff0110f7a2866d0feac232d303f41aa452a7 Mon Sep 17 00:00:00 2001 From: Michael Stromer Date: Wed, 7 Aug 2024 12:15:08 -0400 Subject: [PATCH 2/9] Update YPLibraryView.swift --- Source/Pages/Gallery/YPLibraryView.swift | 40 ++++++++---------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/Source/Pages/Gallery/YPLibraryView.swift b/Source/Pages/Gallery/YPLibraryView.swift index b29ca87f..c0624ce1 100644 --- a/Source/Pages/Gallery/YPLibraryView.swift +++ b/Source/Pages/Gallery/YPLibraryView.swift @@ -234,34 +234,20 @@ internal final class YPLibraryView: UIView { // MARK: - Private Methods private func setupLayout() { - if YPConfig.library.isBulkUploading { - subviews( - collectionContainerView.subviews( - collectionView - ), - YPConfig.showsLibraryButtonInTitle ? UIView() : showAlbumsButton, - line, - progressView, - maxNumberWarningView.subviews( - maxNumberWarningLabel - ) - ) - } else { - subviews( - collectionContainerView.subviews( - collectionView - ), - YPConfig.showsLibraryButtonInTitle ? UIView() : showAlbumsButton, - line, - assetViewContainer.subviews( - assetZoomableView - ), - progressView, - maxNumberWarningView.subviews( - maxNumberWarningLabel - ) + subviews( + collectionContainerView.subviews( + collectionView + ), + YPConfig.showsLibraryButtonInTitle ? UIView() : showAlbumsButton, + line, + assetViewContainer.subviews( + YPConfig.library.isBulkUploading ? UIView() : assetZoomableView + ), + progressView, + maxNumberWarningView.subviews( + maxNumberWarningLabel ) - } + ) collectionContainerView.fillContainer() collectionView.fillHorizontally().bottom(0) From 34707acaef8bb73a2222f8bdc0c6a87cbeeadbd2 Mon Sep 17 00:00:00 2001 From: Michael Stromer Date: Wed, 7 Aug 2024 13:29:04 -0400 Subject: [PATCH 3/9] feat: mute videos --- Source/Pages/Gallery/YPAssetZoomableView.swift | 2 ++ Source/Pages/Gallery/YPLibraryView.swift | 1 + 2 files changed, 3 insertions(+) diff --git a/Source/Pages/Gallery/YPAssetZoomableView.swift b/Source/Pages/Gallery/YPAssetZoomableView.swift index b8ce2210..4cf24a72 100644 --- a/Source/Pages/Gallery/YPAssetZoomableView.swift +++ b/Source/Pages/Gallery/YPAssetZoomableView.swift @@ -21,6 +21,7 @@ final class YPAssetZoomableView: UIScrollView { public weak var zoomableViewDelegate: YPAssetZoomableViewDelegate? public var cropAreaDidChange = {} public var isVideoMode = false + public var isVideoMuted = false public var photoImageView = UIImageView() public var videoView = YPVideoView() public var squaredZoomScale: CGFloat = 1 @@ -123,6 +124,7 @@ final class YPAssetZoomableView: UIScrollView { strongSelf.currentAsset = video strongSelf.videoView.loadVideo(playerItem) + strongSelf.videoView.player.isMuted = isVideoMuted strongSelf.videoView.play() strongSelf.zoomableViewDelegate?.ypAssetZoomableViewDidLayoutSubviews(strongSelf) } diff --git a/Source/Pages/Gallery/YPLibraryView.swift b/Source/Pages/Gallery/YPLibraryView.swift index c0624ce1..b369b02c 100644 --- a/Source/Pages/Gallery/YPLibraryView.swift +++ b/Source/Pages/Gallery/YPLibraryView.swift @@ -35,6 +35,7 @@ internal final class YPLibraryView: UIView { }() internal let assetZoomableView: YPAssetZoomableView = { let v = YPAssetZoomableView(frame: .zero) + v.isVideoMuted = YPConfig.library.isBulkUploading v.accessibilityIdentifier = "assetZoomableView" return v }() From b548e103adcbd9227c368d0fff6735af06b207f7 Mon Sep 17 00:00:00 2001 From: Michael Stromer Date: Wed, 7 Aug 2024 13:30:32 -0400 Subject: [PATCH 4/9] Update YPLibraryView.swift --- Source/Pages/Gallery/YPLibraryView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Pages/Gallery/YPLibraryView.swift b/Source/Pages/Gallery/YPLibraryView.swift index b369b02c..824abbb7 100644 --- a/Source/Pages/Gallery/YPLibraryView.swift +++ b/Source/Pages/Gallery/YPLibraryView.swift @@ -242,7 +242,7 @@ internal final class YPLibraryView: UIView { YPConfig.showsLibraryButtonInTitle ? UIView() : showAlbumsButton, line, assetViewContainer.subviews( - YPConfig.library.isBulkUploading ? UIView() : assetZoomableView + assetZoomableView ), progressView, maxNumberWarningView.subviews( From 19261d2951e14d44d7aa93d6e644bb988cfff3c3 Mon Sep 17 00:00:00 2001 From: Michael Stromer Date: Wed, 7 Aug 2024 13:34:04 -0400 Subject: [PATCH 5/9] Update YPAssetZoomableView.swift --- Source/Pages/Gallery/YPAssetZoomableView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Pages/Gallery/YPAssetZoomableView.swift b/Source/Pages/Gallery/YPAssetZoomableView.swift index 4cf24a72..7c445393 100644 --- a/Source/Pages/Gallery/YPAssetZoomableView.swift +++ b/Source/Pages/Gallery/YPAssetZoomableView.swift @@ -124,7 +124,7 @@ final class YPAssetZoomableView: UIScrollView { strongSelf.currentAsset = video strongSelf.videoView.loadVideo(playerItem) - strongSelf.videoView.player.isMuted = isVideoMuted + strongSelf.videoView.player.isMuted = strongSelf.isVideoMuted strongSelf.videoView.play() strongSelf.zoomableViewDelegate?.ypAssetZoomableViewDidLayoutSubviews(strongSelf) } From 20f2a23ca3a4b690b48aa3088fef68d6944928b4 Mon Sep 17 00:00:00 2001 From: Michael Stromer Date: Wed, 7 Aug 2024 13:44:26 -0400 Subject: [PATCH 6/9] Update YPLibraryViewCell.swift --- Source/Pages/Gallery/YPLibraryViewCell.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Pages/Gallery/YPLibraryViewCell.swift b/Source/Pages/Gallery/YPLibraryViewCell.swift index ea07cd1e..1763ca73 100644 --- a/Source/Pages/Gallery/YPLibraryViewCell.swift +++ b/Source/Pages/Gallery/YPLibraryViewCell.swift @@ -98,8 +98,8 @@ class YPLibraryViewCell: UICollectionViewCell { ) layout( - 3, - multipleSelectionIndicator-3-| + 1, + multipleSelectionIndicator-1-| ) imageView.contentMode = .scaleAspectFill From b756febc3cb5c44dafb1a88ee0e2b33d0f82086a Mon Sep 17 00:00:00 2001 From: Michael Stromer Date: Wed, 7 Aug 2024 13:49:15 -0400 Subject: [PATCH 7/9] Update YPLibraryViewCell.swift --- Source/Pages/Gallery/YPLibraryViewCell.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Pages/Gallery/YPLibraryViewCell.swift b/Source/Pages/Gallery/YPLibraryViewCell.swift index 1763ca73..e844cf3e 100644 --- a/Source/Pages/Gallery/YPLibraryViewCell.swift +++ b/Source/Pages/Gallery/YPLibraryViewCell.swift @@ -98,8 +98,8 @@ class YPLibraryViewCell: UICollectionViewCell { ) layout( - 1, - multipleSelectionIndicator-1-| + 3, + |-3-multipleSelectionIndicator ) imageView.contentMode = .scaleAspectFill From 80ddf4ff7f5092cea5633a0005a9da7d85af0c62 Mon Sep 17 00:00:00 2001 From: Michael Stromer Date: Wed, 7 Aug 2024 13:56:29 -0400 Subject: [PATCH 8/9] Update YPLibraryViewCell.swift --- Source/Pages/Gallery/YPLibraryViewCell.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Pages/Gallery/YPLibraryViewCell.swift b/Source/Pages/Gallery/YPLibraryViewCell.swift index e844cf3e..436a3e28 100644 --- a/Source/Pages/Gallery/YPLibraryViewCell.swift +++ b/Source/Pages/Gallery/YPLibraryViewCell.swift @@ -57,6 +57,7 @@ class YPMultipleSelectionIndicator: UIView { func set(number: Int?) { label.isHidden = (number == nil) + circle.isHidden = YPConfig.library.isBulkUploading && number == nil if let number = number { circle.backgroundColor = selectionColor circle.layer.borderColor = selectionBorderColor.cgColor @@ -99,7 +100,7 @@ class YPLibraryViewCell: UICollectionViewCell { layout( 3, - |-3-multipleSelectionIndicator + YPConfig.library.isBulkUploading ? |-3-multipleSelectionIndicator : multipleSelectionIndicator-3-| ) imageView.contentMode = .scaleAspectFill From fd56c2b962dcf3ec59aa0a4362fc1a9ff77fdbe1 Mon Sep 17 00:00:00 2001 From: Michael Stromer Date: Wed, 7 Aug 2024 13:59:34 -0400 Subject: [PATCH 9/9] Update YPLibraryViewCell.swift --- Source/Pages/Gallery/YPLibraryViewCell.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Pages/Gallery/YPLibraryViewCell.swift b/Source/Pages/Gallery/YPLibraryViewCell.swift index 436a3e28..6539c4f0 100644 --- a/Source/Pages/Gallery/YPLibraryViewCell.swift +++ b/Source/Pages/Gallery/YPLibraryViewCell.swift @@ -57,7 +57,9 @@ class YPMultipleSelectionIndicator: UIView { func set(number: Int?) { label.isHidden = (number == nil) - circle.isHidden = YPConfig.library.isBulkUploading && number == nil + let isHiddenDuringBulkUploads = YPConfig.library.isBulkUploading && number == nil + circle.isHidden = isHiddenDuringBulkUploads + imageView.isHidden = isHiddenDuringBulkUploads if let number = number { circle.backgroundColor = selectionColor circle.layer.borderColor = selectionBorderColor.cgColor