Skip to content

Commit 16010d7

Browse files
committed
Add Thunderbird website hyperlink on contribution screen
1 parent 345ec36 commit 16010d7

File tree

28 files changed

+151
-76
lines changed

28 files changed

+151
-76
lines changed

feature/funding/googleplay/src/main/kotlin/app/k9mail/feature/funding/googleplay/ui/contribution/ContributionList.kt

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package app.k9mail.feature.funding.googleplay.ui.contribution
22

3+
import android.content.ActivityNotFoundException
4+
import android.content.Context
5+
import android.content.Intent
6+
import android.net.Uri
7+
import android.widget.Toast
38
import androidx.compose.animation.AnimatedVisibility
49
import androidx.compose.foundation.clickable
510
import androidx.compose.foundation.layout.Arrangement
@@ -14,11 +19,14 @@ import androidx.compose.runtime.mutableStateOf
1419
import androidx.compose.runtime.remember
1520
import androidx.compose.ui.Alignment
1621
import androidx.compose.ui.Modifier
22+
import androidx.compose.ui.platform.LocalContext
1723
import androidx.compose.ui.res.stringResource
1824
import androidx.compose.ui.text.SpanStyle
1925
import androidx.compose.ui.text.buildAnnotatedString
2026
import androidx.compose.ui.text.font.FontStyle
27+
import androidx.compose.ui.text.style.TextDecoration
2128
import androidx.compose.ui.text.withStyle
29+
import app.k9mail.core.ui.compose.common.resources.annotatedStringResource
2230
import app.k9mail.core.ui.compose.designsystem.atom.Surface
2331
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText
2432
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icon
@@ -37,6 +45,7 @@ import app.k9mail.feature.funding.googleplay.domain.entity.OneTimeContribution
3745
import app.k9mail.feature.funding.googleplay.domain.entity.RecurringContribution
3846
import app.k9mail.feature.funding.googleplay.ui.contribution.ContributionContract.ContributionListState
3947
import kotlinx.collections.immutable.ImmutableList
48+
import timber.log.Timber
4049

4150
@Composable
4251
internal fun ContributionList(
@@ -205,14 +214,39 @@ private fun ListEmptyView(
205214
verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.double),
206215
modifier = modifier.padding(vertical = MainTheme.spacings.double),
207216
) {
217+
val context = LocalContext.current
218+
val annotatedString = annotatedStringResource(
219+
id = R.string.funding_googleplay_contribution_list_empty_message,
220+
argument = buildAnnotatedString {
221+
withStyle(
222+
style = SpanStyle(
223+
color = MainTheme.colors.primary,
224+
textDecoration = TextDecoration.Underline,
225+
),
226+
) {
227+
withLink(
228+
LinkAnnotation.Url(
229+
url = stringResource(R.string.funding_googleplay_thunderbird_website_url),
230+
),
231+
) {
232+
append(stringResource(R.string.funding_googleplay_thunderbird_website_domain))
233+
}
234+
}
235+
},
236+
)
237+
208238
TextBodyMedium(
209239
text = stringResource(R.string.funding_googleplay_contribution_list_empty_title),
210240
)
211241

212-
// TODO The link needs to be clickable
213242
TextBodyMedium(
214-
text = stringResource(R.string.funding_googleplay_contribution_list_empty_message),
243+
modifier = Modifier
244+
.clickable {
245+
context.launchThunderbirdWebsite()
246+
},
247+
text = annotatedString,
215248
)
249+
216250
}
217251
}
218252

@@ -260,3 +294,20 @@ private fun ListErrorView(
260294
)
261295
}
262296
}
297+
298+
private fun Context.launchThunderbirdWebsite() {
299+
try {
300+
val url = getString(R.string.funding_googleplay_thunderbird_website_url)
301+
val viewIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
302+
303+
startActivity(viewIntent)
304+
} catch (e: ActivityNotFoundException) {
305+
Timber.d(e, "Failed to open URL")
306+
307+
Toast.makeText(
308+
this,
309+
getString(R.string.funding_googleplay_contribution_error_open_link),
310+
Toast.LENGTH_SHORT,
311+
).show()
312+
}
313+
}

feature/funding/googleplay/src/main/res/values-ca/strings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<resources>
2+
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
33
<string name="funding_googleplay_contribution_list_title">Contribució segura</string>
44
<string name="funding_googleplay_contribution_title">Dóna suport a Thunderbird</string>
55
<string name="funding_googleplay_contribution_list_type_one_time">Donació única</string>
@@ -11,7 +11,7 @@
1111
<string name="funding_googleplay_contribution_list_type_none_available">Cap disponible</string>
1212
<string name="funding_googleplay_contribution_list_disclaimer">Les contribucions no són deduïbles fiscalment com a donacions benèfiques.</string>
1313
<string name="funding_googleplay_contribution_footer_manage_button">Modifica el pagament mensual</string>
14-
<string name="funding_googleplay_contribution_list_empty_message">Visiteu www.thunderbird.net per obtenir més maneres de donar suport al Thunderbird</string>
14+
<string name="funding_googleplay_contribution_list_empty_message">Visiteu <xliff:g id="link_text">%s</xliff:g> per obtenir més maneres de donar suport al Thunderbird.</string>
1515
<string name="funding_googleplay_contribution_list_empty_title">Actualment, les contribucions des de l\'aplicació no estan disponibles.</string>
1616
<string name="funding_googleplay_contribution_error_show_more">Mostra més detalls</string>
1717
<string name="funding_googleplay_contribution_error_unknown">Error desconegut</string>
@@ -28,4 +28,4 @@
2828
<string name="funding_googleplay_contribution_footer_payment_unavailable_button">El pagament no està disponible en aquests moments</string>
2929
<string name="funding_googleplay_contribution_error_dismiss_button">Ignora l\'error</string>
3030
<string name="funding_googleplay_contribution_tfa_onetime_xs_description">El vostre suport ens fa avançar! Fins i tot les contribucions més petites generen un canvi, i estem molt agraïts de tenir-vos a bord.</string>
31-
</resources>
31+
</resources>

feature/funding/googleplay/src/main/res/values-co/strings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<resources>
2+
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
33
<string name="funding_googleplay_contribution_header_title">Sustene Thunderbird</string>
44
<string name="funding_googleplay_contribution_list_title">Cuntribuzione assicurata</string>
55
<string name="funding_googleplay_contribution_list_type_one_time">Dà una volta</string>
@@ -8,7 +8,7 @@
88
<string name="funding_googleplay_contribution_footer_payment_button">Cuntinuà u pagamentu</string>
99
<string name="funding_googleplay_contribution_title">Sustene Thunderbird</string>
1010
<string name="funding_googleplay_contribution_list_empty_title">Ora, e cuntribuzioni ùn sò micca dispunibule via l’appiecazione.</string>
11-
<string name="funding_googleplay_contribution_list_empty_message">Visitate u situ www.thunderbird.net per cunnosce parechje manere di sustene Thunderbird</string>
11+
<string name="funding_googleplay_contribution_list_empty_message">Visitate u situ <xliff:g id="link_text">%s</xliff:g> per cunnosce parechje manere di sustene Thunderbird.</string>
1212
<string name="funding_googleplay_contribution_list_error_retry_button">Pruvà torna</string>
1313
<string name="funding_googleplay_contribution_footer_payment_unavailable_button">Pagamentu indispunibule attualmente</string>
1414
<string name="funding_googleplay_contribution_footer_manage_button">Mudificà u pagamentu misincu</string>
@@ -20,4 +20,4 @@
2020
<string name="funding_googleplay_contribution_error_service_disconnected">Ora, e cuntribuzioni ùn sò micca dispunibule.</string>
2121
<string name="funding_googleplay_contribution_header_description">Ùn affissemu alcuna publicità è un vindemu mai i vostri dati. Simu finanziati sanu sanu grazia à e cuntribuzioni da i nostri utilizatori. S’è Thunderbird vi piace, aiutateci à sustenelu. Ùn pudemu fà què senza voi !</string>
2222
<string name="funding_googleplay_contribution_list_disclaimer">E cuntribuzioni ùn ponu micca esse scuntate da l’impositi cum’è e dunazioni.</string>
23-
</resources>
23+
</resources>

feature/funding/googleplay/src/main/res/values-cs/strings.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<resources>
2+
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
33
<string name="funding_googleplay_contribution_list_title">Bezpečné přispění</string>
44
<string name="funding_googleplay_contribution_list_type_one_time">Jednou</string>
55
<string name="funding_googleplay_contribution_footer_payment_button">Pokračovat k platbě</string>
@@ -17,7 +17,7 @@
1717
<string name="funding_googleplay_contribution_error_show_more">Zobrazit další podrobnosti</string>
1818
<string name="funding_googleplay_contribution_error_dismiss_button">Zavřít chybu</string>
1919
<string name="funding_googleplay_contribution_tfa_recurring_xxl_title">Výjimečný měsíční dar</string>
20-
<string name="funding_googleplay_contribution_list_empty_message">Navštivte www.thunderbird.net pro další způsoby, jak podpořit Thunderbird</string>
20+
<string name="funding_googleplay_contribution_list_empty_message">Navštivte <xliff:g id="link_text">%s</xliff:g> pro další způsoby, jak podpořit Thunderbird.</string>
2121
<string name="funding_googleplay_contribution_error_purchase_failed">Nákup se nezdařil.</string>
2222
<string name="funding_googleplay_contribution_tfa_onetime_xs_title">Podstatný dar</string>
2323
<string name="funding_googleplay_contribution_error_service_disconnected">Dary nejsou v tuto chvíli dostupné.</string>
@@ -49,4 +49,5 @@
4949
<string name="funding_googleplay_contribution_tfa_recurring_xxl_description">Pomáháte nám dělat velké věci! Vaše podpora nám umožňuje dosahovat mimořádných úspěchů.</string>
5050
<string name="funding_googleplay_contribution_reminder_title">Podpořte Thunderbird</string>
5151
<string name="funding_googleplay_contribution_header_thank_you_message">Děkujeme vám za váš štědrý dar! Vaše podpora přímo zlepšuje Thunderbird a my jsme vděční, že jste na této cestě po našem boku.</string>
52-
</resources>
52+
<string name="funding_googleplay_contribution_error_open_link">Nenalezena aplikace k otevření odkazu.</string>
53+
</resources>

feature/funding/googleplay/src/main/res/values-de/strings.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<resources>
2+
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
33
<string name="funding_googleplay_contribution_list_title">Sicher spenden</string>
44
<string name="funding_googleplay_contribution_header_title">Thunderbird unterstützen</string>
55
<string name="funding_googleplay_contribution_list_type_recurring">Monatlich</string>
@@ -31,7 +31,7 @@
3131
<string name="funding_googleplay_contribution_tfa_recurring_xxl_description">Du hilfst uns, große Träume zu verwirklichen! Deine Unterstützung befähigt uns, außergewöhnliche Dinge zu erreichen.</string>
3232
<string name="funding_googleplay_contribution_header_description">Wir zeigen keine Werbung und verkaufen deine Daten nicht. Wir finanzieren uns vollständig durch finanzielle Beiträge unserer Nutzer. Wenn dir Thunderbird gefällt, hilf uns bitte, es zu unterhalten. Wir können das nicht ohne dich tun!</string>
3333
<string name="funding_googleplay_contribution_list_empty_title">In-App-Spenden sind derzeit nicht verfügbar.</string>
34-
<string name="funding_googleplay_contribution_list_empty_message">Besuche www.thunderbird.net für weitere Möglichkeiten zur Unterstützung von Thunderbird</string>
34+
<string name="funding_googleplay_contribution_list_empty_message">Besuche <xliff:g id="link_text">%s</xliff:g> für weitere Möglichkeiten zur Unterstützung von Thunderbird.</string>
3535
<string name="funding_googleplay_contribution_error_service_disconnected">Spenden sind derzeit nicht verfügbar.</string>
3636
<string name="funding_googleplay_contribution_tfa_onetime_xs_title">Grundlegende Spende</string>
3737
<string name="funding_googleplay_contribution_tfa_onetime_s_title">Wertvolle Spende</string>
@@ -49,4 +49,5 @@
4949
<string name="funding_googleplay_contribution_reminder_message">Unser Ziel ist es, eine sichere, private und kostenlose Open-Source-E-Mail-App für Nutzer auf der ganzen Welt bereitzustellen. Deine Spende unterstützt diese Arbeit. Möchtest du heute spenden?</string>
5050
<string name="funding_googleplay_contribution_reminder_negative_button">Jetzt nicht</string>
5151
<string name="funding_googleplay_contribution_header_thank_you_message">Vielen Dank für deine großzügige Spende! Deine Unterstützung stärkt Thunderbird direkt, und wir sind dankbar, dich auf diesem Weg an unserer Seite zu haben.</string>
52-
</resources>
52+
<string name="funding_googleplay_contribution_error_open_link">Keine App zum Öffnen des Links gefunden.</string>
53+
</resources>

