Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preselected images when the picker is opened #44

Open
Sh1d0w opened this issue May 18, 2020 · 9 comments
Open

Preselected images when the picker is opened #44

Sh1d0w opened this issue May 18, 2020 · 9 comments
Assignees

Comments

@Sh1d0w
Copy link

Sh1d0w commented May 18, 2020

Hi and thanks for the great picker.

Would it be possible to implement an option to pass array of PHAssetIDs, which should appear pre -selected once the picker is invoked?

@renssies
Copy link
Contributor

I've thought about this feature before, however it gave us a user experience issues:

  • What if the picker opens with the album list?
  • What if the user opens or switches to an album that doesn't contain the assets?

The picker does not save the selection when switching to a different album because of this UX issue.


If you really need this functionality you could easily implement it in a fork of the library:

  1. Add an array property of PHAsset objects to TatsiConfig
  2. On viewDidLoad in AssetsGridViewController set the selectedAssets property to the contents of the array on TatsiConfig

However, this will still give the user the above issues and might not result in the perfect user experience.

You could however remove the album switch button, and also make sure the picker shows an album in which the assets are available (see firstView on TatsiConfig)

@Sh1d0w
Copy link
Author

Sh1d0w commented May 18, 2020

Thanks for your detailed response @renssies !

I am the maintainer of the popular Flutter plugin multi_image_picker. Currently for the iOS part I am using BSImagePicker, but I've been seeking another iOS library to replace it with, as the maintainer did some breaking changes and also had some bad attitude towards another OSS users. I find Tatsi a great replacement, with this the only thing being a blocker and possibly introduce e breaking change if I do the switch.

While I see your point and I feel your concerns, I would say that picking images across several albums is a very common thing. At least with BSImagePicker you could select multiple images from different albums. Then when opening it again with pre selected array of images that's fine, you don't need any special UX about that, you don't even need to open the current album that the images were selected from. Good UX would be to provide the option to remove the image when selected outside of the picker rather than trying to provide this functionality when opening the picker. Of course you can do the latter, but when you invoke the picker you are actually trying to select / add more images rather than trying to deselect them, in which case the lack of option to pre select images becomes a pain.

Take the following use case: you have an app where you can select multiple images to be sent to an API endpoint. You open the picker, select multiple images from different folders and click ok. But then you decide you don't want one of them and want to add two more. A good UX would allow to remove any picture from the selection right the in page where you visualise the selection in the app itself.

Now about adding two more images to the selection. You tap add again and you open the picker. Because there is no way to provide pre selected images, the user won't be able to see his currently selected photos in any of the albums he navigates to, so he can choose them again, despite they are already selected, which is a problem and can't be handled properly during image selection.

I hope you follow my point. Thanks again for the great library!

@renssies
Copy link
Contributor

renssies commented May 26, 2020

Thanks for your point, I understand it now :)

My idea is to make "keeping the selection between albums" an opt-in option in the TatsiConfig if that works for you? Opt-in would mean that it defaults to false, and you need to set it to true whenever you are opening the picker.

I will also add a way to set preselected assets on the TatsiConfig. Does that work for you?

Edit: BTW, sorry for the slow reaction. My life is quite a rollercoaster at the moment.

@Sh1d0w
Copy link
Author

Sh1d0w commented May 26, 2020

^ Yes, what you suggest would be more than great. No worries, I hope everything is ok with you!

@renssies
Copy link
Contributor

@Sh1d0w Just to give you an update, I'm still working on this one :)

@Sh1d0w
Copy link
Author

Sh1d0w commented Jun 18, 2020

Thanks for the heads up @renssies . Really appreciate the effort you are putting into this!

@renssies renssies self-assigned this Jun 19, 2020
@renssies
Copy link
Contributor

@Sh1d0w I've pushed the changes to pull request #47. Let me know what you think of the changes and if they work.
I will do some testing and if the feature works for you I will merge it to master and push it to cocoa pods :)

@Sh1d0w
Copy link
Author

Sh1d0w commented Jul 1, 2020

@renssies Thanks, look awesome! I can't test it atm as I am on a vacation but will do once I get back.

@smaljaar
Copy link

I would like to see this PR merged and the pod spec updated so we can use it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants