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

### Display Name Formatter ✍️ #1340

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

NickMelnykIronvest
Copy link

@NickMelnykIronvest NickMelnykIronvest commented Jan 28, 2025

Allows to customize transaction display name on the screen with transactions list. Could be useful to map long paths into short display names for reading convenience. Providing null values will fallback to default display name. Please note, that new formatter will take place only after transactions list screen start/restart.

Chucker.setHttpTransactionNameFormatter { transaction ->
    // provide CharSequence that acts as custom display name of transaction
}

📄 Context

Optional Transaction Display Name Formatter
Display Name Formatter

📝 Changes

🚫 Breaking

Non breaking changes.

🛠️ How to test

Set any custom formatter as shown below and test null and non null values.
Null values fallback to default display name.

Chucker.setHttpTransactionNameFormatter { transaction ->
    // provide CharSequence that acts as custom display name of transaction
}

⏱️ Next steps

No plans. Potentially interface could be extended to also support custom display name in push-notifications.

Nick Melnyk added 2 commits January 28, 2025 15:22
Allows to customize transaction display name on the screen with transactions list.
Could be useful to map long paths into short display names for reading convenience.
Providing null values will fallback to default display name.
Please note, that new formatter will take place only after transactions list screen start/restart.

```kotlin
Chucker.setHttpTransactionNameFormatter { transaction ->
    // provide CharSequence that acts as custom display name of transaction
}
```
@cortinico
Copy link
Member

Thanks for sending this over @NickMelnykIronvest

Not sure if you saw my message here: #1339 (comment)

This is not doing what I've suggested. Specifically I don't think we should add this capability to the Chucker object

@NickMelnykIronvest
Copy link
Author

NickMelnykIronvest commented Jan 28, 2025

Thanks for sending this over @NickMelnykIronvest

Not sure if you saw my message here: #1339 (comment)

This is not doing what I've suggested. Specifically I don't think we should add this capability to the Chucker object

This is not doing what I've suggested.

@cortinico
Yeah, I saw your comment.
Redact-header (or redact-url for this matter) has completely different purpose.
This formatter instead designed to modify display name of transaction without alterating transaction/data as such.

Specifically I don't think we should add this capability to the Chucker object

@cortinico I do not see why. Assume you indeed agree to add ability to format (modify) transaction display name, what better place you would choose to set/store this interface.
I choose Chucker because it is an object and perfectly suited to store formatter. Amongst other classes we have ChuckerInterceptor. But modifying transaction name (path) has nothing in common with interceptor. The same applies to the ChuckerCollector. No other publicly available interfaces are suitable.

Just tell me straight, whether I could expect it merged and published anytime soon or request will be discarded (so I have to figure out other way how to use this feature in my project). If you need me to fix anyting before PR is accepted, let me know.

@cortinico
Copy link
Member

Redact-header (or redact-url for this matter) has completely different purpose.
This formatter instead designed to modify display name of transaction without alterating transaction/data as such.

Oh I understand your use case. You want to alter the visualization of the URL only on the transaction list.

That's something we shouldn't be merging then as I think it's a bit too niche and specific to your use case.

As a side note, you can always override the layout of the transaction list by providing new XML resource files that override Chuckers so you could have a multiline string in the transaction list.

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

Successfully merging this pull request may close these issues.

None yet

2 participants