diff --git a/android/app/src/main/kotlin/eu/repression/spoofdpi/spoof_dpi/MainActivity.kt b/android/app/src/main/kotlin/eu/repression/spoofdpi/spoof_dpi/MainActivity.kt index 711727f..096ba53 100644 --- a/android/app/src/main/kotlin/eu/repression/spoofdpi/spoof_dpi/MainActivity.kt +++ b/android/app/src/main/kotlin/eu/repression/spoofdpi/spoof_dpi/MainActivity.kt @@ -28,7 +28,8 @@ class MainActivity: FlutterActivity() { "stop_proxy" -> stopProxyService(result) "is_proxy_running" -> isProxyRunning(result) "test_service" -> testService(result) - "open_binary_sc" -> openBinary(result) + "open_binary" -> openBinary(result) + "open_me" -> openMe(result) else -> result.notImplemented() } } @@ -81,7 +82,9 @@ class MainActivity: FlutterActivity() { startService(serviceIntent) } - requestVpnPermission() + if (call.argument("vpn_mode") == true) { + requestVpnPermission() + } result.success("Proxy service started, VPN request initiated") } diff --git a/lib/globals.dart b/lib/globals.dart index db5b4f5..e980fc3 100644 --- a/lib/globals.dart +++ b/lib/globals.dart @@ -1 +1 @@ -const appVersion = "1.0"; \ No newline at end of file +const appVersion = "1.1"; \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 6b94376..2ca7ca0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -131,7 +131,7 @@ class HomePage extends HookWidget { } else { try { var params = buildParams(); - await platform.invokeMethod('start_proxy', {'params': params}); + await platform.invokeMethod('start_proxy', {'params': params, 'vpn_mode': SpUtil.getBool('use_vpn_mode', defValue: true)}); isRunning.value = true; } on PlatformException catch (e) { print("Failed to start proxy: '${e.message}'."); @@ -180,7 +180,11 @@ class SettingsPage extends HookWidget { @override Widget build(BuildContext context) { + + final vpnMode = useState(SpUtil.getBool('use_vpn_mode', defValue: true)!); + final enableDoh = useState(SpUtil.getBool('doh', defValue: true)!); + final TextEditingController dnsController = useTextEditingController( text: SpUtil.getString('dns', defValue: '8.8.8.8'), ); @@ -193,6 +197,11 @@ class SettingsPage extends HookWidget { SpUtil.putBool('doh', enableDoh.value); } + void updateVpnMode(bool? value) { + vpnMode.value = value ?? true; + SpUtil.putBool('use_vpn_mode', vpnMode.value); + } + void updateDns(String value) { if (_isValidIp(value)) { SpUtil.putString('dns', value); @@ -212,13 +221,20 @@ class SettingsPage extends HookWidget { padding: const EdgeInsets.all(16.0), child: Column( children: [ + CheckboxListTile( + secondary: const Icon(Icons.vpn_key), + title: const Text('Use VPN mode'), + subtitle: const Text('If disabled - only Proxy server will be started'), + value: vpnMode.value, + onChanged: updateVpnMode, + ), CheckboxListTile( secondary: const Icon(Icons.public), title: const Text('Enable DOH'), value: enableDoh.value, onChanged: updateDoh, ), - SizedBox(height: 15,), + const SizedBox(height: 15,), TextField( controller: dnsController, decoration: const InputDecoration( diff --git a/pubspec.yaml b/pubspec.yaml index 50507a4..b722339 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+1 +version: 1.1.0+1 environment: sdk: ^3.5.1