chucker icon indicating copy to clipboard operation
chucker copied to clipboard

Add Support for Custom Shareable Options

Open handstandsam opened this issue 3 years ago • 3 comments

:warning: Is your feature request related to a problem? Please describe

I would like to add an additional shareable item when I configure Chucker. I would like to be able to export to a custom format that wouldn't make sense to add to the chucker library itself as it's not a standard. In this case it's exporting a Kotlin file that is generated from HTTP data.

:bulb: Describe the solution you'd like

I'd like to be able to give a "Sharable" format option via the ChuckerInterceptor.Builder that would be shown on https://github.com/ChuckerTeam/chucker/blob/218a997a64acde14d6d085043ae3ecc7a7326c22/library/src/main/java/com/chuckerteam/chucker/internal/ui/transaction/TransactionActivity.kt#L77-L99

Example Code

data class SharableOption(
  val name: String,
  val sharable: Sharable
)
val chuckerInterceptor = ChuckerInterceptor.Builder(context)
        .addSharableOption(sharableOption)
        .build()

:bar_chart: Describe alternatives you've considered

I am already doing this manually myself in my own library, but it would be nice to have a UI to do it, and yours is nice.

:page_facing_up: Additional context

I could create a fork, but it seems like this would be fairly trivial to add to Chucker with the way your existing Sharables work today, and would allow this to be more extensible.

:raising_hand: Do you want to develop this feature yourself?

  • [x] Yes
  • [ ] No

handstandsam avatar Dec 19 '21 19:12 handstandsam

Hey, thanks for creating this ticket. I agree that it would be a great addition, and it is something that I strive for. Unfortunately, I don't think it is as straightforward as it appears. Our Sharable implementations are internal and rely on the internal data model. Exposing them is tracked by #579, which is additionally "blocked" by #259.

It is something that I plan to prioritize in early 2022 when I have more free time on my hands. But if you (or anyone) would like to tackle this, it would be much appreciated for sure. :)

Unless you envisioned some other mechanism of sharing that doesn't rely on the internal data model?

MiSikora avatar Dec 20 '21 07:12 MiSikora

That all makes sense. This would rely on the internal data model which would require a fork at this time if it wanted to get done. The benefit of chucker is that it has what I need as far as UI and persistence, just not the ability to export in my format.

I'll keep brainstorming, but might have to do it after those other changes happen. Thank you!

handstandsam avatar Dec 20 '21 18:12 handstandsam

Thanks for raising this point @handstandsam

Further sharing options were on our table for a while, as @MiSikora mentioned. Some months ago we merged HAR support #696. Ideally we would like to follow the approach already mentioned (i.e. #579 and #259) and allow users to plug in their "exporter" plugin.

HAR could be one of that and refactored outside the core of chucker.

cortinico avatar Dec 30 '21 16:12 cortinico