Skip to content

Commit

Permalink
add link to impf-check.ch
Browse files Browse the repository at this point in the history
  • Loading branch information
simonroesch committed Nov 26, 2021
1 parent 0222ede commit 85b98ed
Show file tree
Hide file tree
Showing 21 changed files with 181 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ public boolean isCheckInUpdateNotificationEnabled() {
return checkInUpdateNotificationEnabled;
}

public VaccinationBookingCantonCollection getVaccinationBookingCantons() {
return vaccinationBookingCantons;
}

public VaccinationBookingInfoCollection getVaccinationBookingInfo() {
return vaccinationBookingInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?
)
15 changes: 0 additions & 15 deletions app/src/main/java/ch/admin/bag/dp3t/storage/SecureStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,21 +338,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<VaccinationBookingCantonModel> getVaccinationBookingCantons(String language) {
HashMap<String, List<VaccinationBookingCantonModel>> 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();
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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() {
Expand All @@ -77,8 +81,4 @@ class VaccinationAppointmentFragment : Fragment() {
}
}

private fun onCantonClicked(canton: VaccinationBookingCantonModel) {
UrlUtil.openUrl(requireContext(), canton.linkUrl)
}

}
51 changes: 28 additions & 23 deletions app/src/main/res/layout/fragment_vaccination_appointment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_light"
Expand Down Expand Up @@ -73,6 +72,34 @@
android:layout_marginBottom="@dimen/spacing_larger"
android:text="@string/vaccination_booking_info_text" />

<TextView
android:id="@+id/impfcheck_title"
style="@style/NextStep.Text.Bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/spacing_larger"
android:layout_marginTop="@dimen/spacing_small"
android:layout_marginBottom="@dimen/spacing_small"
android:gravity="left"
android:text="@string/vaccination_impf_check_title" />

<TextView
android:id="@+id/impfcheck_info_text"
style="@style/NextStep.Text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/spacing_larger"
android:text="@string/vaccination_impf_check_info_text" />

<Button
android:id="@+id/impfcheck_action"
style="@style/NextStep.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_larger"
android:drawableRight="@drawable/ic_launch"
android:text="@string/vaccination_impf_check_action" />

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -120,28 +147,6 @@

</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
style="@style/NextStep.Text.Bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/spacing_larger"
android:layout_marginTop="@dimen/spacing_very_large"
android:layout_marginBottom="@dimen/spacing_small"
android:gravity="left"
android:text="@string/vaccination_canton_title" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/vaccination_appointment_canton_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_small"
android:nestedScrollingEnabled="true"
android:overScrollMode="never"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="5"
tools:listitem="@layout/item_vaccination_appointment_canton" />

</LinearLayout>

</androidx.cardview.widget.CardView>
Expand Down
12 changes: 11 additions & 1 deletion common/src/main/res/values-bs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1955,7 +1955,7 @@ Mnoga mesta nude i vakcinaciju bez zakazanog termina"</string>
<string name="vaccination_info_homescreen_title">"Još niste vakcinisani?"</string>

<!-- Homescreen Impfhinweis: Titel fett -->
<string name="vaccination_info_homescreen_title_bold">"Zakažite sada termin "</string>
<string name="vaccination_info_homescreen_title_bold">"Zakažite sada termin"</string>

<!-- Impfhinweis Detail: URL unten Weitere Informationen -->
<string name="vaccination_booking_info_url">"https://bag-coronavirus.ch/impfung/"</string>
Expand All @@ -1968,4 +1968,14 @@ Mnoga mesta nude i vakcinaciju bez zakazanog termina"</string>

<!-- Impf-Hinweis Screen: Kanton Titel -->
<string name="vaccination_canton_title">"Izaberite svoj kanton"</string>

<!-- vaccination booking screen info about Impf-Check (impf-check.ch) -->
<string name="vaccination_impf_check_info_text"></string>

<!-- button title for link to impf-check.ch -->
<string name="vaccination_impf_check_action"></string>

<!-- URL to ImpfCheck -->
<string name="vaccination_impf_check_url">"https://covid19.impf-check.ch/"</string>
<string name="vaccination_impf_check_title">"Zakažite sada termin"</string>
</resources>
10 changes: 10 additions & 0 deletions common/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2054,4 +2054,14 @@ Viele Orte bieten auch Walk-in-Impfungen ohne Termine an."</string>

<!-- Impf-Hinweis Screen: Kanton Titel -->
<string name="vaccination_canton_title">"Wählen Sie Ihren Kanton"</string>

<!-- vaccination booking screen info about Impf-Check (impf-check.ch) -->
<string name="vaccination_impf_check_info_text">"Der Covid-19 Impf-Check gibt Auskunft über Erst- sowie Auffrischimpfungen und führt Sie zur entsprechenden Anlaufstelle in Ihrem Kanton."</string>

<!-- button title for link to impf-check.ch -->
<string name="vaccination_impf_check_action">"Zum Impf-Check"</string>

