instacart / truetime-android

Android NTP time library. Get the true current time impervious to device clock time changes
https://tech.instacart.com/truetime/
Apache License 2.0
1.41k stars 194 forks source link

TrueTime 4.0 : Kotlin & coroutines #129

Closed kaushikgopal closed 1 year ago

kaushikgopal commented 3 years ago

Starting a branch to move the implementation purely into Kotlin + coroutines

While @Jawnnypoo painstakingly migrated TrueTime & TrueTimeRx to java, I wanted to keep those as is and rethink the api altogether. So keeping only the newer redesigned parts in Kotlin.

Changes

1. (almost) 100% Kotlin

Instacart is strongly committed to a Kotlin future. Moving TrueTime to Kotlin will 🀞🏽 make the maintenance of this library easier possibly encouraging external contributions and the improvement of this library. Anecdotally many folks have mentioned that they would be more inclined to dive in and contribute to TrueTime if it was in Kotlin (vs Java).

Notably SntpImpl remains in .java. This was originally forked from AOSP and most other implementations you find online are pretty similar to the original AOSP implementation. For this reason, we chose to intentionally just keep this in Java. We have however cleaned it up and extracted a lot of the logic we'd previously nested in this class.

2. Coroutines

Coroutines comes baked in with Kotlin. As Google continues to push Coroutines more heavily, there's a higher likelihood that an app would already have Coroutines than it would Rx. We want Truetime to be easily integrated into an app pulling minimal external dependencies along the way.

3. Isolating Android dependencies to a single package

We previously distributed two versions of TrueTime & TrueTimeRx. We're aiming for TrueTime to be pure .kt without any android dependencies/requirements. For distribution reasons, we're going to keep it simple and have it included with TrueTime.

4. Numerous Breaking API changes

The above changes were going to be a major overhaul. Given the inevitable breaking changes, we wanted to take this chance and rethink the API from scratch anyway, making it more nimble/modern. Will update the README with the newest changes.

TODOs:

Jawnnypoo commented 3 years ago

Super excited about this!

vandac commented 1 year ago

Is there any timeline for this PR?

stAyushJain commented 1 year ago

@kaushikgopal do we any timeline for this PR?

kaushikgopal commented 1 year ago

πŸ™ˆ i really don't want to give timelines (for fear of jinxing it), but we're actively working on the revamp. i'd imagine something close in the next few months. I'm hoping earlier but past experience has taught me to say otherwise.

kaushikgopal commented 1 year ago

@vandac @stAyushJain : merged! you can take it for a spin and let me know what you observe

alfredkallasbforbank commented 6 months ago

Hello @kaushikgopal @Jawnnypoo, No more major overhaul of this library ? is it still supported or can be used ? or is it dropped entirely ?

Thank you for your replies :)