Skip to content

dgmltn/WorldClock

Repository files navigation

World Clock

A simple world clock application that displays the current time in various cities around the world. It uses open-meteo to find city coordinates and Mapbox to display a static map with markers for each city. It uses Kastro to calculate current day/night for each city.

Built with Kotlin Multiplatform + Compose Multiplatform, targeting Android and iOS. See ARCHITECTURE.md for the module layout.

Building

Android:

./gradlew :app-android:assembleDebug

iOS (requires XcodeGen):

cd app-ios && xcodegen generate && open WorldClock.xcodeproj

Tests:

./gradlew :domain:jvmTest :data:jvmTest :ui:testAndroidHostTest

Both app targets need the MAPBOX_ACCESS_TOKEN Gradle property (see below).

Design

Shamelessly uses the awesome design by Omar Faizan, which can be found here and here.

APIs

City Geocoding API here

https://geocoding-api.open-meteo.com/v1/search?name=Ber&count=5&language=en&format=json

This returns a JSON response with city information, including latitude, longitude, timezone, and administrative divisions:

{
  "results": [
    {
      "name": "Berlin",
      "country": "Germany",
      "latitude": 52.52,
      "longitude": 13.405,
      "timezone": "Europe/Berlin",
      "admin1": "State of Berlin",
      "admin2": "Berlin, Stadt",
      "admin3": "Berlin"
    }
  ]
}

Mapbox Mapping API

World Clock uses Mapbox Static Map API to display a static map with markers for each city.

To use Mapbox, you need to sign up for an account and obtain an access token.

Store your Mapbox Access Token in your environment as described here.

Mapbox Static Map API here:

https://docs.mapbox.com/api/maps/static-images/ https://console.mapbox.com/studio/styles/jesterwrestler/cmcu29qe2006001r47g1k3n4d/edit/#11/40.73/-74

Sun position API

https://github.com/yoxjames/Kastro

TODO

  • Use GeoKJSON to calculate distance two points in the database
  • Add more info to each city:
    • Day/Night timeline
    • 9am/5pm timeline
    • Info for contacts in each city

About

KMP App implementing a simple world clock design from Dribbble

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages