truetime-android icon indicating copy to clipboard operation
truetime-android copied to clipboard

TrueTime 4.0 : Kotlin & coroutines

Open kaushikgopal opened this issue 4 years ago • 1 comments

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:

  • [x] update README to show Rx vs Coroutines usage
  • [x] add nice background syncer

kaushikgopal avatar Nov 26 '20 03:11 kaushikgopal

Super excited about this!

Jawnnypoo avatar Nov 30 '20 16:11 Jawnnypoo

Is there any timeline for this PR?

vandac avatar Dec 06 '22 15:12 vandac

@kaushikgopal do we any timeline for this PR?

stAyushJain avatar Feb 06 '23 06:02 stAyushJain

🙈 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 avatar Feb 06 '23 16:02 kaushikgopal

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

kaushikgopal avatar Mar 10 '23 04:03 kaushikgopal

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 :)

alfredkallasbforbank avatar Feb 20 '24 16:02 alfredkallasbforbank