Commit f67e1349 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Use openFAQ() from settings

parent fd278ed4
......@@ -436,19 +436,24 @@ fun Context.tryOpenBrowser(withLink:String) {
}
}
enum class FAQTopics(val id: String) {
DNSRULES("dns-rules")
enum class FAQTopic(val id: String) {
DNSRULES("dns-rules"),
NONVPNMODE("non-vpn-mode")
}
fun Context.askOpenFAQ(topic: FAQTopics?) {
fun Context.askOpenFAQ(topic: FAQTopic?) {
showInfoTextDialog(
this,
getString(R.string.about_help_faq),
getString(R.string.dialog_open_faq),
positiveButton = getString(R.string.all_yes) to { _, _ ->
tryOpenBrowser("https://nebulo.app/faq#${topic?.id ?: ""}")
openFAQ(topic)
},
negativeButton = getString(R.string.all_no) to { _, _ -> },
neutralButton = null
)
}
fun Context.openFAQ(topic:FAQTopic?) {
tryOpenBrowser("https://nebulo.app/faq#${topic?.id ?: ""}")
}
\ No newline at end of file
......@@ -206,7 +206,7 @@ class DnsRuleFragment : Fragment() {
}.show()
}
}
faq.setOnClickListener { requireContext().askOpenFAQ(FAQTopics.DNSRULES) }
faq.setOnClickListener { requireContext().askOpenFAQ(FAQTopic.DNSRULES) }
sourceAdapterList = getDatabase().hostSourceDao().getAll().toMutableList()
sourceRuleCount = sourceAdapterList.map {
it to (null as Int?)
......
......@@ -326,7 +326,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
true
}
findPreference("nonvpn_help_faq").setOnPreferenceClickListener {
requireContext().tryOpenBrowser("https://nebulo.app/faq#non-vpn-mode")
requireContext().openFAQ(FAQTopic.NONVPNMODE)
true
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment