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

Add Thunderbird website hyperlink on contribution screen #8599

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions app-k9mail/src/main/res/values/constants.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
<string name="user_forum_url" translatable="false">https://forum.k9mail.app/</string>
<string name="funding_url" translatable="false">https://www.thunderbird.net/donate/mobile/?form=k9mail&amp;utm_source=%s&amp;utm_medium=android_app&amp;utm_campaign=inapp_appeal_v2</string>
<string name="message_header_mua" translatable="false">K-9 Mail for Android</string>
<string name="thunderbird_website_domain" translatable="false">www.thunderbird.net</string>
<string name="thunderbird_website_url" translatable="false">https://www.thunderbird.net</string>
</resources>
2 changes: 1 addition & 1 deletion app-k9mail/src/main/res/values/funding_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<string name="funding_googleplay_contribution_header_title">Support K-9 Mail</string>
<string name="funding_googleplay_contribution_header_description">We never show ads or sell your data. We are entirely funded by individual contributions from users like you. If you’re enjoying K-9 Mail, please help support it. We can’t do this without you!</string>
<string name="funding_googleplay_contribution_header_thank_you_message">Your contribution furthers the development of secure, private and open-source email. We are truly grateful to have you with us!</string>
<string name="funding_googleplay_contribution_list_empty_message">K-9 Mail is developed by Thunderbird.\nVisit www.thunderbird.net for more ways to support our work.</string>
<string name="funding_googleplay_contribution_list_empty_message">K-9 Mail is developed by Thunderbird.\nVisit <xliff:g id="link_text">%s</xliff:g> for more ways to support our work.</string>
<string name="funding_googleplay_contribution_reminder_title">Support K-9 Mail</string>
<string name="funding_googleplay_contribution_reminder_statement">K-9 Mail is free and open source.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package app.k9mail.feature.funding.googleplay.ui.contribution

import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.widget.Toast
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
Expand All @@ -14,11 +19,17 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.LinkInteractionListener
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.text.withLink
import androidx.compose.ui.text.withStyle
import app.k9mail.core.ui.compose.common.resources.annotatedStringResource
import app.k9mail.core.ui.compose.designsystem.atom.Surface
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icon
Expand All @@ -37,6 +48,7 @@ import app.k9mail.feature.funding.googleplay.domain.entity.OneTimeContribution
import app.k9mail.feature.funding.googleplay.domain.entity.RecurringContribution
import app.k9mail.feature.funding.googleplay.ui.contribution.ContributionContract.ContributionListState
import kotlinx.collections.immutable.ImmutableList
import timber.log.Timber

@Composable
internal fun ContributionList(
Expand Down Expand Up @@ -205,14 +217,36 @@ private fun ListEmptyView(
verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.double),
modifier = modifier.padding(vertical = MainTheme.spacings.double),
) {
val context = LocalContext.current
val annotatedString = annotatedStringResource(
id = R.string.funding_googleplay_contribution_list_empty_message,
argument = buildAnnotatedString {
withStyle(
style = SpanStyle(
color = MainTheme.colors.primary,
textDecoration = TextDecoration.Underline,
),
) {
withLink(
LinkAnnotation.Url(
url = stringResource(R.string.funding_googleplay_thunderbird_website_url),
linkInteractionListener = LinkInteractionListener { context.launchThunderbirdWebsite() },
),
) {
append(stringResource(R.string.funding_googleplay_thunderbird_website_domain))
}
}
},
)

TextBodyMedium(
text = stringResource(R.string.funding_googleplay_contribution_list_empty_title),
)

// TODO The link needs to be clickable
TextBodyMedium(
text = stringResource(R.string.funding_googleplay_contribution_list_empty_message),
text = annotatedString,
)

}
}

Expand Down Expand Up @@ -260,3 +294,20 @@ private fun ListErrorView(
)
}
}

private fun Context.launchThunderbirdWebsite() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary anymore, the url is handled by the system already.

try {
val url = getString(R.string.funding_googleplay_thunderbird_website_url)
val viewIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))

