diff --git a/app/build.gradle b/app/build.gradle index 929f7590..876d7588 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,8 +24,8 @@ android { applicationId "ch.admin.bag.dp3t" minSdkVersion 23 targetSdkVersion 30 - versionCode 22000 - versionName "2.2.0" + versionCode 23000 + versionName "2.3.0" resConfigs "en", "fr", "de", "it", "pt", "es", "sq", "bs", "hr", "sr", "rm", "tr", "ti" buildConfigField "long", "BUILD_TIME", readPropertyWithDefault('buildTimestamp', System.currentTimeMillis()) + 'L' diff --git a/app/src/main/java/ch/admin/bag/dp3t/networking/ConfigWorker.kt b/app/src/main/java/ch/admin/bag/dp3t/networking/ConfigWorker.kt index e402e8b4..f4252f8f 100644 --- a/app/src/main/java/ch/admin/bag/dp3t/networking/ConfigWorker.kt +++ b/app/src/main/java/ch/admin/bag/dp3t/networking/ConfigWorker.kt @@ -89,7 +89,6 @@ class ConfigWorker(context: Context, workerParams: WorkerParameters) : Coroutine secureStorage.setTestInformationUrls(config.testInformationUrls) secureStorage.setVaccinationBookingInfo(config.vaccinationBookingInfo) - secureStorage.setVaccinationBookingCantons(config.vaccinationBookingCantons) secureStorage.setShowVaccinationInfo(config.isShowVaccinationInfo) secureStorage.testLocations = config.testLocations diff --git a/app/src/main/java/ch/admin/bag/dp3t/networking/models/ConfigResponseModel.java b/app/src/main/java/ch/admin/bag/dp3t/networking/models/ConfigResponseModel.java index 850a3ede..e6f22d86 100644 --- a/app/src/main/java/ch/admin/bag/dp3t/networking/models/ConfigResponseModel.java +++ b/app/src/main/java/ch/admin/bag/dp3t/networking/models/ConfigResponseModel.java @@ -23,7 +23,6 @@ public class ConfigResponseModel { private Map testInformationUrls; private boolean checkInUpdateNotificationEnabled; - private VaccinationBookingCantonCollection vaccinationBookingCantons; private VaccinationBookingInfoCollection vaccinationBookingInfo; private boolean showVaccinationInfo; @@ -64,10 +63,6 @@ public boolean isCheckInUpdateNotificationEnabled() { return checkInUpdateNotificationEnabled; } - public VaccinationBookingCantonCollection getVaccinationBookingCantons() { - return vaccinationBookingCantons; - } - public VaccinationBookingInfoCollection getVaccinationBookingInfo() { return vaccinationBookingInfo; } diff --git a/app/src/main/java/ch/admin/bag/dp3t/networking/models/VaccinationBookingCantonCollection.java b/app/src/main/java/ch/admin/bag/dp3t/networking/models/VaccinationBookingCantonCollection.java deleted file mode 100644 index 26984f69..00000000 --- a/app/src/main/java/ch/admin/bag/dp3t/networking/models/VaccinationBookingCantonCollection.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2021 Ubique Innovation AG - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - * - * SPDX-License-Identifier: MPL-2.0 - */ -package ch.admin.bag.dp3t.networking.models; - -import java.util.HashMap; -import java.util.List; - -public class VaccinationBookingCantonCollection extends HashMap> { -} diff --git a/app/src/main/java/ch/admin/bag/dp3t/networking/models/VaccinationBookingCantonModel.kt b/app/src/main/java/ch/admin/bag/dp3t/networking/models/VaccinationBookingCantonModel.kt deleted file mode 100644 index a85b27b7..00000000 --- a/app/src/main/java/ch/admin/bag/dp3t/networking/models/VaccinationBookingCantonModel.kt +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2021 Ubique Innovation AG - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - * - * SPDX-License-Identifier: MPL-2.0 - */ - -package ch.admin.bag.dp3t.networking.models - -data class VaccinationBookingCantonModel( - val name: String, - val linkUrl: String -) diff --git a/app/src/main/java/ch/admin/bag/dp3t/networking/models/VaccinationBookingInfoModel.kt b/app/src/main/java/ch/admin/bag/dp3t/networking/models/VaccinationBookingInfoModel.kt index b7afd500..79fe5b8b 100644 --- a/app/src/main/java/ch/admin/bag/dp3t/networking/models/VaccinationBookingInfoModel.kt +++ b/app/src/main/java/ch/admin/bag/dp3t/networking/models/VaccinationBookingInfoModel.kt @@ -13,5 +13,9 @@ package ch.admin.bag.dp3t.networking.models data class VaccinationBookingInfoModel( val title: String, val text: String, - val info: String + val info: String, + val impfcheckTitle: String?, + val impfcheckText: String?, + val impfcheckButton: String?, + val impfcheckUrl: String? ) diff --git a/app/src/main/java/ch/admin/bag/dp3t/storage/SecureStorage.java b/app/src/main/java/ch/admin/bag/dp3t/storage/SecureStorage.java index 956fe5fd..a7161247 100644 --- a/app/src/main/java/ch/admin/bag/dp3t/storage/SecureStorage.java +++ b/app/src/main/java/ch/admin/bag/dp3t/storage/SecureStorage.java @@ -31,8 +31,6 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import ch.admin.bag.dp3t.networking.models.VaccinationBookingCantonModel; -import ch.admin.bag.dp3t.networking.models.VaccinationBookingInfoModel; import ch.admin.bag.dp3t.checkin.models.CheckInState; import ch.admin.bag.dp3t.networking.models.*; @@ -68,7 +66,6 @@ public class SecureStorage { private static final String KEY_T_DUMMY = "KEY_T_DUMMY"; private static final String KEY_WHAT_TO_DO_POSITIVE_TEST_TEXTS = "whatToDoPositiveTestTexts"; private static final String KEY_VACCINATION_BOOKING_INFO = "vaccinationBookingInfo"; - private static final String KEY_VACCINATION_CANTONS = "vaccinationCantons"; private static final String KEY_SHOW_VACCINATION_INFO = "showVaccinationInfo"; private static final String KEY_TEST_LOCATIONS = "test_locations"; private static final String KEY_INTEROP_COUNTRIES = "interop_countries"; @@ -338,21 +335,6 @@ public VaccinationBookingInfoModel getVaccinationBookingInfo(String language) { return map.get(language); } - public void setVaccinationBookingCantons(VaccinationBookingCantonCollection vaccinationBookingCantonCollection) { - prefs.edit().putString(KEY_VACCINATION_CANTONS, gson.toJson(vaccinationBookingCantonCollection)).apply(); - } - - public List getVaccinationBookingCantons(String language) { - HashMap> map = - gson.fromJson(prefs.getString(KEY_VACCINATION_CANTONS, "null"), - VaccinationBookingCantonCollection.class); - if (map == null) { - return null; - } - return map.get(language); - } - - public void setShowVaccinationInfo(boolean showVaccinationInfo) { prefs.edit().putBoolean(KEY_SHOW_VACCINATION_INFO, showVaccinationInfo).apply(); } diff --git a/app/src/main/java/ch/admin/bag/dp3t/vaccination/VaccinationAppointmentCantonAdapter.kt b/app/src/main/java/ch/admin/bag/dp3t/vaccination/VaccinationAppointmentCantonAdapter.kt deleted file mode 100644 index 734161b9..00000000 --- a/app/src/main/java/ch/admin/bag/dp3t/vaccination/VaccinationAppointmentCantonAdapter.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2021 Ubique Innovation AG - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - * - * SPDX-License-Identifier: MPL-2.0 - */ - -package ch.admin.bag.dp3t.vaccination - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import ch.admin.bag.dp3t.networking.models.VaccinationBookingCantonModel -import ch.admin.bag.dp3t.databinding.ItemVaccinationAppointmentCantonBinding - -class VaccinationAppointmentCantonAdapter( - private val onCantonClicked: (VaccinationBookingCantonModel) -> Unit -) : RecyclerView.Adapter() { - - private val items = mutableListOf() - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VaccinationAppointmentCantonViewHolder { - val binding = ItemVaccinationAppointmentCantonBinding.inflate(LayoutInflater.from(parent.context), parent, false) - return VaccinationAppointmentCantonViewHolder(binding) - } - - override fun onBindViewHolder(holder: VaccinationAppointmentCantonViewHolder, position: Int) { - holder.bind(items[position], onCantonClicked) - } - - override fun getItemCount() = items.size - - fun setItems(newItems: List) { - items.clear() - items.addAll(newItems) - notifyDataSetChanged() - } -} \ No newline at end of file diff --git a/app/src/main/java/ch/admin/bag/dp3t/vaccination/VaccinationAppointmentCantonViewHolder.kt b/app/src/main/java/ch/admin/bag/dp3t/vaccination/VaccinationAppointmentCantonViewHolder.kt deleted file mode 100644 index 3dc9aa8d..00000000 --- a/app/src/main/java/ch/admin/bag/dp3t/vaccination/VaccinationAppointmentCantonViewHolder.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2021 Ubique Innovation AG - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - * - * SPDX-License-Identifier: MPL-2.0 - */ - -package ch.admin.bag.dp3t.vaccination - -import androidx.recyclerview.widget.RecyclerView -import ch.admin.bag.dp3t.networking.models.VaccinationBookingCantonModel -import ch.admin.bag.dp3t.databinding.ItemVaccinationAppointmentCantonBinding - -class VaccinationAppointmentCantonViewHolder( - private val binding: ItemVaccinationAppointmentCantonBinding -) : RecyclerView.ViewHolder(binding.root) { - - fun bind(canton: VaccinationBookingCantonModel, onCantonClicked: (VaccinationBookingCantonModel) -> Unit) { - binding.root.setOnClickListener { onCantonClicked.invoke(canton) } - binding.cantonName.text = canton.name - } - -} \ No newline at end of file diff --git a/app/src/main/java/ch/admin/bag/dp3t/vaccination/VaccinationAppointmentFragment.kt b/app/src/main/java/ch/admin/bag/dp3t/vaccination/VaccinationAppointmentFragment.kt index e433d8ad..eee4e631 100644 --- a/app/src/main/java/ch/admin/bag/dp3t/vaccination/VaccinationAppointmentFragment.kt +++ b/app/src/main/java/ch/admin/bag/dp3t/vaccination/VaccinationAppointmentFragment.kt @@ -15,10 +15,9 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment -import ch.admin.bag.dp3t.networking.models.VaccinationBookingCantonModel -import ch.admin.bag.dp3t.networking.models.VaccinationBookingInfoModel import ch.admin.bag.dp3t.R import ch.admin.bag.dp3t.databinding.FragmentVaccinationAppointmentBinding +import ch.admin.bag.dp3t.networking.models.VaccinationBookingInfoModel import ch.admin.bag.dp3t.storage.SecureStorage import ch.admin.bag.dp3t.util.UrlUtil @@ -32,8 +31,6 @@ class VaccinationAppointmentFragment : Fragment() { private var _binding: FragmentVaccinationAppointmentBinding? = null private val binding get() = _binding!! - private val adapter = VaccinationAppointmentCantonAdapter(this::onCantonClicked) - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { _binding = FragmentVaccinationAppointmentBinding.inflate(inflater, container, false) return binding.root @@ -47,27 +44,34 @@ class VaccinationAppointmentFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) binding.toolbar.setNavigationOnClickListener { parentFragmentManager.popBackStack() } - setupCantonList() + setupMoreInformationButton() val secureStorage = SecureStorage.getInstance(context) secureStorage.getVaccinationBookingInfo(requireContext().getString(R.string.language_key))?.let { setupVaccinationBookingInfo(it) } - adapter.setItems( - secureStorage.getVaccinationBookingCantons(requireContext().getString(R.string.language_key)) ?: emptyList() - ) } - private fun setupCantonList() { - binding.vaccinationAppointmentCantonList.adapter = adapter - } private fun setupVaccinationBookingInfo(vaccinationBookingInfo: VaccinationBookingInfoModel) { binding.vaccinationBookingTitle.text = vaccinationBookingInfo.title binding.vaccinationBookingText.text = vaccinationBookingInfo.text binding.vaccinationBookingInfo.text = vaccinationBookingInfo.info + + if (vaccinationBookingInfo.impfcheckTitle != null && vaccinationBookingInfo.impfcheckText != null && vaccinationBookingInfo.impfcheckButton != null && vaccinationBookingInfo.impfcheckUrl != null) { + binding.impfcheckTitle.text = vaccinationBookingInfo.impfcheckTitle + binding.impfcheckInfoText.text = vaccinationBookingInfo.impfcheckText + binding.impfcheckAction.text = vaccinationBookingInfo.impfcheckButton + binding.impfcheckAction.setOnClickListener { + UrlUtil.openUrl(it.context, vaccinationBookingInfo.impfcheckUrl) + } + } else { + binding.impfcheckTitle.visibility = View.GONE + binding.impfcheckInfoText.visibility = View.GONE + binding.impfcheckAction.visibility = View.GONE + } } private fun setupMoreInformationButton() { @@ -77,8 +81,4 @@ class VaccinationAppointmentFragment : Fragment() { } } - private fun onCantonClicked(canton: VaccinationBookingCantonModel) { - UrlUtil.openUrl(requireContext(), canton.linkUrl) - } - } \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_vaccination_appointment.xml b/app/src/main/res/layout/fragment_vaccination_appointment.xml index 05b82b3a..e6dfa0f5 100644 --- a/app/src/main/res/layout/fragment_vaccination_appointment.xml +++ b/app/src/main/res/layout/fragment_vaccination_appointment.xml @@ -10,7 +10,6 @@ + + + + +