Skip to content

Commit

Permalink
Merge pull request #1243 from square/sedwards/cleanup-imports
Browse files Browse the repository at this point in the history
Remove unnecessary fully qualified LocalLifecycleOwner use
  • Loading branch information
steve-the-edwards authored Dec 16, 2024
2 parents 74635d9 + a18bfe5 commit d92849f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ComposeLifecycleOwnerTest {
childLifecycleOwner = rememberChildLifecycleOwner(parentLifecycle)
parentLifecycle.currentState = CREATED
CompositionLocalProvider(
androidx.lifecycle.compose.LocalLifecycleOwner provides childLifecycleOwner
LocalLifecycleOwner provides childLifecycleOwner
) {
// let's assert right away as things are composing, because we want to ensure that
// the lifecycle is in the correct state as soon as possible & not just after composition
Expand Down Expand Up @@ -91,9 +91,9 @@ class ComposeLifecycleOwnerTest {
LaunchedEffect(Unit) { seenRecomposition = true }
CompositionLocalProvider(
if (seenRecomposition) {
androidx.lifecycle.compose.LocalLifecycleOwner provides customParentLifecycleOwner
LocalLifecycleOwner provides customParentLifecycleOwner
} else {
androidx.lifecycle.compose.LocalLifecycleOwner provides androidx.lifecycle.compose.LocalLifecycleOwner.current
LocalLifecycleOwner provides LocalLifecycleOwner.current
}
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import androidx.lifecycle.Lifecycle.State.STARTED
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.findViewTreeLifecycleOwner
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
Expand Down Expand Up @@ -213,7 +214,7 @@ internal class WorkflowRenderingTest {

class LifecycleRecorder : ComposableRendering {
@Composable override fun Content() {
val lifecycle = androidx.lifecycle.compose.LocalLifecycleOwner.current.lifecycle
val lifecycle = LocalLifecycleOwner.current.lifecycle
DisposableEffect(lifecycle) {
lifecycle.addObserver(
LifecycleEventObserver { _, event ->
Expand Down Expand Up @@ -301,7 +302,7 @@ internal class WorkflowRenderingTest {

composeRule.setContent {
CompositionLocalProvider(
androidx.lifecycle.compose.LocalLifecycleOwner provides parentOwner
LocalLifecycleOwner provides parentOwner
) {
env.RootScreen(LifecycleRecorder(states))
}
Expand Down Expand Up @@ -351,7 +352,7 @@ internal class WorkflowRenderingTest {

composeRule.setContent {
CompositionLocalProvider(
androidx.lifecycle.compose.LocalLifecycleOwner provides parentOwner
LocalLifecycleOwner provides parentOwner
) {
env.RootScreen(LifecycleRecorder(states))
}
Expand Down Expand Up @@ -542,7 +543,7 @@ internal class WorkflowRenderingTest {
private val states: MutableList<State>
) : ComposableRendering {
@Composable override fun Content() {
val lifecycle = androidx.lifecycle.compose.LocalLifecycleOwner.current.lifecycle
val lifecycle = LocalLifecycleOwner.current.lifecycle
DisposableEffect(lifecycle) {
this@LifecycleRecorder.states += lifecycle.currentState
lifecycle.addObserver(
Expand Down

0 comments on commit d92849f

Please sign in to comment.