扫码连接终端

This commit is contained in:
wanghongen
2023-07-09 04:16:15 +08:00
parent 75534d9004
commit 3a67c43f32
28 changed files with 723 additions and 157 deletions

View File

@@ -45,17 +45,16 @@ android {
defaultConfig {
applicationId "com.network.proxy"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 19
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}

View File

@@ -2,6 +2,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE"/>
<application
android:label="ProxyPin"

View File

@@ -10,9 +10,10 @@ import io.flutter.plugin.common.MethodChannel
class MainActivity : FlutterActivity() {
private val CHANNEL = "com.proxy/proxyVpn"
private val VPN_REQUEST_CODE: Int = 24
companion object {
const val VPN_CHANNEL = "com.proxy/proxyVpn"
const val VPN_REQUEST_CODE: Int = 24
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -21,7 +22,14 @@ class MainActivity : FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
vpnMethodChannel(flutterEngine)
}
/**
* vpn方法通道
*/
private fun vpnMethodChannel(flutterEngine: FlutterEngine) {
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, VPN_CHANNEL)
.setMethodCallHandler { call, result ->
when (call.method) {
"startVpn" -> {