Skip to content

Commit

Permalink
Update About Page text
Browse files Browse the repository at this point in the history
  • Loading branch information
cmonfortep committed Feb 1, 2025
1 parent 3fce588 commit 03a3e87
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ import androidx.lifecycle.lifecycleScope
import com.duckduckgo.anvil.annotations.ContributeToActivityStarter
import com.duckduckgo.anvil.annotations.InjectWith
import com.duckduckgo.app.about.AboutDuckDuckGoViewModel.Command
import com.duckduckgo.app.about.AboutDuckDuckGoViewModel.Command.LaunchBrowserWithLearnMoreUrl
import com.duckduckgo.app.about.AboutDuckDuckGoViewModel.Command.LaunchBrowserWithPrivacyProtectionsUrl
import com.duckduckgo.app.about.AboutDuckDuckGoViewModel.Command.LaunchFeedback
import com.duckduckgo.app.about.AboutDuckDuckGoViewModel.Command.LaunchPproUnifiedFeedback
import com.duckduckgo.app.about.AboutDuckDuckGoViewModel.Command.LaunchWebViewWithComparisonChartUrl
import com.duckduckgo.app.about.AboutDuckDuckGoViewModel.Command.LaunchWebViewWithPPROUrl
import com.duckduckgo.app.about.AboutDuckDuckGoViewModel.Command.LaunchWebViewWithPrivacyPolicyUrl
import com.duckduckgo.app.about.AboutDuckDuckGoViewModel.Command.LaunchWebViewWithVPNUrl
import com.duckduckgo.app.browser.BrowserActivity
import com.duckduckgo.app.browser.R
import com.duckduckgo.app.browser.databinding.ActivityAboutDuckDuckGoBinding
Expand Down Expand Up @@ -116,52 +124,61 @@ class AboutDuckDuckGoActivity : DuckDuckGoActivity() {
private fun addClickableLinks(): SpannableString {
val fullText = getText(
if (settingsPageFeature.newSettingsPage().isEnabled()) {
R.string.aboutDescriptionNew
R.string.aboutDescriptionBrandUpdate2025
} else {
R.string.aboutDescription
R.string.aboutDescriptionBrandUpdate2025
},
) as SpannedString

val spannableString = SpannableString(fullText)
val annotations = fullText.getSpans(0, fullText.length, Annotation::class.java)

annotations?.find { it.value == COMPARISON_CHART_ANNOTATION }?.let {
addSpannable(spannableString, fullText, it) {
viewModel.onComparisonChartLinkClicked()
}
}

annotations?.find { it.value == PPRO_ANNOTATION }?.let {
addSpannable(spannableString, fullText, it) {
viewModel.onPProHelpPageLinkClicked()
}
}

annotations?.find { it.value == VPN_ANNOTATION }?.let {
addSpannable(spannableString, fullText, it) {
viewModel.onVPNHelpPageLinkClicked()
}
}

annotations?.find { it.value == PRIVACY_PROTECTION_ANNOTATION }?.let {
addSpannable(
spannableString,
object : ClickableSpan() {
override fun onClick(widget: View) {
viewModel.onPrivacyProtectionsLinkClicked()
}
},
fullText,
it,
)
addSpannable(spannableString, fullText, it) {
viewModel.onPrivacyProtectionsLinkClicked()
}
}

annotations?.find { it.value == LEARN_MORE_ANNOTATION }?.let {
addSpannable(
spannableString,
object : ClickableSpan() {
override fun onClick(widget: View) {
viewModel.onLearnMoreLinkClicked()
}
},
fullText,
it,
)
addSpannable(spannableString, fullText, it) {
viewModel.onLearnMoreLinkClicked()
}
}

return spannableString
}

private fun addSpannable(
spannableString: SpannableString,
clickableSpan: ClickableSpan,
fullText: SpannedString,
it: Annotation,
onClick: (widget: View) -> Unit,
) {
spannableString.apply {
setSpan(
clickableSpan,
object : ClickableSpan() {
override fun onClick(widget: View) {
onClick(widget)
}
},
fullText.getSpanStart(it),
fullText.getSpanEnd(it),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE,
Expand Down Expand Up @@ -214,11 +231,14 @@ class AboutDuckDuckGoActivity : DuckDuckGoActivity() {

private fun processCommand(it: Command) {
when (it) {
is Command.LaunchBrowserWithLearnMoreUrl -> launchBrowserScreen()
is Command.LaunchWebViewWithPrivacyPolicyUrl -> launchWebViewScreen()
is Command.LaunchBrowserWithPrivacyProtectionsUrl -> launchPrivacyProtectionsScreen()
is Command.LaunchFeedback -> launchFeedback()
is Command.LaunchPproUnifiedFeedback -> launchPproUnifiedFeedback()
LaunchBrowserWithLearnMoreUrl -> launchBrowserScreen()
LaunchWebViewWithPrivacyPolicyUrl -> launchWebViewScreen(PRIVACY_POLICY_WEB_LINK, getString(R.string.settingsPrivacyPolicyDuckduckgo))
LaunchBrowserWithPrivacyProtectionsUrl -> launchPrivacyProtectionsScreen()
LaunchFeedback -> launchFeedback()
LaunchPproUnifiedFeedback -> launchPproUnifiedFeedback()
LaunchWebViewWithComparisonChartUrl -> launchWebViewScreen(COMPARISON_CHART_URL, getString(R.string.settingsAboutDuckduckgo))
LaunchWebViewWithPPROUrl -> launchWebViewScreen(PPRO_URL, getString(R.string.settingsAboutDuckduckgo))
LaunchWebViewWithVPNUrl -> launchWebViewScreen(VPN_URL, getString(R.string.settingsAboutDuckduckgo))
}
}

Expand All @@ -227,12 +247,12 @@ class AboutDuckDuckGoActivity : DuckDuckGoActivity() {
finish()
}

private fun launchWebViewScreen() {
private fun launchWebViewScreen(url: String, screenTitle: String) {
globalActivityStarter.start(
this,
WebViewActivityWithParams(
url = PRIVACY_POLICY_WEB_LINK,
screenTitle = getString(R.string.settingsPrivacyPolicyDuckduckgo),
url = url,
screenTitle = screenTitle,
),
)
}
Expand Down Expand Up @@ -263,5 +283,11 @@ class AboutDuckDuckGoActivity : DuckDuckGoActivity() {
private const val LEARN_MORE_ANNOTATION = "learn_more_link"
private const val PRIVACY_POLICY_WEB_LINK = "https://duckduckgo.com/privacy"
private const val PRIVACY_PROTECTIONS_WEB_LINK = "https://duckduckgo.com/duckduckgo-help-pages/privacy/web-tracking-protections/"
private const val COMPARISON_CHART_ANNOTATION = "chart_comparison"
private const val COMPARISON_CHART_URL = "https://duckduckgo.com/compare-privacy"
private const val PPRO_ANNOTATION = "ppro_help_page"
private const val PPRO_URL = "https://duckduckgo.com/duckduckgo-help-pages/privacy-pro/"
private const val VPN_ANNOTATION = "vpn_help_page"
private const val VPN_URL = "https://duckduckgo.com/duckduckgo-help-pages/privacy-pro/vpn/"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ class AboutDuckDuckGoViewModel @Inject constructor(
)

sealed class Command {
object LaunchBrowserWithLearnMoreUrl : Command()
object LaunchBrowserWithPrivacyProtectionsUrl : Command()
object LaunchWebViewWithPrivacyPolicyUrl : Command()
object LaunchFeedback : Command()
object LaunchPproUnifiedFeedback : Command()
data object LaunchBrowserWithLearnMoreUrl : Command()
data object LaunchBrowserWithPrivacyProtectionsUrl : Command()
data object LaunchWebViewWithPrivacyPolicyUrl : Command()
data object LaunchFeedback : Command()
data object LaunchPproUnifiedFeedback : Command()
data object LaunchWebViewWithComparisonChartUrl : Command()
data object LaunchWebViewWithPPROUrl : Command()
data object LaunchWebViewWithVPNUrl : Command()
}

private val viewState = MutableStateFlow(ViewState())
Expand All @@ -74,6 +77,18 @@ class AboutDuckDuckGoViewModel @Inject constructor(
return command.receiveAsFlow()
}

fun onComparisonChartLinkClicked() {
viewModelScope.launch { command.send(Command.LaunchWebViewWithComparisonChartUrl) }
}

fun onPProHelpPageLinkClicked() {
viewModelScope.launch { command.send(Command.LaunchWebViewWithPPROUrl) }
}

fun onVPNHelpPageLinkClicked() {
viewModelScope.launch { command.send(Command.LaunchWebViewWithVPNUrl) }
}

fun onLearnMoreLinkClicked() {
viewModelScope.launch { command.send(Command.LaunchBrowserWithLearnMoreUrl) }
pixel.fire(SETTINGS_ABOUT_DDG_LEARN_MORE_PRESSED)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
<string name="aboutHeader">Welcome to the Duck Side!</string>
<string name="aboutDescription">DuckDuckGo is the independent Internet privacy company founded in 2008 for anyone who’s tired of being tracked online and wants an easy solution. We’re proof you can get real privacy protection online without tradeoffs.\n\nThe DuckDuckGo browser comes with the features you expect from a go-to browser, like bookmarks, tabs, passwords, and more, plus over <annotation type="privacy_protection_link">a dozen powerful privacy protections</annotation> not offered in most popular browsers by default. This uniquely comprehensive set of privacy protections helps protect your online activities, from searching to browsing, emailing, and more.\n\nOur privacy protections work without having to know anything about the technical details or deal with complicated settings. All you have to do is switch your browser to DuckDuckGo across all your devices and you get privacy by default.\n\nBut if you do want a peek under the hood, you can find more information about how DuckDuckGo privacy protections work on our <annotation type="learn_more_link">help pages</annotation></string>
<string name="aboutDescriptionNew">DuckDuckGo is the independent Internet privacy company founded in 2008 for anyone who\'s tired of being tracked online and wants an easy solution. We\'re proof you can get real privacy protection online without tradeoffs.\n\nThe DuckDuckGo browser comes with the features you expect from a go-to browser, like bookmarks, tabs, passwords, and more, plus over <annotation type="privacy_protection_link">a dozen powerful privacy protections</annotation> not offered in most popular browsers by default. This uniquely comprehensive set of privacy protections helps protect your online activities, from searching to browsing, emailing, and more.\n\nOur privacy protections work without having to know anything about the technical details or deal with complicated settings. All you have to do is switch your browser to DuckDuckGo across all your devices and you get privacy by default.\n\nBut if you do want a peek under the hood, you can find more information about how DuckDuckGo privacy protections work on our <annotation type="learn_more_link">help pages</annotation></string>
<string name="aboutDescriptionBrandUpdate2025">DuckDuckGo is the independent online protection company for anyone who wants to take back control of their personal information.\n\nWe believe the best way to protect your personal information from hackers, scammers, and privacy-invasive companies is to stop it from being collected at all. That\'s why millions of people <annotation type="chart_comparison">choose DuckDuckGo over Chrome and other browsers</annotation> to search and browse online. Our built-in search engine is like Google but never tracks your searches. And our browsing protections, such as ad tracker blocking and cookie blocking, help stop other companies from collecting your data. Oh, and our browser is free — we make money from <annotation type="privacy_respecting_ads">privacy-respecting search ads</annotation>, not by exploiting your data. In addition, we also offer <annotation type="ppro_help_page">Privacy Pro</annotation>, a three-in-one subscription service, integrated into our browser. Subscribers to Privacy Pro get even more privacy protection with a fast and simple <annotation type="vpn_help_page">VPN</annotation> that helps secure your online activity, a service that finds and removes your personal information from people-finder sites, and a service that restores your identity should it be stolen.\n\nTake back control of your personal information with the browser designed for data protection, not data collection.</string>
<string name="no_suggestions">No Suggestions</string>

<!-- Broken Site Activity -->
Expand Down

0 comments on commit 03a3e87

Please sign in to comment.