hotwired / hotwire-native-android

Hotwire Native for Android
MIT License
39 stars 5 forks source link

Introduce top-level `Navigator` as the entry point for all navigation #41

Closed jayohms closed 6 months ago

jayohms commented 6 months ago

Previously in turbo-android, the library was structured like:

SessionNavHostFragment
  -> Session
    -> WebView

This makes substantial changes to make the library more inline with the iOS library. Instead of navigation APIs existing in multiple places, such as the *ActivityDelegate and the *Destination interfaces, all navigation flows through a single Navigator API. The structure looks like:

NavigatorHost
  -> Navigator
    -> Session
      -> WebView

This reduces the need to ever interact directly with a NavHostFragment or a Session. The Navigator (available in the HotwireActivity and every destination screen) provides all the navigation APIs an app needs:

navigator.route(url)
navigator.pop()
navigator.clearAll()
navigator.reset()