[AND-319] Improve poll creation process(compose). #5634
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎯 Goal
If a client is using the
AttachmentsPicker
component in their code, handling the creation of a poll is a bit difficult. They would need to copy-paste the whole logic for transforming theAttachmentPickerPollCreation
into aPollConfig
, which can be error prone, and is not something that they should know how it is done internally. They currently need to do the following:After the change, all they would need to do handle the poll creation properly is:
🚨This is a breaking change. 🚨 However, I think that we must do this, as the code that integrators need to write to make this work currently is an internal logic, and it shouldn't be exposed like this. Additionally, a migration from this to the new API should be very straight forward.
🛠 Implementation details
AttachmentPickerPollCreation
to hold a preparedPollConfig
, instead ofquestion: String
,options: List<PollOptionItem>
andswitches: List<PollSwitchItem>
.PollConfig
creation login internal inAttachmentsPickerPollUtils
🧪 Testing