|
1 | 1 | package tech.httptoolkit.android
|
2 | 2 |
|
3 | 3 | import android.content.Context
|
| 4 | +import android.content.Intent |
| 5 | +import android.net.Uri |
| 6 | +import android.os.Build |
4 | 7 | import android.text.method.LinkMovementMethod
|
5 | 8 | import android.view.LayoutInflater
|
6 | 9 | import android.widget.LinearLayout
|
7 | 10 | import android.widget.TextView
|
8 | 11 | import com.google.android.material.card.MaterialCardView
|
| 12 | +import com.google.android.material.dialog.MaterialAlertDialogBuilder |
| 13 | + |
| 14 | +private val isLineageOs = Build.HOST.startsWith("lineage") |
9 | 15 |
|
10 | 16 | class ConnectionStatusView(
|
11 | 17 | context: Context,
|
@@ -37,7 +43,30 @@ class ConnectionStatusView(
|
37 | 43 | )
|
38 | 44 |
|
39 | 45 | val appInterceptionStatus = findViewById<MaterialCardView>(R.id.appInterceptionStatus)
|
40 |
| - appInterceptionStatus.setOnClickListener { _ -> changeApps() } |
| 46 | + appInterceptionStatus.setOnClickListener { _ -> |
| 47 | + if (!isLineageOs) { |
| 48 | + changeApps() |
| 49 | + } else { |
| 50 | + MaterialAlertDialogBuilder(context) |
| 51 | + .setTitle("Not available") |
| 52 | + .setIcon(R.drawable.ic_exclamation_triangle) |
| 53 | + .setMessage( |
| 54 | + """ |
| 55 | + Per-app filtering is not possible on LineageOS, due to a bug in Lineage's VPN implementation. |
| 56 | +
|
| 57 | + If you'd like this fixed, please upvote the bug in their issue tracker. |
| 58 | + """.trimIndent() |
| 59 | + ) |
| 60 | + .setNegativeButton("Cancel") { _, _ -> } |
| 61 | + .setPositiveButton("View the bug") { _, _ -> |
| 62 | + context.startActivity(Intent( |
| 63 | + Intent.ACTION_VIEW, |
| 64 | + Uri.parse("https://gitlab.com/LineageOS/issues/android/-/issues/1706") |
| 65 | + )) |
| 66 | + } |
| 67 | + .show() |
| 68 | + } |
| 69 | + } |
41 | 70 |
|
42 | 71 | val appInterceptionStatusText = findViewById<TextView>(R.id.appInterceptionStatusText)
|
43 | 72 | appInterceptionStatusText.text = context.getString(
|
|
0 commit comments