Skip to content

Comments

Cleanup the coroutines code in CaptureComposable.kt#2676

Merged
yschimke merged 7 commits intogoogle:mainfrom
yschimke:fix_return
Aug 15, 2025
Merged

Cleanup the coroutines code in CaptureComposable.kt#2676
yschimke merged 7 commits intogoogle:mainfrom
yschimke:fix_return

Conversation

@yschimke
Copy link
Collaborator

@yschimke yschimke commented Aug 15, 2025

WHAT

Split out functions to separate layers of abstraction (Compose, Coroutines, Normal).

WHY

Got some warnings about mixing suspend and non suspend methods. False alarm due to nesting, but removing that confusion seems worthwhile.

HOW

Checklist 📋

  • Add explicit visibility modifier and explicit return types for public declarations
  • Run spotless check
  • Run tests
  • Update metalava's signature text files

@yschimke yschimke closed this Aug 15, 2025
@yschimke yschimke reopened this Aug 15, 2025
@yschimke yschimke requested a review from castedmo August 15, 2025 11:30
@yschimke yschimke closed this Aug 15, 2025
@yschimke yschimke reopened this Aug 15, 2025
@yschimke yschimke requested a review from luizgrp August 15, 2025 12:30
@yschimke yschimke enabled auto-merge (squash) August 15, 2025 12:44
content()
}
}
coroutineScope.launch {
Copy link
Member

Choose a reason for hiding this comment

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

I think this can get called more than once but subsequent calls to Deferred.complete have no effect.
Maybe instead of making assumptions of the implementation of onResult callback here, the instance of Deferred could be passed. Not a big deal for me.

@yschimke yschimke merged commit e8cd73f into google:main Aug 15, 2025
6 checks passed
)
) ?: return null

val result = callback(virtualDisplay!!.display)
Copy link
Collaborator

Choose a reason for hiding this comment

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

!! is now redundant here I guess.

kul3r4 pushed a commit to kul3r4/horologist-1 that referenced this pull request Sep 19, 2025
* Cleanup the coroutines code in CaptureComposable.kt

---------

Co-authored-by: yschimke <231923+yschimke@users.noreply.github.com>
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.

3 participants