diff --git a/Corona-Warn-App/build.gradle b/Corona-Warn-App/build.gradle index bf915219e70..30bc8716da1 100644 --- a/Corona-Warn-App/build.gradle +++ b/Corona-Warn-App/build.gradle @@ -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" diff --git a/Corona-Warn-App/proguard-rules.pro b/Corona-Warn-App/proguard-rules.pro index b6efd7f8650..13dfa13cd05 100644 --- a/Corona-Warn-App/proguard-rules.pro +++ b/Corona-Warn-App/proguard-rules.pro @@ -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.* ; } --keep,allowobfuscation interface <1> \ No newline at end of file +-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.** { ; } + +# 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 ; +} + +##---------------End: proguard configuration for Gson ---------- \ No newline at end of file diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomIntroductionFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomIntroductionFragment.kt index dd6042ec666..1af4a2ede61 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomIntroductionFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomIntroductionFragment.kt @@ -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 @@ -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