parent
84d601cfaf
commit
e2198f19ad
|
@ -212,7 +212,7 @@ class HomeFragment : Fragment(), CoroutineScope {
|
||||||
}
|
}
|
||||||
is TabAction.PrivateBrowsingLearnMore -> {
|
is TabAction.PrivateBrowsingLearnMore -> {
|
||||||
requireComponents.useCases.tabsUseCases.addPrivateTab
|
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(
|
(activity as HomeActivity).openToBrowser(
|
||||||
requireComponents.core.sessionManager.selectedSession?.id,
|
requireComponents.core.sessionManager.selectedSession?.id,
|
||||||
BrowserDirection.FromHome
|
BrowserDirection.FromHome
|
||||||
|
|
|
@ -20,7 +20,7 @@ object SupportUtils {
|
||||||
internal val topicStr: String
|
internal val topicStr: String
|
||||||
) {
|
) {
|
||||||
HELP("firefox-android-help"),
|
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 {
|
fun getSumoURLForTopic(context: Context, topic: SumoTopic): String {
|
||||||
|
@ -31,6 +31,13 @@ object SupportUtils {
|
||||||
return "https://support.mozilla.org/1/mobile/$appVersion/$osTarget/$langTag/$escapedTopic"
|
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 {
|
private fun getEncodedTopicUTF8(topic: String): String {
|
||||||
try {
|
try {
|
||||||
return URLEncoder.encode(topic, "UTF-8")
|
return URLEncoder.encode(topic, "UTF-8")
|
||||||
|
|
Loading…
Reference in New Issue