Git Product home page Git Product logo

Comments (6)

chRyNaN avatar chRyNaN commented on August 25, 2024 1

The navigation events are timestamped:

  • This allows each event, even subsequent ones of the same type, to be emitted since they are considered different. (StateFlows by nature perform similarly to the distinctUntilChanged operator in that they do not emit the same value twice in a row). The timestamp makes sure that all events are accessed, for instance, two goBack calls will actually go back twice.
  • In a future release, replay/time-travel features can be introduced which will help with debugging. This requires some concept of time tracking of the events.
  • Whatever model is used for storing time for an event must be serializable with kotlinx serialization as that is used to store and restore the state of a Navigator between configuration changes within the app via the rememberSavableNavigator calls.
  • The kotlinx datetime library already provides an abstraction layer (expect/actual) of the Instant type. No need to duplicate this abstraction.

It is possible that I can change the timestamp value from an Instant to perhaps a local clock value. This would remove the dependency on kotlinx.datetime but might produce issues if for whatever reason the local clock restarts or comes out of sync. This will also prevent restoring to a previous Navigator state using serialization as the local clock times will be different (other than for short ranges as it is used now, such as between processes in a Bundle), though that is out of scope anyway.

from navigation.

chRyNaN avatar chRyNaN commented on August 25, 2024

expect/actual would not solve this problem. You should be able to add the kotlinx.datetime dependency to your project and may also need to use Android desugaring which allows usage of the java.time components in Android (which is what kotlinx.datetime's actual implementation uses on Android and JVM).

https://developer.android.com/studio/write/java8-support-table

from navigation.

wakaztahir avatar wakaztahir commented on August 25, 2024

I've done it for the time being as I don't want latest version to crash on devices But since this is a navigation library I expected it to not rely on kotlinx datetime and work without desugaring I think that'd be a plus +1

from navigation.

chRyNaN avatar chRyNaN commented on August 25, 2024

I will look into including the Android Desugaring process in the library's build file for a future release.

from navigation.

wakaztahir avatar wakaztahir commented on August 25, 2024

Why is using kotlin date time important...?

from navigation.

chRyNaN avatar chRyNaN commented on August 25, 2024

This is addressed by the following PR and will the fix will be out in the next release: #10

from navigation.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.