Skip to content
Snippets Groups Projects
Unverified Commit dae5177a authored by Philipp Woessner's avatar Philipp Woessner Committed by GitHub
Browse files

fixed test api permission dialog bug and display the latest available key date (#844)

parent fccc32a8
No related branches found
No related tags found
No related merge requests found
...@@ -68,6 +68,7 @@ import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_ ...@@ -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_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_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_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.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.qr_code_viewpager
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.test_api_switch_last_three_hours_from_server 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 ...@@ -76,6 +77,8 @@ import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.text_s
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
import timber.log.Timber import timber.log.Timber
import java.io.File import java.io.File
import java.lang.reflect.Type import java.lang.reflect.Type
...@@ -156,6 +159,8 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel ...@@ -156,6 +159,8 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel
internalExposureNotificationPermissionHelper = internalExposureNotificationPermissionHelper =
InternalExposureNotificationPermissionHelper(this, this) InternalExposureNotificationPermissionHelper(this, this)
getExposureKeys()
qrPager = qr_code_viewpager qrPager = qr_code_viewpager
qrPagerAdapter = QRPagerAdapter() qrPagerAdapter = QRPagerAdapter()
qrPager.adapter = qrPagerAdapter qrPager.adapter = qrPagerAdapter
...@@ -267,7 +272,6 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel ...@@ -267,7 +272,6 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel
super.onResume() super.onResume()
updateExposureSummaryDisplay(null) updateExposureSummaryDisplay(null)
getExposureKeys()
} }
private val prettyKey = { key: AppleLegacyKeyExchange.Key -> private val prettyKey = { key: AppleLegacyKeyExchange.Key ->
...@@ -437,6 +441,13 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel ...@@ -437,6 +441,13 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel
) )
label_my_keys.text = myKeysLabelAndCount label_my_keys.text = myKeysLabelAndCount
text_my_keys.text = myExposureKeysJSON 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) { private fun showToast(message: String) {
...@@ -453,8 +464,7 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel ...@@ -453,8 +464,7 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel
} }
override fun onKeySharePermissionGranted(keys: List<TemporaryExposureKey>) { override fun onKeySharePermissionGranted(keys: List<TemporaryExposureKey>) {
myExposureKeysJSON = myExposureKeysJSON = keysToJson(keys)
keysToJson(keys)
myExposureKeys = keys myExposureKeys = keys
qrPagerAdapter.notifyDataSetChanged() qrPagerAdapter.notifyDataSetChanged()
......
...@@ -104,6 +104,12 @@ ...@@ -104,6 +104,12 @@
android:layout_marginTop="@dimen/spacing_normal" android:layout_marginTop="@dimen/spacing_normal"
android:text="@string/test_api_body_my_keys" /> 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 <TextView
android:id="@+id/text_my_keys" android:id="@+id/text_my_keys"
android:layout_width="match_parent" android:layout_width="match_parent"
......
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