Skip to content
Snippets Groups Projects
Unverified Commit 647848d6 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Improved AppConfig logic for 1.7.x and 1.8.x (EXPOSUREAPP-3455) (#1520)


* Split and hide the protobuf config behind interfaces with individual mappers responsible for creating the desired formats.

* Merge branch 'release/1.7.x' into feature/3455-more-frequent-riskscore-updates-configs

# Conflicts:
#	Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/risklevel/ui/TestRiskLevelCalculationFragmentCWAViewModel.kt
#	Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/RiskLevelTransaction.kt
#	Corona-Warn-App/src/test/java/de/rki/coronawarnapp/transaction/RiskLevelTransactionTest.kt

* Make the AppConfig observable.
Provide the server time offset.
Offer a lastUpdatedAt timestamp.
Add an app config specific test screen.
Clean up test screens a bit and move debug options out of API test options.

* Fix test regression due to refactoring (moved code around).

* Store the server timestamp and offset at retrieval.
Switch to config storage via json to be able to store additional meta data fields (i.e. time).

* KLint and Me have a hate relationship based on both mutual admiration.

* Fix time offset parsing being locale dependent.

* Fix broken unit tests.

* Improve offset accuracy, move before unzipping.

* Fix overly long livedata subscription to results (viewmodel scope vs observer scope)

* Add mapping for the new protobuf configs + tests.

* For cached (retrofit) response, we need to check the cacheResponse and its timestamps
to determine an accurate time offset.

* Exposure a boolean property to tell us when a fallback config is being used.

* Hide the observable flow<ConfigData> behind a method that can automatically triggers refreshes.

* Use a common mapper interface.

* Address PR comments and KLints.

* Fix refactoring regression.

* Improve config unzipping code.

* Add flag to forward exception thrown during HotDataFlow.kt initialization.

* Don't specify a default context via singleton.

* Move download and fallback logic into it's own class just responsible for sourcing the config: "AppConfigSource".
"AppConfigProvider" is now only responsible for making it available.

* Simplify current concepts for making the app config observable until we have a default configuration.

* Improve app config test screen, delete options, better feedback.
Show toast instead of crash on errors.

* Fixed GSON serialization not encoding/decoding the byte array correctly.
Added specific type adapters for instant and duration to get cleaner json.

* Remove type adapters from base gson due to conflict with CalculationTrackerStorage.

* We want to default to forced serialization of instant by our converters, instead of using the default serialization which will differ
between Java8.Instant and JodaTime.Instant, to prevent future headaches there, register explicit converters by default,
and overwrite them if necessary (currently only needed for CalculationTrackerStorage.kt).

* Improve AppConfigServer code readability by moving code into extensions.

* Fix merge conflicts

* Throw a more specific exception if gson type decoding fails due to malformed base64 encoding.

* Add unit test for Gson ByteArrayAdapter.

Co-authored-by: default avatarharambasicluka <64483219+harambasicluka@users.noreply.github.com>
parent 64cc57b9
No related branches found
No related tags found
No related merge requests found
Showing
with 688 additions and 448 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment