Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show host in download confirmation dialog #4706

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
package com.duckduckgo.downloads.impl

import android.content.Context
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import com.duckduckgo.anvil.annotations.InjectWith
import com.duckduckgo.common.utils.baseHost
import com.duckduckgo.di.scopes.FragmentScope
import com.duckduckgo.downloads.api.DownloadConfirmationDialogListener
import com.duckduckgo.downloads.api.FileDownloader.PendingFileDownload
Expand Down Expand Up @@ -89,6 +92,12 @@ class DownloadConfirmationFragment : BottomSheetDialogFragment() {
(dialog as BottomSheetDialog).behavior.state = BottomSheetBehavior.STATE_EXPANDED
val fileName = file?.name ?: ""
binding.downloadMessage.text = fileName
binding.downloadMessageSubtitle.run {
val host = runCatching { Uri.parse(pendingDownload.url).baseHost }.getOrNull()

isVisible = !host.isNullOrBlank()
text = getString(R.string.downloadConfirmationSubtitle, host)
}
binding.continueDownload.setOnClickListener {
listener.continueDownload(pendingDownload)
dismiss()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,32 @@
android:id="@+id/downloadMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="@dimen/keyline_4"
android:paddingTop="@dimen/keyline_4"
android:paddingEnd="@dimen/keyline_4"
android:paddingBottom="@dimen/keyline_4"
app:textType="secondary"
app:typography="body1"
app:typography="body1_bold"
tools:text="sample-file.pdf" />

<com.duckduckgo.common.ui.view.text.DaxTextView
android:id="@+id/downloadMessageSubtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="@dimen/keyline_4"
android:paddingEnd="@dimen/keyline_4"
app:textType="secondary"
app:typography="body1"
tools:text="From: example.com" />

<com.duckduckgo.common.ui.view.listitem.OneLineListItem
android:id="@+id/continueDownload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/keyline_4"
app:leadingIcon="@drawable/ic_downloads_24"
app:primaryText="@string/downloadConfirmationContinue" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Неуспешно изтегляне.</string>

<string name="downloadConfirmationContinue">Запазване в Изтеглени файлове</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">От: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Stahování se nezdařilo.</string>

<string name="downloadConfirmationContinue">Uložit do Stahování</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Ze stránky %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Det var ikke muligt at downloade.</string>

<string name="downloadConfirmationContinue">Gem i downloads</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Fra: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Download fehlgeschlagen.</string>

<string name="downloadConfirmationContinue">In Downloads speichern</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Von: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Αποτυχία λήψης.</string>

<string name="downloadConfirmationContinue">Αποθήκευση στις λήψεις</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Από: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">No se ha podido descargar.</string>

<string name="downloadConfirmationContinue">Guardar en descargas</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Desde: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Allalaadimine nurjus.</string>

<string name="downloadConfirmationContinue">Salvesta allalaadimistesse</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Saidilt: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Lataus epäonnistui.</string>

<string name="downloadConfirmationContinue">Tallenna latauksiin</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Sivustolta %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Échec du téléchargement.</string>

<string name="downloadConfirmationContinue">Enregistrer dans les téléchargements</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">À partir de : %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Preuzimanje nije uspjelo.</string>

<string name="downloadConfirmationContinue">Spremi u Preuzimanja</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Izvor: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">A letöltés sikertelen.</string>

<string name="downloadConfirmationContinue">Mentés a Letöltések közé</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Innen: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Download non riuscito.</string>

<string name="downloadConfirmationContinue">Salva in Download</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Da: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Nepavyko atsisiųsti.</string>

<string name="downloadConfirmationContinue">Išsaugoti Atsisiuntimuose</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Iš: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Neizdevās lejupielādēt.</string>

<string name="downloadConfirmationContinue">Lejupielādēt</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">No: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Nedlastingen mislyktes.</string>

<string name="downloadConfirmationContinue">Lagre til nedlastinger</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Fra: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Downloaden mislukt.</string>

<string name="downloadConfirmationContinue">Opslaan in downloads</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Van: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Nie udało się pobrać.</string>

<string name="downloadConfirmationContinue">Zapisz w Pobranych</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Z: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Ocorreu uma falha na transferência.</string>

<string name="downloadConfirmationContinue">Guardar em Transferências</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">De: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Nu s-a putut descărca.</string>

<string name="downloadConfirmationContinue">Salvează în Descărcări</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">De la: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Сбой загрузки.</string>

<string name="downloadConfirmationContinue">Сохранить в «Загрузки»</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Источник: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Sťahovanie zlyhalo.</string>

<string name="downloadConfirmationContinue">Uložiť do stiahnutých</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Z: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Prenos ni uspel.</string>

<string name="downloadConfirmationContinue">Shrani med prenose</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">S spletnega mesta: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Det gick inte att ladda ner.</string>

<string name="downloadConfirmationContinue">Spara till Nerladdningar</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Från: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">İndirme başarısız oldu.</string>

<string name="downloadConfirmationContinue">İndirilenlere Kaydet</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">Şu adresten: %1$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
<string name="notificationDownloadFailed">Failed to download.</string>

<string name="downloadConfirmationContinue">Save to Downloads</string>
<string name="downloadConfirmationSubtitle" instruction="Placeholder is the address of a website">From: %1$s</string>
</resources>
Loading