Skip to content

refactor: convert AttachmentController.java to .kt#11111

Open
mohitsatr wants to merge 3 commits into
thunderbird:mainfrom
mohitsatr:attachmentcontroller-kt
Open

refactor: convert AttachmentController.java to .kt#11111
mohitsatr wants to merge 3 commits into
thunderbird:mainfrom
mohitsatr:attachmentcontroller-kt

Conversation

@mohitsatr

Copy link
Copy Markdown
Contributor

Fixes #11096

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Validation Passed: All report and feature-flag labels are correctly set.

@mohitsatr

Copy link
Copy Markdown
Contributor Author

@rafaeltonholo, how can I test this class? Could you point to anything similar in the codebase?

@wmontwe wmontwe added the report: exclude Exclude changes from user-facing reports (internal, minor, or not relevant to users). label Jun 5, 2026
@rafaeltonholo

Copy link
Copy Markdown
Member

@rafaeltonholo, how can I test this class? Could you point to anything similar in the codebase?

What do you mean by "how can I test this class"? Are you asking about building unit tests or testing it within the app?

If you want to test it in the app, you should verify that all the functionalities related to attachments in the MessageViewFragment are still working as intended.

While having a unit test for this class would be beneficial, during a conversion from Java to Kotlin, you are not required to introduce any new code. The focus of the task is solely on the conversion itself.

Please refer to our documentation "Java to Kotlin Conversion Guide" to understand the required steps for performing this task.

@rafaeltonholo rafaeltonholo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this conversion! There are a few things we need to address before merging this code.

Please check the Java to Kotlin Conversion Guide to verify what is needed during a Java to Kotlin conversion

Comment thread legacy/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentController.kt Outdated
Comment thread legacy/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentController.kt Outdated
@mohitsatr mohitsatr force-pushed the attachmentcontroller-kt branch 2 times, most recently from 048e9e4 to 5184d3d Compare June 12, 2026 10:57
@mohitsatr

Copy link
Copy Markdown
Contributor Author

While having a unit test for this class would be beneficial, during a conversion from Java to Kotlin, you are not required to introduce any new code. The focus of the task is solely on the conversion itself.

Yes. I meant a unit test. I can send a separate PR for that after this.

@rafaeltonholo rafaeltonholo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You just missed one hardcoded dispatcher. Everything else is good

}

private suspend fun viewLocalAttachment() {
val intent = withContext(Dispatchers.IO) { getBestViewIntent() }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ioDispatcher instead.

Suggested change
val intent = withContext(Dispatchers.IO) { getBestViewIntent() }
val intent = withContext(ioDispatcher) { getBestViewIntent() }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah my bad. Done

@mohitsatr mohitsatr force-pushed the attachmentcontroller-kt branch 2 times, most recently from ebb33de to 20410a8 Compare June 14, 2026 04:27
@mohitsatr mohitsatr force-pushed the attachmentcontroller-kt branch from 20410a8 to 3e0bc1f Compare June 14, 2026 11:20

@rafaeltonholo rafaeltonholo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for this contribution!! We are currently on a soft freeze, but once it is lifted, we are good to merge this!

@rafaeltonholo rafaeltonholo added the merge block: soft freeze PR to main is blocked: risky code or feature flag enablement must wait until soft freeze lifts. label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge block: soft freeze PR to main is blocked: risky code or feature flag enablement must wait until soft freeze lifts. report: exclude Exclude changes from user-facing reports (internal, minor, or not relevant to users).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert AttachmentController.java to Kotlin

3 participants