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

Link FAQ in DNS rules

parent d9f23b59
...@@ -434,4 +434,21 @@ fun Context.tryOpenBrowser(withLink:String) { ...@@ -434,4 +434,21 @@ fun Context.tryOpenBrowser(withLink:String) {
} catch (e: ActivityNotFoundException) { } catch (e: ActivityNotFoundException) {
Toast.makeText(this, R.string.error_no_webbrowser_installed, Toast.LENGTH_LONG).show() Toast.makeText(this, R.string.error_no_webbrowser_installed, Toast.LENGTH_LONG).show()
} }
} }
\ No newline at end of file
enum class FAQTopics(val id: String) {
DNSRULES("dns-rules")
}
fun Context.askOpenFAQ(topic: FAQTopics?) {
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 ?: ""}")
},
negativeButton = getString(R.string.all_no) to { _, _ -> },
neutralButton = null
)
}
...@@ -206,6 +206,7 @@ class DnsRuleFragment : Fragment() { ...@@ -206,6 +206,7 @@ class DnsRuleFragment : Fragment() {
}.show() }.show()
} }
} }
faq.setOnClickListener { requireContext().askOpenFAQ(FAQTopics.DNSRULES) }
sourceAdapterList = getDatabase().hostSourceDao().getAll().toMutableList() sourceAdapterList = getDatabase().hostSourceDao().getAll().toMutableList()
sourceRuleCount = sourceAdapterList.map { sourceRuleCount = sourceAdapterList.map {
it to (null as Int?) it to (null as Int?)
......
...@@ -64,6 +64,15 @@ ...@@ -64,6 +64,15 @@
android:elevation="0dp" android:elevation="0dp"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
</com.github.jorgecastilloprz.FABProgressCircle> </com.github.jorgecastilloprz.FABProgressCircle>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:id="@+id/faq"
android:tint="#000000"
android:layout_marginStart="8dp"
android:src="@drawable/ic_query_question"
android:elevation="0dp"
android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<View <View
......
...@@ -227,4 +227,6 @@ ...@@ -227,4 +227,6 @@
<string name="querylog_filter_type_dnsrules">Resolved by DNS rules</string> <string name="querylog_filter_type_dnsrules">Resolved by DNS rules</string>
<string name="querylog_filter_type_blocked_by_server">Blocked by the DNS server</string> <string name="querylog_filter_type_blocked_by_server">Blocked by the DNS server</string>
<string name="querylog_filter_shorten_domain">Display shorter version of domain in list</string> <string name="querylog_filter_shorten_domain">Display shorter version of domain in list</string>
<string name="dialog_open_faq">Do you want to have a look at the frequently asked questions and documentation for this feature?</string>
</resources> </resources>
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