https://kotlinlang.org logo
Title
y

yschimke

05/01/2023, 4:25 PM
I took a look at what is required to support Wear navigation if we drop Compose Navigation. Seems reasonably straightforward. https://github.com/xxfast/NYTimes-KMP/pull/15
You basically end up with this thing observing and popping off the top destination
SwipeToDismissBox(
      onDismissed = { router.pop() },
      state = rememberSwipeToDismissBoxState(),
      backgroundKey = background?.configuration ?: SwipeToDismissKeys.Background,
      hasBackground = background != null,
      contentKey = active.configuration,
    ) { isBackground ->
      val child = if (isBackground) requireNotNull(background) else active
      holder.SaveableStateProvider(child.configuration.key()) {
        CompositionLocalProvider(LocalComponentContext provides child.instance) {
          HierarchicalFocusCoordinator(requiresFocus = { !isBackground }) {
            content(child.configuration)
          }
        }
      }
    }
Voyager already had this as a sample https://github.com/adrielcafe/voyager/issues/81
x

xxfast

05/04/2023, 10:37 PM
I've moved some of your implementations over to decompose-router-wear module. Thanks again @yschimke for your contributions
y

yschimke

05/04/2023, 10:43 PM
Awesome, I think Arkadii wrote most of it