mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-19 06:30:05 +08:00
VpnService policy
This commit is contained in:
parent
5dc09caf22
commit
b77d1fc82e
@ -37,6 +37,7 @@ import io.nekohasekai.sagernet.group.GroupUpdater
|
||||
import io.nekohasekai.sagernet.ktx.*
|
||||
import io.nekohasekai.sagernet.widget.ListHolderListener
|
||||
import moe.matsuri.nb4a.utils.Util
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
class MainActivity : ThemedActivity(),
|
||||
@ -97,6 +98,8 @@ class MainActivity : ThemedActivity(),
|
||||
onNewIntent(intent)
|
||||
}
|
||||
|
||||
refreshNavMenu(DataStore.enableClashAPI)
|
||||
|
||||
// sdk 33 notification
|
||||
if (Build.VERSION.SDK_INT >= 33) {
|
||||
val checkPermission =
|
||||
@ -109,7 +112,24 @@ class MainActivity : ThemedActivity(),
|
||||
}
|
||||
}
|
||||
|
||||
refreshNavMenu(DataStore.enableClashAPI)
|
||||
// consent
|
||||
try {
|
||||
val f = File(application.filesDir, "consent")
|
||||
if (!f.exists()) {
|
||||
MaterialAlertDialogBuilder(this@MainActivity)
|
||||
.setTitle("VpnService policy")
|
||||
.setMessage("Since the main function of this application is VPN, it must use VpnService.")
|
||||
.setPositiveButton(R.string.yes) { _, _ ->
|
||||
f.createNewFile()
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel) { _, _ ->
|
||||
finish()
|
||||
}
|
||||
.show()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Logs.w(e)
|
||||
}
|
||||
}
|
||||
|
||||
fun refreshNavMenu(clashApi: Boolean) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user