startActivity(viewIntent)
} catch (e: ActivityNotFoundException) {
Timber.d(e, "Failed to open URL")

Toast.makeText(
this,
getString(R.string.funding_googleplay_contribution_error_open_link),
Toast.LENGTH_SHORT,
).show()
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="funding_googleplay_contribution_list_title">Contribució segura</string>
<string name="funding_googleplay_contribution_title">Dóna suport a Thunderbird</string>
<string name="funding_googleplay_contribution_list_type_one_time">Donació única</string>
Expand All @@ -11,7 +11,7 @@
<string name="funding_googleplay_contribution_list_type_none_available">Cap disponible</string>
<string name="funding_googleplay_contribution_list_disclaimer">Les contribucions no són deduïbles fiscalment com a donacions benèfiques.</string>
<string name="funding_googleplay_contribution_footer_manage_button">Modifica el pagament mensual</string>
<string name="funding_googleplay_contribution_list_empty_message">Visiteu www.thunderbird.net per obtenir més maneres de donar suport al Thunderbird</string>
<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>
<string name="funding_googleplay_contribution_list_empty_title">Actualment, les contribucions des de l\'aplicació no estan disponibles.</string>
<string name="funding_googleplay_contribution_error_show_more">Mostra més detalls</string>
<string name="funding_googleplay_contribution_error_unknown">Error desconegut</string>
Expand All @@ -28,4 +28,4 @@
<string name="funding_googleplay_contribution_footer_payment_unavailable_button">El pagament no està disponible en aquests moments</string>
<string name="funding_googleplay_contribution_error_dismiss_button">Ignora l\'error</string>
<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>
</resources>
</resources>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="funding_googleplay_contribution_header_title">Sustene Thunderbird</string>
<string name="funding_googleplay_contribution_list_title">Cuntribuzione assicurata</string>
<string name="funding_googleplay_contribution_list_type_one_time">Dà una volta</string>
Expand All @@ -8,7 +8,7 @@
<string name="funding_googleplay_contribution_footer_payment_button">Cuntinuà u pagamentu</string>
<string name="funding_googleplay_contribution_title">Sustene Thunderbird</string>
<string name="funding_googleplay_contribution_list_empty_title">Ora, e cuntribuzioni ùn sò micca dispunibule via l’appiecazione.</string>
<string name="funding_googleplay_contribution_list_empty_message">Visitate u situ www.thunderbird.net per cunnosce parechje manere di sustene Thunderbird</string>
<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>
<string name="funding_googleplay_contribution_list_error_retry_button">Pruvà torna</string>
<string name="funding_googleplay_contribution_footer_payment_unavailable_button">Pagamentu indispunibule attualmente</string>
<string name="funding_googleplay_contribution_footer_manage_button">Mudificà u pagamentu misincu</string>
Expand All @@ -20,4 +20,4 @@
<string name="funding_googleplay_contribution_error_service_disconnected">Ora, e cuntribuzioni ùn sò micca dispunibule.</string>
<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>
<string name="funding_googleplay_contribution_list_disclaimer">E cuntribuzioni ùn ponu micca esse scuntate da l’impositi cum’è e dunazioni.</string>
</resources>
</resources>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="funding_googleplay_contribution_list_title">Bezpečné přispění</string>
<string name="funding_googleplay_contribution_list_type_one_time">Jednou</string>
<string name="funding_googleplay_contribution_footer_payment_button">Pokračovat k platbě</string>
Expand All @@ -17,7 +17,7 @@
<string name="funding_googleplay_contribution_error_show_more">Zobrazit další podrobnosti</string>
<string name="funding_googleplay_contribution_error_dismiss_button">Zavřít chybu</string>
<string name="funding_googleplay_contribution_tfa_recurring_xxl_title">Výjimečný měsíční dar</string>
<string name="funding_googleplay_contribution_list_empty_message">Navštivte www.thunderbird.net pro další způsoby, jak podpořit Thunderbird</string>
<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>
<string name="funding_googleplay_contribution_error_purchase_failed">Nákup se nezdařil.</string>
<string name="funding_googleplay_contribution_tfa_onetime_xs_title">Podstatný dar</string>
<string name="funding_googleplay_contribution_error_service_disconnected">Dary nejsou v tuto chvíli dostupné.</string>
Expand Down Expand Up @@ -49,4 +49,5 @@
<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>
<string name="funding_googleplay_contribution_reminder_title">Podpořte Thunderbird</string>
<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>
</resources>
<string name="funding_googleplay_contribution_error_open_link">Nenalezena aplikace k otevření odkazu.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="funding_googleplay_contribution_list_title">Sicher spenden</string>
<string name="funding_googleplay_contribution_header_title">Thunderbird unterstützen</string>
<string name="funding_googleplay_contribution_list_type_recurring">Monatlich</string>
Expand Down Expand Up @@ -31,7 +31,7 @@
<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>
<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>
<string name="funding_googleplay_contribution_list_empty_title">In-App-Spenden sind derzeit nicht verfügbar.</string>
<string name="funding_googleplay_contribution_list_empty_message">Besuche www.thunderbird.net für weitere Möglichkeiten zur Unterstützung von Thunderbird</string>
<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>
<string name="funding_googleplay_contribution_error_service_disconnected">Spenden sind derzeit nicht verfügbar.</string>
<string name="funding_googleplay_contribution_tfa_onetime_xs_title">Grundlegende Spende</string>
<string name="funding_googleplay_contribution_tfa_onetime_s_title">Wertvolle Spende</string>
Expand All @@ -49,4 +49,5 @@
<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>
<string name="funding_googleplay_contribution_reminder_negative_button">Jetzt nicht</string>
<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>
</resources>
<string name="funding_googleplay_contribution_error_open_link">Keine App zum Öffnen des Links gefunden.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<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>
<string name="funding_googleplay_contribution_footer_payment_button">Continuar con el pago</string>
<string name="funding_googleplay_contribution_list_type_recurring">Mensual</string>
Expand All @@ -19,7 +19,7 @@
<string name="funding_googleplay_contribution_error_purchase_failed">Compra fallida.</string>
<string name="funding_googleplay_contribution_error_service_disconnected">Actualmente, las colaboraciones no están disponibles.</string>
<string name="funding_googleplay_contribution_list_empty_title">Las colaboraciones dentro de la aplicación no están disponibles actualmente.</string>
<string name="funding_googleplay_contribution_list_empty_message">Visite www.thunderbird.net para conocer más formas de apoyar a Thunderbird</string>
<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>
<string name="funding_googleplay_contribution_tfa_onetime_l_title">Gran contribución</string>
<string name="funding_googleplay_contribution_tfa_onetime_xxl_title">Aporte excepcional</string>
<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>
Expand Down Expand Up @@ -49,4 +49,5 @@
<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>
<string name="funding_googleplay_contribution_reminder_positive_button">Sí</string>
<string name="funding_googleplay_contribution_reminder_negative_button">Ahora no</string>
</resources>
<string name="funding_googleplay_contribution_error_open_link">No se ha encontrado ninguna aplicación para abrir el enlace.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="funding_googleplay_contribution_header_title">Toeta Thunderbirdi</string>
<string name="funding_googleplay_contribution_list_title">Turvaline rahaline toetus</string>
<string name="funding_googleplay_contribution_list_type_recurring">Iga kuu</string>
Expand All @@ -12,7 +12,7 @@
<string name="funding_googleplay_contribution_footer_show_contribution_list_button">Anna veel üks mõjus panus</string>
<string name="funding_googleplay_contribution_footer_manage_button">Muuda igakuist makset</string>
<string name="funding_googleplay_contribution_list_empty_title">Rakenduse-sisene annetamise võimalus hetkel puudub.</string>
<string name="funding_googleplay_contribution_list_empty_message">Meie saidist www.thunderbird.net leiad veel võimalusi Thunderbirdi toetamiseks</string>
<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>
<string name="funding_googleplay_contribution_list_error_retry_button">Proovi uuesti</string>
<string name="funding_googleplay_contribution_footer_payment_unavailable_button">Maksmisvõimalus pole hetkel saadaval</string>
<string name="funding_googleplay_contribution_error_show_more">Näita lisateavet</string>
Expand Down Expand Up @@ -49,4 +49,5 @@
<string name="funding_googleplay_contribution_reminder_title">Toeta Thunderbirdi</string>
<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>
<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>
</resources>
<string name="funding_googleplay_contribution_error_open_link">Lingi avamiseks ei leidu rakendusi.</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
<string name="funding_googleplay_contribution_error_dismiss_button">Baztertu errorea</string>
<string name="funding_googleplay_contribution_reminder_positive_button">Bai</string>
<string name="funding_googleplay_contribution_reminder_negative_button">Orain ez</string>
</resources>
<string name="funding_googleplay_contribution_error_open_link">Ez da aurkitu aplikaziorik lotura irekitzeko.</string>
</resources>
Loading
Loading