Skip to content

ref: migrate PagerPageHolder from RxJava to Coroutines#2931

Closed
nonproto wants to merge 1 commit intomainfrom
exorcist-pager-page-holder-15699169375434068070
Closed

ref: migrate PagerPageHolder from RxJava to Coroutines#2931
nonproto wants to merge 1 commit intomainfrom
exorcist-pager-page-holder-15699169375434068070

Conversation

@nonproto
Copy link
Copy Markdown
Collaborator

@nonproto nonproto commented Apr 4, 2026

What: Removed RxJava imports (Observable, Subscription, Schedulers) from PagerPageHolder.kt and converted readImageHeaderSubscription to a Coroutine Job.
Why: Modernization and reducing the footprint of the RxJava dependency.
Nuances: Translated .subscribeOn(Schedulers.io()) to withContext(Dispatchers.IO) and .observeOn(AndroidSchedulers.mainThread()) to withContext(Dispatchers.Main). Handled stream lifecycle using awaitCancellation() inside a try/finally block to mirror .flatMap { Observable.never<Unit>() }. Handled blocking IO operations appropriately. Re-throw CancellationException and updated PR comments. Removed patch_pr.py.


PR created automatically by Jules for task 15699169375434068070 started by @nonproto

Co-authored-by: nonproto <2092019+nonproto@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the image header reading logic in PagerPageHolder from RxJava to Kotlin Coroutines. Key changes include replacing Subscription with Job, using scope.launch and withContext for asynchronous operations, and implementing awaitCancellation() within a try-finally block to manage stream lifecycles. A review comment suggests adding explicit imports for CancellationException and Job to improve code readability by avoiding fully qualified names.

import kotlinx.coroutines.Dispatchers.Default
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.Job
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Avoid using fully qualified names for common kotlinx.coroutines APIs. Instead, add imports to improve code readability and reduce boilerplate.

Suggested change
import kotlinx.coroutines.Job
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Job
References
  1. Avoid using fully qualified names for common kotlinx.coroutines APIs. Instead, add imports to improve code readability and reduce boilerplate.

@nonproto nonproto closed this Apr 5, 2026
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.

1 participant