diff --git a/app/src/main/java/io/nekohasekai/sfa/ui/MainActivity.kt b/app/src/main/java/io/nekohasekai/sfa/ui/MainActivity.kt
index 0bfde06..2df7515 100644
--- a/app/src/main/java/io/nekohasekai/sfa/ui/MainActivity.kt
+++ b/app/src/main/java/io/nekohasekai/sfa/ui/MainActivity.kt
@@ -225,13 +225,11 @@ class MainActivity : AbstractActivity(), ServiceConnection.Callback {
private val locationPermissionLauncher =
registerForActivityResult(ActivityResultContracts.RequestPermission()) {
if (it) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ if (it && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
requestBackgroundLocationPermission()
} else {
startService()
}
- } else {
- showPermissionDeniedDescription()
}
}
@@ -239,8 +237,6 @@ class MainActivity : AbstractActivity(), ServiceConnection.Callback {
registerForActivityResult(ActivityResultContracts.RequestPermission()) {
if (it) {
startService()
- } else {
- showPermissionDeniedDescription()
}
}
@@ -350,7 +346,7 @@ class MainActivity : AbstractActivity(), ServiceConnection.Callback {
.setPositiveButton(R.string.ok) { _, _ ->
requestFineLocationPermission0()
}
- .setNegativeButton(R.string.cancel, null)
+ .setNegativeButton(R.string.no_thanks, null)
.setCancelable(false)
.show()
}
@@ -376,7 +372,7 @@ class MainActivity : AbstractActivity(), ServiceConnection.Callback {
.setPositiveButton(R.string.ok) { _, _ ->
backgroundLocationPermissionLauncher.launch(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
}
- .setNegativeButton(R.string.cancel, null)
+ .setNegativeButton(R.string.no_thanks, null)
.setCancelable(false)
.show()
}
@@ -402,27 +398,6 @@ class MainActivity : AbstractActivity(), ServiceConnection.Callback {
}
}
- private fun showPermissionDeniedDescription() {
- val message = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- Html.fromHtml(
- getString(R.string.location_permission_denied_description),
- Html.FROM_HTML_MODE_LEGACY
- )
- } else {
- @Suppress("DEPRECATION")
- Html.fromHtml(getString(R.string.location_permission_denied_description))
- }
- MaterialAlertDialogBuilder(this)
- .setTitle(R.string.location_permission_title)
- .setMessage(message)
- .setPositiveButton(R.string.ok, null)
- .setNeutralButton(R.string.open_settings) { _, _ ->
- openPermissionSettings()
- }
- .setCancelable(false)
- .show()
- }
-
@SuppressLint("PrivateApi")
fun getSystemProperty(key: String?): String? {
try {
diff --git a/app/src/main/java/io/nekohasekai/sfa/ui/main/SettingsFragment.kt b/app/src/main/java/io/nekohasekai/sfa/ui/main/SettingsFragment.kt
index f24bd5a..5103af8 100644
--- a/app/src/main/java/io/nekohasekai/sfa/ui/main/SettingsFragment.kt
+++ b/app/src/main/java/io/nekohasekai/sfa/ui/main/SettingsFragment.kt
@@ -73,6 +73,9 @@ class SettingsFragment : Fragment() {
binding.checkUpdateButton.setOnClickListener {
Vendor.checkUpdate(activity, true)
}
+ binding.openPrivacyPolicyButton.setOnClickListener {
+ activity.launchCustomTab("https://sing-box.sagernet.org/clients/privacy/")
+ }
binding.disableMemoryLimit.addTextChangedListener {
lifecycleScope.launch(Dispatchers.IO) {
val newValue = EnabledType.valueOf(it).boolValue
diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml
index 4c00786..2284e93 100644
--- a/app/src/main/res/layout/fragment_settings.xml
+++ b/app/src/main/res/layout/fragment_settings.xml
@@ -82,6 +82,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/check_update" />
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 80ff8e6..c550930 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -3,7 +3,6 @@
Stop
OK
- Cancel
No, thanks
Dashboard
@@ -87,6 +86,7 @@
Data Size
Automatic Update Check
Check Update
+ Privacy Policy
App
Memory Limit
Background permission
@@ -147,8 +147,7 @@
Other methods
Start
Location permission
- wifi_ssid and wifi_bssid routing rules. To make them work, sing-box uses the location permission in the background to get information about the connected Wi-Fi network. The information will be used only for routing purposes. Please grant the permission to continue.]]>
- background location permission is required. Please select Allow all the time to grant the permission.]]>
- grant the permission or remove wifi_ssid and wifi_bssid routing rules from your profile.]]>
+ wifi_ssid or wifi_bssid routing rules. To make them work, sing-box uses the location permission in the background to get information about the connected Wi-Fi network. The information will be used for routing purposes only.]]>
+ background location permission is required. Select Allow all the time to grant the permission.]]>
Open Settings
\ No newline at end of file