Commit 995db732 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Link FAQ for non-VPN mode in the preferences

Implements #264
parent a1e49abb
Pipeline #7383 passed with stage
in 4 minutes and 16 seconds
......@@ -4,10 +4,7 @@ import android.app.Activity
import android.app.AlarmManager
import android.app.KeyguardManager
import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.*
import android.hardware.fingerprint.FingerprintManager
import android.net.ConnectivityManager
import android.net.Network
......@@ -15,6 +12,7 @@ import android.net.NetworkCapabilities
import android.net.Uri
import android.os.Build
import android.os.PowerManager
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
......@@ -423,4 +421,17 @@ val Context.isPrivateDnsActive: Boolean
if (it.activeNetwork == null) false
else it.getLinkProperties(it.activeNetwork)?.isPrivateDnsActive ?: false
}
}
\ No newline at end of file
}
fun Context.tryOpenBrowser(withLink:String) {
try {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(withLink)
)
)
} catch (e: ActivityNotFoundException) {
Toast.makeText(this, R.string.error_no_webbrowser_installed, Toast.LENGTH_LONG).show()
}
}
\ No newline at end of file
......@@ -118,17 +118,7 @@ class AboutFragment : Fragment() {
true
}
view.faq.setOnClickListener {
try {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://nebulo.app/faq")
)
)
} catch (e: ActivityNotFoundException) {
Toast.makeText(requireContext(), R.string.error_no_webbrowser_installed, Toast.LENGTH_LONG)
.show()
}
requireContext().tryOpenBrowser("https://nebulo.app/faq")
}
}
}
\ No newline at end of file
......@@ -325,6 +325,10 @@ class SettingsFragment : PreferenceFragmentCompat() {
)
true
}
findPreference("nonvpn_help_faq").setOnPreferenceClickListener {
requireContext().tryOpenBrowser("https://nebulo.app/faq#non-vpn-mode")
true
}
}
@SuppressLint("NewApi")
......
......@@ -183,6 +183,8 @@
<string name="nonvpn_help_generic_title">Generic VPN apps</string>
<string name="summary_nonvpn_help_generic">Click here to get instructions on how to configure VPN apps</string>
<string name="title_nonvpn_help_faq">Documentation</string>
<string name="summary_nonvpn_help_faq">Click here to open a browser window with help and documentation for non-VPN mode</string>
<string-array name="languages">
<item>System language</item>
......
......@@ -3,6 +3,11 @@
<androidx.preference.Preference android:summary="@string/summary_category_nonvpnmode" />
<androidx.preference.Preference
android:summary="@string/summary_nonvpn_help_faq"
android:key="nonvpn_help_faq"
android:title="@string/title_nonvpn_help_faq" />
<androidx.preference.PreferenceCategory android:title="@string/preference_category_nonvpnmode">
<androidx.preference.CheckBoxPreference
android:defaultValue="false"
......
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