feature/funding/googleplay/src/main/res/values-es/strings.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<resources>
2+
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
33
<string name="funding_googleplay_contribution_header_description">Nunca mostramos anuncios ni vendemos tus datos. Nos financiamos completamente con contribuciones financieras de nuestros usuarios. Si disfrutas de Thunderbird, por favor, ayúdanos a mantenerlo. ¡No podemos hacer esto sin ti!</string>
44
<string name="funding_googleplay_contribution_footer_payment_button">Continuar con el pago</string>
55
<string name="funding_googleplay_contribution_list_type_recurring">Mensual</string>
@@ -19,7 +19,7 @@
1919
<string name="funding_googleplay_contribution_error_purchase_failed">Compra fallida.</string>
2020
<string name="funding_googleplay_contribution_error_service_disconnected">Actualmente, las colaboraciones no están disponibles.</string>
2121
<string name="funding_googleplay_contribution_list_empty_title">Las colaboraciones dentro de la aplicación no están disponibles actualmente.</string>
22-
<string name="funding_googleplay_contribution_list_empty_message">Visite www.thunderbird.net para conocer más formas de apoyar a Thunderbird</string>
22+
<string name="funding_googleplay_contribution_list_empty_message">Visite <xliff:g id="link_text">%s</xliff:g> para conocer más formas de apoyar a Thunderbird.</string>
2323
<string name="funding_googleplay_contribution_tfa_onetime_l_title">Gran contribución</string>
2424
<string name="funding_googleplay_contribution_tfa_onetime_xxl_title">Aporte excepcional</string>
2525
<string name="funding_googleplay_contribution_tfa_onetime_m_description">¡Tu colaboración realmente brilla! Está desempeñando un papel importante en el avance de nuestra misión, ayudándonos a alcanzar hitos importantes y lograr un mayor impacto.</string>
@@ -49,4 +49,5 @@
4949
<string name="funding_googleplay_contribution_reminder_message">Nuestra misión es ofrecer una aplicación de correo electrónico de código abierto que sea segura, privada y gratuita para usuarios de todo el mundo. Tu contribución económica apoya este trabajo. ¿Quieres colaborar ahora?</string>
5050
<string name="funding_googleplay_contribution_reminder_positive_button">Sí</string>
5151
<string name="funding_googleplay_contribution_reminder_negative_button">Ahora no</string>
52-
</resources>
52+
<string name="funding_googleplay_contribution_error_open_link">No se ha encontrado ninguna aplicación para abrir el enlace.</string>
53+
</resources>

feature/funding/googleplay/src/main/res/values-et/strings.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<resources>
2+
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
33
<string name="funding_googleplay_contribution_header_title">Toeta Thunderbirdi</string>
44
<string name="funding_googleplay_contribution_list_title">Turvaline rahaline toetus</string>
55
<string name="funding_googleplay_contribution_list_type_recurring">Iga kuu</string>
@@ -12,7 +12,7 @@
1212
<string name="funding_googleplay_contribution_footer_show_contribution_list_button">Anna veel üks mõjus panus</string>
1313
<string name="funding_googleplay_contribution_footer_manage_button">Muuda igakuist makset</string>
1414
<string name="funding_googleplay_contribution_list_empty_title">Rakenduse-sisene annetamise võimalus hetkel puudub.</string>
15-
<string name="funding_googleplay_contribution_list_empty_message">Meie saidist www.thunderbird.net leiad veel võimalusi Thunderbirdi toetamiseks</string>
15+
<string name="funding_googleplay_contribution_list_empty_message">Meie saidist <xliff:g id="link_text">%s</xliff:g> leiad veel võimalusi Thunderbirdi toetamiseks.</string>
1616
<string name="funding_googleplay_contribution_list_error_retry_button">Proovi uuesti</string>
1717
<string name="funding_googleplay_contribution_footer_payment_unavailable_button">Maksmisvõimalus pole hetkel saadaval</string>
1818
<string name="funding_googleplay_contribution_error_show_more">Näita lisateavet</string>
@@ -49,4 +49,5 @@
4949
<string name="funding_googleplay_contribution_reminder_title">Toeta Thunderbirdi</string>
5050
<string name="funding_googleplay_contribution_reminder_message">Meie eesmärgiks on pakkuda avatud lähtekoodil põhinevat e-postiklienti, mis on turvaline, privaatne ja vaba kõikidele kasutajatele üle maailma. Sinu rahaline toetus aitab seda tööd korraldada. Mis summaga sina täna lööd kaasa?</string>
5151
<string name="funding_googleplay_contribution_header_thank_you_message">Täname sind suuremeelse annetuse eest! Sinu toetus tugevdab otseselt Thunderbirdi ja me oleme tänulikud, et oled meie kõrval sellel teekonnal.</string>
52-
</resources>
52+
<string name="funding_googleplay_contribution_error_open_link">Lingi avamiseks ei leidu rakendusi.</string>
53+
</resources>

feature/funding/googleplay/src/main/res/values-eu/strings.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
<string name="funding_googleplay_contribution_error_dismiss_button">Baztertu errorea</string>
1010
<string name="funding_googleplay_contribution_reminder_positive_button">Bai</string>
1111
<string name="funding_googleplay_contribution_reminder_negative_button">Orain ez</string>
12-
</resources>
12+
<string name="funding_googleplay_contribution_error_open_link">Ez da aurkitu aplikaziorik lotura irekitzeko.</string>
13+
</resources>

0 commit comments

Comments
 (0)