From 4d40d0c8533a7f0c99ccf32262ca9e85dc0a0841 Mon Sep 17 00:00:00 2001 From: Nirali Shah Date: Fri, 20 Jan 2023 18:48:55 +0530 Subject: [PATCH] fixed bug in showing select more photos options when defaultMultipleSelection is single photo --- Source/Pages/Gallery/YPLibraryVC+CollectionView.swift | 8 ++++++-- Source/Pages/Gallery/YPLibraryVC.swift | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Pages/Gallery/YPLibraryVC+CollectionView.swift b/Source/Pages/Gallery/YPLibraryVC+CollectionView.swift index 24a666805..a13ffeb3f 100644 --- a/Source/Pages/Gallery/YPLibraryVC+CollectionView.swift +++ b/Source/Pages/Gallery/YPLibraryVC+CollectionView.swift @@ -102,8 +102,12 @@ extension YPLibraryVC { /// Checks if there can be selected more items. If no - present warning. func checkLimit() { - let isHidden = !isLimitExceeded || isMultipleSelectionEnabled == false - v.maxNumberWarningView.isHidden = isHidden + let isHidden = !isLimitExceeded || isMultipleSelectionEnabled == false + v.maxNumberWarningView.isHidden = isHidden + self.checkSelectMoreOptions(isHidden: isHidden) + } + + func checkSelectMoreOptions(isHidden: Bool = true) { if #available(iOS 14, *) { let status = PHPhotoLibrary.authorizationStatus(for: .readWrite) if status == .limited { diff --git a/Source/Pages/Gallery/YPLibraryVC.swift b/Source/Pages/Gallery/YPLibraryVC.swift index fda00e41c..5fb000e17 100644 --- a/Source/Pages/Gallery/YPLibraryVC.swift +++ b/Source/Pages/Gallery/YPLibraryVC.swift @@ -85,6 +85,8 @@ internal final class YPLibraryVC: UIViewController, YPPermissionCheckable { if YPConfig.library.defaultMultipleSelection || selectedItems.count > 1 { toggleMultipleSelection() + } else { + checkSelectMoreOptions() } }