Skip to content
Snippets Groups Projects
Unverified Commit e15c3827 authored by Chilja Gossow's avatar Chilja Gossow Committed by GitHub
Browse files

replace with sha256 (#3178)

parent 13839b90
No related branches found
No related tags found
No related merge requests found
Showing with 15 additions and 16 deletions
......@@ -134,7 +134,7 @@ class HomeFragment : Fragment(R.layout.home_fragment_layout), AutoInject {
}
}
is HomeFragmentEvents.GoToVaccinationList -> findNavController().navigate(
VaccinationListFragment.navigationUri(event.personIdentifierCode)
VaccinationListFragment.navigationUri(event.personIdentifierCodeSha256)
)
}
}
......
......@@ -12,5 +12,5 @@ sealed class HomeFragmentEvents {
data class ShowDeleteTestDialog(val type: CoronaTest.Type) : HomeFragmentEvents()
data class GoToVaccinationList(val personIdentifierCode: String) : HomeFragmentEvents()
data class GoToVaccinationList(val personIdentifierCodeSha256: String) : HomeFragmentEvents()
}
......@@ -320,7 +320,7 @@ class HomeFragmentViewModel @AssistedInject constructor(
vaccinatedPerson = vaccinatedPerson,
onClickAction = {
popupEvents.postValue(
HomeFragmentEvents.GoToVaccinationList(vaccinatedPerson.identifier.code)
HomeFragmentEvents.GoToVaccinationList(vaccinatedPerson.identifier.codeSHA256)
)
}
)
......@@ -328,7 +328,7 @@ class HomeFragmentViewModel @AssistedInject constructor(
vaccinatedPerson = vaccinatedPerson,
onClickAction = {
popupEvents.postValue(
HomeFragmentEvents.GoToVaccinationList(vaccinatedPerson.identifier.code)
HomeFragmentEvents.GoToVaccinationList(vaccinatedPerson.identifier.codeSHA256)
)
}
)
......
......@@ -36,7 +36,7 @@ class VaccinationListFragment : Fragment(R.layout.fragment_vaccination_list), Au
constructorCall = { factory, _ ->
factory as VaccinationListViewModel.Factory
factory.create(
personIdentifierCode = args.personIdentifierCode
personIdentifierCode = args.personIdentifierCodeSha256
)
}
)
......@@ -124,7 +124,7 @@ class VaccinationListFragment : Fragment(R.layout.fragment_vaccination_list), Au
}
companion object {
fun navigationUri(personIdentifierCode: String) =
"coronawarnapp://vaccination-list/$personIdentifierCode".toUri()
fun navigationUri(personIdentifierCodeSha256: String) =
"coronawarnapp://vaccination-list/$personIdentifierCodeSha256".toUri()
}
}
......@@ -21,13 +21,13 @@ import kotlinx.coroutines.flow.map
class VaccinationListViewModel @AssistedInject constructor(
vaccinationRepository: VaccinationRepository,
@Assisted private val personIdentifierCode: String
@Assisted private val personIdentifierCodeSha256: String
) : CWAViewModel() {
val events = SingleLiveEvent<Event>()
private val vaccinatedPersonFlow = vaccinationRepository.vaccinationInfos.map { vaccinatedPersonSet ->
vaccinatedPersonSet.single { it.identifier.code == personIdentifierCode }
vaccinatedPersonSet.single { it.identifier.codeSHA256 == personIdentifierCodeSha256 }
}
val uiState: LiveData<UiState> = vaccinatedPersonFlow.map { vaccinatedPerson ->
......
......@@ -53,7 +53,7 @@ class VaccinationQrCodeScanFragment :
doNavigate(
VaccinationQrCodeScanFragmentDirections
.actionVaccinationQrCodeScanFragmentToVaccinationListFragment(
event.personIdentifierCode
event.personIdentifierCodeSha256
)
)
}
......
......@@ -26,7 +26,7 @@ class VaccinationQrCodeScanViewModel @AssistedInject constructor(
event.postValue(Event.QrCodeScanInProgress)
val qrCode = vaccinationQRCodeValidator.validate(barcodeResult.text)
val vaccinationCertificate = vaccinationRepository.registerVaccination(qrCode)
event.postValue(Event.QrCodeScanSucceeded(vaccinationCertificate.personIdentifier.code))
event.postValue(Event.QrCodeScanSucceeded(vaccinationCertificate.personIdentifier.codeSHA256))
} catch (e: Throwable) {
errorEvent.postValue(e)
}
......@@ -39,7 +39,7 @@ class VaccinationQrCodeScanViewModel @AssistedInject constructor(
sealed class Event {
object QrCodeScanInProgress : Event()
data class QrCodeScanSucceeded(val personIdentifierCode: String) : Event()
data class QrCodeScanSucceeded(val personIdentifierCodeSha256: String) : Event()
}
@AssistedFactory
......
......@@ -39,13 +39,12 @@
android:label="fragment_vaccination_list"
tools:layout="@layout/fragment_vaccination_list">
<argument
android:name="personIdentifierCode"
android:name="personIdentifierCodeSha256"
app:argType="string" />
<action
android:id="@+id/action_vaccinationListFragment_to_vaccinationDetailsFragment"
app:destination="@id/vaccinationDetailsFragment" />
<deepLink
app:uri="coronawarnapp://vaccination-list/{personIdentifierCode}" />
<deepLink app:uri="coronawarnapp://vaccination-list/{personIdentifierCodeSha256}" />
<action
android:id="@+id/action_vaccinationListFragment_to_vaccinationQrCodeScanFragment"
app:destination="@id/vaccinationQrCodeScanFragment" />
......@@ -66,4 +65,4 @@
android:name="de.rki.coronawarnapp.ui.information.InformationPrivacyFragment"
android:label="privacyFragment"
tools:layout="@layout/fragment_information_privacy" />
</navigation>
\ No newline at end of file
</navigation>
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