Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/1.5.x' into fix/code-smells-(EXPOSUREAPP-3058)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndroidMedaGalaxy committed Oct 7, 2020
2 parents 8b60acd + e17b605 commit 0267c84
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 68 deletions.
2 changes: 1 addition & 1 deletion Corona-Warn-App/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
applicationId 'de.rki.coronawarnapp'
minSdkVersion 23
targetSdkVersion 29
versionCode 44
versionCode 45
versionName "1.5.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
32 changes: 31 additions & 1 deletion Corona-Warn-App/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,34 @@
# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>
-keep,allowobfuscation interface <1>


##---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { <fields>; }

# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}

##---------------End: proguard configuration for Gson ----------
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.activity.OnBackPressedCallback
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.navigation.fragment.findNavController
import de.rki.coronawarnapp.R
import de.rki.coronawarnapp.databinding.FragmentSubmissionSymptomIntroBinding
import de.rki.coronawarnapp.submission.Symptoms
import de.rki.coronawarnapp.ui.doNavigate
import de.rki.coronawarnapp.ui.viewmodel.SubmissionViewModel
import de.rki.coronawarnapp.util.DialogHelper
import de.rki.coronawarnapp.util.formatter.formatBackgroundButtonStyleByState
import de.rki.coronawarnapp.util.formatter.formatButtonStyleByState
import de.rki.coronawarnapp.util.formatter.isEnableSymptomIntroButtonByState
Expand Down Expand Up @@ -45,20 +46,29 @@ class SubmissionSymptomIntroductionFragment : Fragment() {
super.onViewCreated(view, savedInstanceState)
setButtonOnClickListener()

submissionViewModel.symptomIntroductionEvent.observe(viewLifecycleOwner, Observer {
submissionViewModel.symptomIntroductionEvent.observe(viewLifecycleOwner, {
when (it) {
is SymptomIntroductionEvent.NavigateToSymptomCalendar -> navigateToNext()
is SymptomIntroductionEvent.NavigateToPreviousScreen -> navigateToPreviousScreen()
is SymptomIntroductionEvent.NavigateToPreviousScreen -> handleSubmissionCancellation()
}
})

submissionViewModel.symptomIndication.observe(viewLifecycleOwner, Observer {
submissionViewModel.symptomIndication.observe(viewLifecycleOwner, {
updateButtons(it)
})

requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, backCallback)

submissionViewModel.initSymptoms()
}

private val backCallback: OnBackPressedCallback =
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
submissionViewModel.onPreviousClicked()
}
}

private fun updateButtons(symptomIndication: Symptoms.Indication?) {
binding.submissionSymptomContainer.findViewById<Button>(R.id.target_button_apply)
.setTextColor(formatButtonStyleByState(symptomIndication, Symptoms.Indication.POSITIVE))
Expand Down Expand Up @@ -114,6 +124,26 @@ class SubmissionSymptomIntroductionFragment : Fragment() {
}
}

/**
* Opens a Dialog that warns user
* when they're about to cancel the submission flow
* @see DialogHelper
* @see navigateToPreviousScreen
*/
private fun handleSubmissionCancellation() {
DialogHelper.showDialog(
DialogHelper.DialogInstance(
requireActivity(),
R.string.submission_error_dialog_confirm_cancellation_title,
R.string.submission_error_dialog_confirm_cancellation_body,
R.string.submission_error_dialog_confirm_cancellation_button_positive,
R.string.submission_error_dialog_confirm_cancellation_button_negative,
true,
::navigateToPreviousScreen
)
)
}

private fun navigateToPreviousScreen() {
findNavController().doNavigate(
SubmissionSymptomIntroductionFragmentDirections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.content.Intent
import android.os.Bundle
import android.view.View
import android.view.accessibility.AccessibilityEvent
import androidx.activity.OnBackPressedCallback
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController
Expand Down Expand Up @@ -36,14 +35,6 @@ class SubmissionResultPositiveOtherWarningFragment :
private lateinit var internalExposureNotificationPermissionHelper:
InternalExposureNotificationPermissionHelper

// Overrides default back behaviour
private val backCallback: OnBackPressedCallback =
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
handleSubmissionCancellation()
}
}

override fun onResume() {
super.onResume()
binding.submissionPositiveOtherPrivacyContainer.sendAccessibilityEvent(AccessibilityEvent.TYPE_ANNOUNCEMENT)
Expand Down Expand Up @@ -100,7 +91,6 @@ class SubmissionResultPositiveOtherWarningFragment :

internalExposureNotificationPermissionHelper =
InternalExposureNotificationPermissionHelper(this, this)
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, backCallback)

setButtonOnClickListener()

Expand All @@ -120,30 +110,10 @@ class SubmissionResultPositiveOtherWarningFragment :
initiateWarningOthers()
}
binding.submissionPositiveOtherWarningHeader.headerButtonBack.buttonIcon.setOnClickListener {
handleSubmissionCancellation()
findNavController().popBackStack()
}
}

