Skip to content

Architecture

Ivan Schütz edited this page Jul 23, 2020 · 12 revisions
  • The core of the app (domain logic / networking / database) was ported to Rust, in order to be able to share it with the iOS app. This language offers the same performance of C, while being much more safe and ergonomic. The repository can be found here
  • This app doesn't directly depend on the Rust core though: There's a core Android library (that also lives in the Rust repo), that contains the Kotlin representation of the domain and does the JNI "heavy lifting", in order to provide a safe interface to this app. This way, this app is very simple to use: "core" is managed as a regular external dependency and developers don't have to touch anything Rust related (unless they want to).

Other than that, this app uses a conventional modern Android tech stack:

  • Single activity app (fragments based).
  • RxJava 2
  • MVVM
  • Koin
  • LiveData in the outer seams (ViewModel -> Fragment) to add lifecycle handling.
  • One way data binding (ViewModel -> UI)
  • Navigation component
  • Initially Room. It was replaced with Realm, due to performance requirements for the TCN matching, but these are outdated now. The database is now expected to be migrated to the Rust library, which uses Sqlite.
  • Occasionally coroutines, e.g. it was easier to parallelize the matching with them than with RxJava. This was moved now to the Rust library, though.
  • There are currently no tests, because they were moved to the Rust library / the Android core app. This may change, though the idea is to prioritize testing the domain logic and services, which are in core.
  • The bluetooth part of the contact tracing protocol, resides in the Android TCN library
  • The cryptography part of the contact tracing protocol, while also provided by the Android TCN library, resides in the Rust reference implementation. This is part (albeit a small one) of the reason we decided to write core in Rust.
Clone this wiki locally