Skip to content

amirulzin/Candleflask

Repository files navigation

LOGO

CandleFlask

A streaming offline first US stock ticker Android app based on Tiingo API free tier.

Overview

  • Clean architecture
  • OkHttp WebSocket + Moshi with multivariate JSON parsing + Retrofit
  • Device DayNight support ( see ThemedTypedValues and attrs.xml)
  • Latest AAC ViewModel + Jetpack Navigation + Room
  • Coroutine + StateFlows
  • Hilt - Focus on only constructor-based injection. Classes with non-injectable constructors are provided by delegate classes ( e.g DelegatedDispatchers)
  • Joda BigMoney (Feel free to look at some of the historical core tests for case failures with BigDecimal)
  • Various unit tests for core, core-framework (infrastructure), AAC ViewModels and UI layers
  • Sample integration test (at core-framework only for now)
  • StrictMode friendly ( refer StrictModeDefaults)

Pics

Musings

  • There were indeed some IO calls during OkHttp initialization. Hence why any OkHttpClient injection is provided via a Provider instead
  • Lifecycle launch is executing on Dispatchers.Main due to Lifecycle.addObserver requirements
    • Any first access to AAC ViewModel in suspend blocks may incur IO thread penalty if you're not careful
    • Thus, always opt for lazy whenever you're touching repository layers and below
  • DayNight is surprisingly easy to implement once you start abusing attrs
  • The current Gradle modules (core, core-framework, candleflask-android) still doesn't scream correct to me. I'm all ears for opinions.

Upcoming

  • Even more unit tests
  • UI to ViewModel behavior tests

Building

All contributions are welcomed. Simply branch out fromdevelop, follow the current commit messages style, squash, and submit your Pull Request.

For integration tests, you can add your own Tiingo API key in the project local.properties via

INTEGRATION_TEST_API_KEY=myKeyValue

Run ./gradlew testDebug to run all tests.

Minor Notes

Since it was wired manually from scratch, feel free to extract the Tiingo datasource packages into your own projects/libraries. A Tiingo library was planned initially but scrapped due to lack of time. Therefore the models were intentionally left as exhaustive as possible as per the latest API spec.

License

This project is provided under the Apache 2.0 License

About

Android streaming stock ticker app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages