diff --git a/Corona-Warn-App/src/deviceForTesters/java/de.rki.coronawarnapp/TestForAPIFragment.kt b/Corona-Warn-App/src/deviceForTesters/java/de.rki.coronawarnapp/TestForAPIFragment.kt index e69110730a16003b37b3c0d97b8dacbfff8b1636..e2ed3fd8a0490c0be28bb44e0a1e8d1e27b4de8a 100644 --- a/Corona-Warn-App/src/deviceForTesters/java/de.rki.coronawarnapp/TestForAPIFragment.kt +++ b/Corona-Warn-App/src/deviceForTesters/java/de.rki.coronawarnapp/TestForAPIFragment.kt @@ -68,6 +68,7 @@ import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_ import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_exposure_summary_maximumRiskScore import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_exposure_summary_summationRiskScore import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_googlePlayServices_version +import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_latest_key_date import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_my_keys import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.qr_code_viewpager import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.test_api_switch_last_three_hours_from_server @@ -76,6 +77,8 @@ import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.text_s import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import org.joda.time.DateTime +import org.joda.time.DateTimeZone import timber.log.Timber import java.io.File import java.lang.reflect.Type @@ -156,6 +159,8 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel internalExposureNotificationPermissionHelper = InternalExposureNotificationPermissionHelper(this, this) + getExposureKeys() + qrPager = qr_code_viewpager qrPagerAdapter = QRPagerAdapter() qrPager.adapter = qrPagerAdapter @@ -267,7 +272,6 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel super.onResume() updateExposureSummaryDisplay(null) - getExposureKeys() } private val prettyKey = { key: AppleLegacyKeyExchange.Key -> @@ -437,6 +441,13 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel ) label_my_keys.text = myKeysLabelAndCount text_my_keys.text = myExposureKeysJSON + + myKeys?.maxBy { it.rollingStartIntervalNumber }?.rollingStartIntervalNumber?.toLong()?.let { + val ms = it * 60L * 10L * 1000L + val dateString = DateTime(ms, DateTimeZone.UTC) + + label_latest_key_date.text = "Latest key is from: $dateString" + } } private fun showToast(message: String) { @@ -453,8 +464,7 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel } override fun onKeySharePermissionGranted(keys: List<TemporaryExposureKey>) { - myExposureKeysJSON = - keysToJson(keys) + myExposureKeysJSON = keysToJson(keys) myExposureKeys = keys qrPagerAdapter.notifyDataSetChanged() diff --git a/Corona-Warn-App/src/deviceForTesters/res/layout/fragment_test_for_a_p_i.xml b/Corona-Warn-App/src/deviceForTesters/res/layout/fragment_test_for_a_p_i.xml index 67aac4b5a4a562dd7bab639508c1b321ab183cae..d53fe72b0896a119c1899be32fc5c765371ef6ef 100644 --- a/Corona-Warn-App/src/deviceForTesters/res/layout/fragment_test_for_a_p_i.xml +++ b/Corona-Warn-App/src/deviceForTesters/res/layout/fragment_test_for_a_p_i.xml @@ -104,6 +104,12 @@ android:layout_marginTop="@dimen/spacing_normal" android:text="@string/test_api_body_my_keys" /> + <TextView + android:id="@+id/label_latest_key_date" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="Latest key is from: -" /> + <TextView android:id="@+id/text_my_keys" android:layout_width="match_parent"