/**
* Opens a Dialog that warns user
* when they're about to cancel the submission flow
* @see DialogHelper
* @see navigateToSubmissionResultFragment
*/
fun handleSubmissionCancellation() {
DialogHelper.showDialog(
DialogHelper.DialogInstance(
requireActivity(),
R.string.submission_error_dialog_confirm_cancellation_title,
R.string.submission_error_dialog_confirm_cancellation_body,
R.string.submission_error_dialog_confirm_cancellation_button_positive,
R.string.submission_error_dialog_confirm_cancellation_button_negative,
true,
::navigateToSubmissionResultFragment
)
)
}

private fun navigateToSubmissionResultFragment() =
findNavController().doNavigate(
SubmissionResultPositiveOtherWarningFragmentDirections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,13 @@
app:step_entry_final="false"
app:step_entry_icon="@drawable/ic_test_result_step_done" />

<de.rki.coronawarnapp.ui.view.SimpleStepEntry
android:id="@+id/test_result_positive_steps_positive_result"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/test_result_positive_steps_added"
app:simple_step_entry_text="@string/submission_test_result_positive_steps_positive_body"
app:simple_step_entry_title="@string/submission_test_result_positive_steps_positive_heading"
app:step_entry_final="false"
app:step_entry_icon="@drawable/ic_test_result_step_done" />

<de.rki.coronawarnapp.ui.view.SimpleStepEntry
android:id="@+id/test_result_positive_steps_warning_others"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/test_result_positive_steps_positive_result"
app:layout_constraintTop_toBottomOf="@+id/test_result_positive_steps_added"
app:simple_step_entry_text="@string/submission_test_result_positive_steps_warning_others_body"
app:simple_step_entry_title="@string/submission_test_result_positive_steps_warning_others_heading"
app:step_entry_final="true"
Expand Down
2 changes: 1 addition & 1 deletion Corona-Warn-App/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@
<!-- XTXT: error dialog - text when a catastrophic error occured from which the app recovered automatically via data reset -->
<string name="errors_generic_text_catastrophic_error_recovery_via_reset">"Приложението беше върнато към изходно състояние поради технически проблем. Това няма да се отрази на работата му. Ще продължите да получавате известия за излаганията и ще можете да предупредите околните в случай на положителен тест за COVID-19."</string>
<!-- XTXT: error dialog - link for the details button in the catastrophic error recovery dialog -->
<string name="errors_generic_text_catastrophic_error_encryption_failure">"https://www.coronawarn.app/en/faq/#cause9002"</string>
<string name="errors_generic_text_catastrophic_error_encryption_failure">"https://www.coronawarn.app/en/faq/#cause9002_recovery"</string>

<!-- ####################################
Just for Development
Expand Down
8 changes: 2 additions & 6 deletions Corona-Warn-App/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -843,10 +843,6 @@
<string name="submission_test_result_negative_steps_negative_body">"Der Labortest hat keinen Nachweis für das Coronavirus SARS-CoV-2 bei Ihnen ergeben. \n\nBitte entfernen Sie den Test wieder aus der Corona-Warn-App, damit Sie bei Bedarf einen neuen Test hinterlegen können."</string>
<!-- XBUT: negative test result : remove the test button -->
<string name="submission_test_result_negative_remove_test_button">"Test entfernen"</string>
<!-- XHED: Page headline for positive test result screen -->
<string name="submission_test_result_positive_steps_positive_heading">"Ihr Testergebnis"</string>
<!-- YTXT: Body text for next steps section of test positive result-->
<string name="submission_test_result_positive_steps_positive_body">"Ihr Testergebnis wurde als positiv verifiziert."</string>
<!-- XHED: Page headline for other warnings screen -->
<string name="submission_test_result_positive_steps_warning_others_heading">"Andere warnen"</string>
<!-- YTXT: Body text for for other warnings screen-->
Expand Down Expand Up @@ -1182,9 +1178,9 @@
<!-- XTXT: error dialog - text when no error description is available -->
<string name="errors_generic_text_unknown_error_cause">"Ein unbekannter Fehler ist aufgetreten."</string>
<!-- XTXT: error dialog - text when a catastrophic error occured from which the app recovered automatically via data reset -->
<string name="errors_generic_text_catastrophic_error_recovery_via_reset">"Aufgrund eines technischen Problems wurde Ihre App zurückgesetzt. Das hat jedoch keine Auswirkungen auf die Verwendung der App. Sie werden weiterhin über Risiko-Begegnungen benachrichtigt und können andere warnen, falls Sie positiv auf COVID-19 getestet wurden."</string>
<string name="errors_generic_text_catastrophic_error_recovery_via_reset">"Aufgrund eines technischen Problems wurde Ihre App zurückgesetzt. Dies hat keine Auswirkung auf die Risiko-Ermittlung und damit auf Ihren Risikostatus. Sie werden weiterhin über Risiko-Begegnungen benachrichtigt und können andere warnen, falls Sie positiv auf COVID-19 getestet wurden. Durch das Zurücksetzen der App gehen aber zuvor eingelesene QR-Codes für die elektronische Benachrichtigung über Ihre Testergebnisse verloren. Bitte wenden Sie sich an Ihren Hausarzt oder Labor, um Ihr Testergebnis zu erfahren."</string>
<!-- XTXT: error dialog - link for the details button in the catastrophic error recovery dialog -->
<string name="errors_generic_text_catastrophic_error_encryption_failure">"https://www.coronawarn.app/de/faq/#cause9002"</string>
<string name="errors_generic_text_catastrophic_error_encryption_failure">"https://www.coronawarn.app/de/faq/#cause9002_recovery"</string>

<!-- ####################################
Just for Development
Expand Down
2 changes: 1 addition & 1 deletion Corona-Warn-App/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@
<!-- XTXT: error dialog - text when a catastrophic error occured from which the app recovered automatically via data reset -->
<string name="errors_generic_text_catastrophic_error_recovery_via_reset">"Your app was reset due to a technical problem. This has no effect on the app\'s functionality. You will continue to be notified about exposures and still be able to warn others, should you be tested positive for COVID-19."</string>
<!-- XTXT: error dialog - link for the details button in the catastrophic error recovery dialog -->
<string name="errors_generic_text_catastrophic_error_encryption_failure">"https://www.coronawarn.app/en/faq/#cause9002"</string>
<string name="errors_generic_text_catastrophic_error_encryption_failure">"https://www.coronawarn.app/en/faq/#cause9002_recovery"</string>

<!-- ####################################
Just for Development
Expand Down
2 changes: 1 addition & 1 deletion Corona-Warn-App/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@
<!-- XTXT: error dialog - text when a catastrophic error occured from which the app recovered automatically via data reset -->
<string name="errors_generic_text_catastrophic_error_recovery_via_reset">"Twoja aplikacja została zresetowana z powodu problemu technicznego. Nie będzie to miało wpływu na funkcjonalność aplikacji. Nadal będziesz otrzymywać powiadomienia o narażeniach i będziesz w stanie ostrzegać innych w razie pozytywnego wyniku testu na COVID-19."</string>
<!-- XTXT: error dialog - link for the details button in the catastrophic error recovery dialog -->
<string name="errors_generic_text_catastrophic_error_encryption_failure">"https://www.coronawarn.app/en/faq/#cause9002"</string>
<string name="errors_generic_text_catastrophic_error_encryption_failure">"https://www.coronawarn.app/en/faq/#cause9002_recovery"</string>

<!-- ####################################
Just for Development
Expand Down
2 changes: 1 addition & 1 deletion Corona-Warn-App/src/main/res/values-ro/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@
<!-- XTXT: error dialog - text when a catastrophic error occured from which the app recovered automatically via data reset -->
<string name="errors_generic_text_catastrophic_error_recovery_via_reset">"Aplicația dvs. a fost resetată din cauza unei probleme tehnice. Acest lucru nu are efect asupra funcționalității aplicației. Veți continua să primiți notificări despre expuneri și îi veți putea avertiza pe ceilalți în continuare, în cazul în care sunteți testat pozitiv la COVID-19."</string>
<!-- XTXT: error dialog - link for the details button in the catastrophic error recovery dialog -->
<string name="errors_generic_text_catastrophic_error_encryption_failure">"https://www.coronawarn.app/en/faq/#cause9002"</string>
<string name="errors_generic_text_catastrophic_error_encryption_failure">"https://www.coronawarn.app/en/faq/#cause9002_recovery"</string>

<!-- ####################################
Just for Development
Expand Down
Loading

0 comments on commit 0267c84

Please sign in to comment.