<!-- URL to ImpfCheck -->
<string name="vaccination_impf_check_url">"https://covid19.impf-check.ch/"</string>
<string name="vaccination_impf_check_title">"Jetzt Termin buchen"</string>
</resources>
10 changes: 10 additions & 0 deletions common/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1960,4 +1960,14 @@ Muchos centros ofrecen la posibllidad de vacunarse sin cita previa."</string>

<!-- Impf-Hinweis Screen: Kanton Titel -->
<string name="vaccination_canton_title">"Seleccione su cantón"</string>

<!-- vaccination booking screen info about Impf-Check (impf-check.ch) -->
<string name="vaccination_impf_check_info_text"></string>

<!-- button title for link to impf-check.ch -->
<string name="vaccination_impf_check_action"></string>

<!-- URL to ImpfCheck -->
<string name="vaccination_impf_check_url">"https://covid19.impf-check.ch/"</string>
<string name="vaccination_impf_check_title">"Concierte su cita ahora"</string>
</resources>
10 changes: 10 additions & 0 deletions common/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1992,4 +1992,14 @@ Il est aussi possible de se faire vacciner sans rendez-vous dans de nombreux end

<!-- Impf-Hinweis Screen: Kanton Titel -->
<string name="vaccination_canton_title">"Sélectionnez votre canton"</string>

<!-- vaccination booking screen info about Impf-Check (impf-check.ch) -->
<string name="vaccination_impf_check_info_text"></string>

<!-- button title for link to impf-check.ch -->
<string name="vaccination_impf_check_action"></string>

<!-- URL to ImpfCheck -->
<string name="vaccination_impf_check_url">"https://covid19-vac-check.ch/"</string>
<string name="vaccination_impf_check_title">"Prendre un rendez-vous maintenant"</string>
</resources>
12 changes: 11 additions & 1 deletion common/src/main/res/values-hr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1953,7 +1953,7 @@ Mnoga mesta nude i vakcinaciju bez zakazanog termina"</string>
<string name="vaccination_info_homescreen_title">"Još niste vakcinisani?"</string>

<!-- Homescreen Impfhinweis: Titel fett -->
<string name="vaccination_info_homescreen_title_bold">"Zakažite sada termin "</string>
<string name="vaccination_info_homescreen_title_bold">"Zakažite sada termin"</string>

<!-- Impfhinweis Detail: URL unten Weitere Informationen -->
<string name="vaccination_booking_info_url">"https://bag-coronavirus.ch/impfung/"</string>
Expand All @@ -1966,4 +1966,14 @@ Mnoga mesta nude i vakcinaciju bez zakazanog termina"</string>

<!-- Impf-Hinweis Screen: Kanton Titel -->
<string name="vaccination_canton_title">"Izaberite svoj kanton"</string>

<!-- vaccination booking screen info about Impf-Check (impf-check.ch) -->
<string name="vaccination_impf_check_info_text"></string>

<!-- button title for link to impf-check.ch -->
<string name="vaccination_impf_check_action"></string>

<!-- URL to ImpfCheck -->
<string name="vaccination_impf_check_url">"https://covid19.impf-check.ch/"</string>
<string name="vaccination_impf_check_title">"Zakažite sada termin"</string>
</resources>
10 changes: 10 additions & 0 deletions common/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2003,4 +2003,14 @@ Molti di essi offrono anche vaccinazioni libere senza appuntamento."</string>

<!-- Impf-Hinweis Screen: Kanton Titel -->
<string name="vaccination_canton_title">"Scegli il Cantone"</string>

<!-- vaccination booking screen info about Impf-Check (impf-check.ch) -->
<string name="vaccination_impf_check_info_text">"Il COVID-19 Vac-Check fornisce informazioni sulle prime vaccinazioni, sulle vaccinazioni di richiamo e ti indirizza verso il punto di contatto del tuo Cantone."</string>

<!-- button title for link to impf-check.ch -->
<string name="vaccination_impf_check_action">"Vai al COVID-19 Vac-Check"</string>

<!-- URL to ImpfCheck -->
<string name="vaccination_impf_check_url">"https://covid19-vac-check.ch/"</string>
<string name="vaccination_impf_check_title">"Prendi appuntamento ora"</string>
</resources>
10 changes: 10 additions & 0 deletions common/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1970,4 +1970,14 @@ Muitos lugares também oferecem vacinações Walk-in sem agendamento."</string>

<!-- Impf-Hinweis Screen: Kanton Titel -->
<string name="vaccination_canton_title">"Selecione o seu cantão"</string>

<!-- vaccination booking screen info about Impf-Check (impf-check.ch) -->
<string name="vaccination_impf_check_info_text"></string>

<!-- button title for link to impf-check.ch -->
<string name="vaccination_impf_check_action"></string>

<!-- URL to ImpfCheck -->
<string name="vaccination_impf_check_url">"https://covid19.impf-check.ch/"</string>
<string name="vaccination_impf_check_title">"Agende a data agora"</string>
</resources>
Loading

0 comments on commit 85b98ed

Please sign in to comment.