Skip to content

Commit 831a0ec

Browse files
authored
Merge pull request Yummypets#529 from SoBump/preselect_item_multiple_selection_config
Add a config to pre-select the current item in library when using multiple options
2 parents 68a0777 + f641d72 commit 831a0ec

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Source/Configuration/YPImagePickerConfiguration.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ public struct YPConfigLibrary {
180180
/// Initial state of multiple selection button.
181181
public var defaultMultipleSelection = false
182182

183+
/// Pre-selects the current item on setting multiple selection
184+
public var preSelectItemOnMultipleSelection = true
185+
183186
/// Anything superior than 1 will enable the multiple selection feature.
184187
public var maxNumberOfItems = 1
185188

Source/Pages/Gallery/YPLibraryVC.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public class YPLibraryVC: UIViewController, YPPermissionCheckable {
177177
multipleSelectionEnabled = !multipleSelectionEnabled
178178

179179
if multipleSelectionEnabled {
180-
if selection.isEmpty {
180+
if selection.isEmpty && YPConfig.library.preSelectItemOnMultipleSelection {
181181
let asset = mediaManager.fetchResult[currentlySelectedIndex]
182182
selection = [
183183
YPLibrarySelection(index: currentlySelectedIndex,

0 commit comments

Comments
 (0)