From 206ac3d52111941aee3d0108cfd9ac7edc5abd66 Mon Sep 17 00:00:00 2001 From: Isaac Udy Date: Fri, 13 Sep 2024 00:55:26 +1200 Subject: [PATCH] Updated PresentationTests for non-legacy present behavior in containers --- .../enro/destination/fragment/FragmentPlugin.kt | 4 ++-- .../java/dev/enro/test/PresentationTests.kt | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/enro-core/src/main/java/dev/enro/destination/fragment/FragmentPlugin.kt b/enro-core/src/main/java/dev/enro/destination/fragment/FragmentPlugin.kt index 41c2e087..f4c763b2 100644 --- a/enro-core/src/main/java/dev/enro/destination/fragment/FragmentPlugin.kt +++ b/enro-core/src/main/java/dev/enro/destination/fragment/FragmentPlugin.kt @@ -8,7 +8,7 @@ import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentManager import dev.enro.core.container.EmptyBehavior import dev.enro.core.container.NavigationContainerProperty -import dev.enro.core.container.acceptNone +import dev.enro.core.container.accept import dev.enro.core.container.emptyBackstack import dev.enro.core.containerManager import dev.enro.core.controller.NavigationController @@ -60,7 +60,7 @@ private class FragmentLifecycleCallbacksForEnro( FragmentNavigationContainer( containerId = android.R.id.content, parentContext = activity.navigationContext, - filter = acceptNone(), + filter = accept { anyPresented() }, emptyBehavior = EmptyBehavior.AllowEmpty, interceptor = {}, animations = {}, diff --git a/enro/src/androidTest/java/dev/enro/test/PresentationTests.kt b/enro/src/androidTest/java/dev/enro/test/PresentationTests.kt index c757c9df..84805528 100644 --- a/enro/src/androidTest/java/dev/enro/test/PresentationTests.kt +++ b/enro/src/androidTest/java/dev/enro/test/PresentationTests.kt @@ -23,8 +23,7 @@ import dev.enro.core.NavigationKey import dev.enro.core.R import dev.enro.core.compose.rememberNavigationContainer import dev.enro.core.container.EmptyBehavior -import dev.enro.core.container.acceptKey -import dev.enro.core.container.doNotAccept +import dev.enro.core.container.accept import dev.enro.core.directParentContainer import dev.enro.core.fragment.container.navigationContainer import dev.enro.core.getNavigationHandle @@ -287,8 +286,11 @@ class ActivityWithFragmentContainer : FragmentActivity() { val container by navigationContainer( containerId = containerId, - filter = acceptKey { - it !is PresentationTests.NotSupportedFragmentKey && it !is PresentationTests.NotSupportedComposeKey + filter = accept { + anyPresented() + key { + it !is PresentationTests.NotSupportedFragmentKey && it !is PresentationTests.NotSupportedComposeKey + } } ) @@ -312,7 +314,10 @@ class ActivityWithComposeContainer : FragmentActivity() { setContent { val container = rememberNavigationContainer( emptyBehavior = EmptyBehavior.AllowEmpty, - filter = doNotAccept { key() } + filter = accept { + anyPresented() + key { it !is PresentationTests.NotSupportedComposeKey } + } ) Box(modifier = Modifier.fillMaxSize()) { container.Render()