vinceglb / FileKit

Pick and save Files, Medias and Folder for Kotlin Multiplatform / KMP and Compose Multiplatform / CMP
https://vinceglb.github.io/FileKit/
MIT License
513 stars 15 forks source link

Add Feature to Limit number of Images that can be picked #50

Closed Vaibhav2002 closed 2 months ago

Vaibhav2002 commented 3 months ago

A feature to set a max limit on the number of images that can be picked when picking multiple images

LaatonWalaBhoot commented 2 months ago

Hey this would be a great addition. Any idea if this can be included @vinceglb ?

santiwanti commented 2 months ago

Take a look at PR https://github.com/vinceglb/FileKit/pull/60. There are quite a few limitations to this feature. I will keep working on it and try to cover as much area as possible, but I'm not sure how useful it is if it works on few platforms and fewer usecases.

LaatonWalaBhoot commented 2 months ago

@santiwanti Maybe take a look at https://github.com/onseok/peekaboo for reference? This already has the functionality but is not actively maintained.

santiwanti commented 2 months ago

@LaatonWalaBhoot I will take a look at this for the iOS side. But still, keep in mind that FileKit supports more platforms than just iOS / Android and more files than just media

LaatonWalaBhoot commented 2 months ago

Thanks @santiwanti However I wonder. Such a functionality would be useful for all platforms right? Use case being e-commerce or social media apps

santiwanti commented 2 months ago

I do think it would be helpful, the problem is that maintaining it for some platforms will be harder than for others because we have to do it manually instead of letting the systems libraries handle it for us.

The only platforms I have seen that have library support for maxSelection are Android and iOS and only when it comes to images

LaatonWalaBhoot commented 2 months ago

Agreed. I guess we can keep this open once mobile platforms are supported. I can try putting in a PR for other platforms

santiwanti commented 2 months ago

@LaatonWalaBhoot the PR for mobile platforms is done. If it's decided that it will be merged I will probably have to clean it up a bit, but the functionality is there.

Regarding implementing the feature for other platforms, I would advise to wait until @vinceglb confirms that that is something he wants. Implementing the feature is the first step, it then has to be maintained and removing features is harder than adding them.

LaatonWalaBhoot commented 2 months ago

Sure thanks @santiwanti

LaatonWalaBhoot commented 2 months ago

@vinceglb There is a draft PR for this available. Any ideas if it will be reviewed and merged?