diff --git a/library/compose/src/commonMain/kotlin/com/tunjid/treenav/compose/threepane/configurations/MovableSharedElementConfiguration.kt b/library/compose/src/commonMain/kotlin/com/tunjid/treenav/compose/threepane/configurations/MovableSharedElementConfiguration.kt index 8a7505a..9ba39cf 100644 --- a/library/compose/src/commonMain/kotlin/com/tunjid/treenav/compose/threepane/configurations/MovableSharedElementConfiguration.kt +++ b/library/compose/src/commonMain/kotlin/com/tunjid/treenav/compose/threepane/configurations/MovableSharedElementConfiguration.kt @@ -58,7 +58,10 @@ fun PanedNavHostConfiguration< ) } -fun PaneScope.movableSharedElementScope(): MovableSharedElementScope { +fun PaneScope< + ThreePane, + Destination + >.requireThreePaneMovableSharedElementScope(): MovableSharedElementScope { check(this is ThreePaneMovableSharedElementScope) { """ The current AdaptivePaneScope (${this::class.qualifiedName}) is not an instance of diff --git a/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/chat/Strategy.kt b/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/chat/Strategy.kt index b8fa6dd..452a8ad 100644 --- a/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/chat/Strategy.kt +++ b/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/chat/Strategy.kt @@ -23,12 +23,10 @@ import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.coroutineScope import androidx.lifecycle.viewmodel.compose.viewModel -import com.tunjid.demo.common.ui.data.ChatsRepository -import com.tunjid.demo.common.ui.data.ProfileRepository import com.tunjid.demo.common.ui.data.SampleDestination import com.tunjid.demo.common.ui.data.SampleDestination.NavTabs import com.tunjid.treenav.compose.threepane.ThreePane -import com.tunjid.treenav.compose.threepane.configurations.movableSharedElementScope +import com.tunjid.treenav.compose.threepane.configurations.requireThreePaneMovableSharedElementScope import com.tunjid.treenav.compose.threepane.threePaneListDetailStrategy fun chatPaneStrategy() = threePaneListDetailStrategy( @@ -48,7 +46,7 @@ fun chatPaneStrategy() = threePaneListDetailStrategy( ) } ChatScreen( - movableSharedElementScope = movableSharedElementScope(), + movableSharedElementScope = requireThreePaneMovableSharedElementScope(), state = viewModel.state.collectAsStateWithLifecycle().value, onAction = viewModel.accept, modifier = Modifier.fillMaxSize(), diff --git a/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/chatrooms/Strategy.kt b/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/chatrooms/Strategy.kt index 30340a2..273b8ba 100644 --- a/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/chatrooms/Strategy.kt +++ b/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/chatrooms/Strategy.kt @@ -24,7 +24,7 @@ import androidx.lifecycle.coroutineScope import androidx.lifecycle.viewmodel.compose.viewModel import com.tunjid.demo.common.ui.data.ChatsRepository import com.tunjid.demo.common.ui.data.SampleDestination -import com.tunjid.treenav.compose.threepane.configurations.movableSharedElementScope +import com.tunjid.treenav.compose.threepane.configurations.requireThreePaneMovableSharedElementScope import com.tunjid.treenav.compose.threepane.threePaneListDetailStrategy fun chatRoomPaneStrategy( @@ -38,7 +38,7 @@ fun chatRoomPaneStrategy( ) } ChatRoomsScreen( - movableSharedElementScope = movableSharedElementScope(), + movableSharedElementScope = requireThreePaneMovableSharedElementScope(), state = viewModel.state.collectAsStateWithLifecycle().value, onAction = viewModel.accept, modifier = Modifier.fillMaxSize(), diff --git a/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/me/Strategy.kt b/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/me/Strategy.kt index e220aaf..a16fccb 100644 --- a/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/me/Strategy.kt +++ b/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/me/Strategy.kt @@ -23,7 +23,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel import com.tunjid.demo.common.ui.data.SampleDestination import com.tunjid.demo.common.ui.profile.ProfileScreen import com.tunjid.demo.common.ui.profile.ProfileViewModel -import com.tunjid.treenav.compose.threepane.configurations.movableSharedElementScope +import com.tunjid.treenav.compose.threepane.configurations.requireThreePaneMovableSharedElementScope import com.tunjid.treenav.compose.threepane.threePaneListDetailStrategy fun mePaneStrategy( @@ -38,7 +38,7 @@ fun mePaneStrategy( ) } ProfileScreen( - movableSharedElementScope = movableSharedElementScope(), + movableSharedElementScope = requireThreePaneMovableSharedElementScope(), state = viewModel.state.collectAsStateWithLifecycle().value, onAction = viewModel.accept ) diff --git a/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/profile/Strategy.kt b/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/profile/Strategy.kt index 26658a3..de8a569 100644 --- a/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/profile/Strategy.kt +++ b/sample/common/src/commonMain/kotlin/com/tunjid/demo/common/ui/profile/Strategy.kt @@ -25,7 +25,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel import com.tunjid.demo.common.ui.data.SampleDestination import com.tunjid.demo.common.ui.data.SampleDestination.NavTabs import com.tunjid.treenav.compose.threepane.ThreePane -import com.tunjid.treenav.compose.threepane.configurations.movableSharedElementScope +import com.tunjid.treenav.compose.threepane.configurations.requireThreePaneMovableSharedElementScope import com.tunjid.treenav.compose.threepane.threePaneListDetailStrategy fun profilePaneStrategy() = threePaneListDetailStrategy( @@ -48,7 +48,7 @@ fun profilePaneStrategy() = threePaneListDetailStrategy( ) } ProfileScreen( - movableSharedElementScope = movableSharedElementScope(), + movableSharedElementScope = requireThreePaneMovableSharedElementScope(), state = viewModel.state.collectAsStateWithLifecycle().value, onAction = viewModel.accept, modifier = Modifier.fillMaxSize(),