Skip to content
Snippets Groups Projects
Unverified Commit 3dfd4d8e authored by Lukas Lechner's avatar Lukas Lechner Committed by GitHub
Browse files

Adapt 'fake correct device time' feature (DEV) (#2320)


* Set offset to zero instead of 90 when 'fakeCorrectDeviceTime' is active

* Add a description of the 'Fake correct device time' feature in the Test Menu

Co-authored-by: default avatarRalf Gehrer <ralfgehrer@users.noreply.github.com>
Co-authored-by: default avatarMatthias Urhahn <matthias.urhahn@sap.com>
Co-authored-by: default avatarharambasicluka <64483219+harambasicluka@users.noreply.github.com>
parent f4298240
No related branches found
No related tags found
No related merge requests found
......@@ -90,6 +90,12 @@
android:layout_weight="1"
android:text="Fake correct device time" />
<TextView
style="@style/TextAppearance.AppCompat.Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_tiny"
android:text="This sets the offset between server time and device time to 0 and therefore allows device time travelling while still getting positive device time checks." />
</LinearLayout>
<LinearLayout
......
......@@ -66,8 +66,8 @@ class AppConfigServer @Inject constructor(
val serverTime = response.getServerDate() ?: localTime
val offset = if (CWADebug.isDeviceForTestersBuild && testSettings.fakeCorrectDeviceTime.value) {
Timber.tag(TAG).w("Test setting 'fakeCorrectDeviceTime' is active; time offset is now +90min.")
Duration.standardMinutes(90)
Timber.tag(TAG).w("Test setting 'fakeCorrectDeviceTime' is active; time offset is now 0")
Duration.ZERO
} else {
Duration(serverTime, localTime)
}
......
......@@ -193,7 +193,7 @@ class AppConfigServerTest : BaseIOTest() {
createInstance().downloadAppConfig() shouldBe InternalConfigData(
rawData = APPCONFIG_RAW,
serverTime = Instant.parse("2020-11-03T06:35:16.000Z"),
localOffset = Duration.standardMinutes(90),
localOffset = Duration.ZERO,
etag = "I am an ETag :)!",
cacheValidity = Duration.standardSeconds(300)
)
......
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