2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-05 21:20:45 +00:00

Closes #1894 - Fixes Help Page Navigation

This commit is contained in:
Emily Kager 2019-04-22 11:32:28 -07:00 committed by Colin Lee
parent a4e4b8a1c9
commit 534d88f629
2 changed files with 25 additions and 18 deletions

View File

@ -234,13 +234,22 @@ class HomeFragment : Fragment(), CoroutineScope {
private fun setupHomeMenu() {
homeMenu = HomeMenu(requireContext()) {
val directions = when (it) {
HomeMenu.Item.Settings -> HomeFragmentDirections.actionHomeFragmentToSettingsFragment()
HomeMenu.Item.Library -> HomeFragmentDirections.actionHomeFragmentToLibraryFragment()
HomeMenu.Item.Help -> return@HomeMenu // Not implemented yetN
when (it) {
HomeMenu.Item.Settings -> Navigation.findNavController(homeLayout).navigate(
HomeFragmentDirections.actionHomeFragmentToSettingsFragment()
)
HomeMenu.Item.Library -> Navigation.findNavController(homeLayout).navigate(
HomeFragmentDirections.actionHomeFragmentToLibraryFragment()
)
HomeMenu.Item.Help -> {
(activity as HomeActivity).openToBrowserAndLoad(
SupportUtils.getSumoURLForTopic(
context!!,
SupportUtils.SumoTopic.HELP
), from = BrowserDirection.FromHome
)
}
}
Navigation.findNavController(homeLayout).navigate(directions)
}
}

View File

@ -128,16 +128,21 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
navigateToDataChoices()
}
resources.getString(pref_key_help) -> {
requireComponents.useCases.tabsUseCases.addTab
.invoke(SupportUtils.getSumoURLForTopic(context!!, SupportUtils.SumoTopic.HELP))
navigateToSettingsArticle()
(activity as HomeActivity).openToBrowserAndLoad(
SupportUtils.getSumoURLForTopic(
context!!,
SupportUtils.SumoTopic.HELP
), from = BrowserDirection.FromSettings
)
}
resources.getString(pref_key_rate) -> {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(SupportUtils.RATE_APP_URL)))
}
resources.getString(pref_key_feedback) -> {
requireComponents.useCases.tabsUseCases.addTab.invoke(SupportUtils.FEEDBACK_URL)
navigateToSettingsArticle()
(activity as HomeActivity).openToBrowserAndLoad(
SupportUtils.FEEDBACK_URL,
from = BrowserDirection.FromSettings
)
}
resources.getString(pref_key_about) -> {
navigateToAbout()
@ -259,13 +264,6 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
Navigation.findNavController(view!!).navigate(directions)
}
private fun navigateToSettingsArticle() {
val newSession = requireComponents.core.sessionManager.selectedSession?.id
view?.let {
(activity as HomeActivity).openToBrowser(newSession, BrowserDirection.FromSettings)
}
}
private fun navigateToAbout() {
val directions = SettingsFragmentDirections.actionSettingsFragmentToAboutFragment()
Navigation.findNavController(view!!).navigate(directions)