1
0
Fork 0

Fixes #1868: Corrects private browsing myths link (#1930)

master
Sawyer Blatz 2019-04-23 14:26:56 -07:00 committed by GitHub
parent 84d601cfaf
commit e2198f19ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -212,7 +212,7 @@ class HomeFragment : Fragment(), CoroutineScope {
}
is TabAction.PrivateBrowsingLearnMore -> {
requireComponents.useCases.tabsUseCases.addPrivateTab
.invoke(SupportUtils.getSumoURLForTopic(context!!, SupportUtils.SumoTopic.PRIVATE_BROWSING_MYTHS))
.invoke(SupportUtils.getGenericSumoURLForTopic(SupportUtils.SumoTopic.PRIVATE_BROWSING_MYTHS))
(activity as HomeActivity).openToBrowser(
requireComponents.core.sessionManager.selectedSession?.id,
BrowserDirection.FromHome

View File

@ -20,7 +20,7 @@ object SupportUtils {
internal val topicStr: String
) {
HELP("firefox-android-help"),
PRIVATE_BROWSING_MYTHS("private-browsing-myths")
PRIVATE_BROWSING_MYTHS("common-myths-about-private-browsing")
}
fun getSumoURLForTopic(context: Context, topic: SumoTopic): String {
@ -31,6 +31,13 @@ object SupportUtils {
return "https://support.mozilla.org/1/mobile/$appVersion/$osTarget/$langTag/$escapedTopic"
}
// Used when the app version and os are not part of the URL
fun getGenericSumoURLForTopic(topic: SumoTopic): String {
val escapedTopic = getEncodedTopicUTF8(topic.topicStr)
val langTag = getLanguageTag(Locale.getDefault())
return "https://support.mozilla.org/$langTag/kb/$escapedTopic"
}
private fun getEncodedTopicUTF8(topic: String): String {
try {
return URLEncoder.encode(topic, "UTF-8")