From 67f5d7702dcb9c5fb19e2ed91f0d48baa8d967a3 Mon Sep 17 00:00:00 2001 From: git-elliot Date: Sun, 28 Jan 2024 17:20:19 +0530 Subject: [PATCH] Fixes freeze issue in port scan for full range --- .vscode/launch.json | 14 ++++++++++++-- devtools_options.yaml | 1 + fastlane/metadata/android/en-US/changelogs/17.txt | 3 +++ lib/helper/app_settings.dart | 9 +++++++-- lib/main.dart | 7 ++++--- lib/pages/network_troubleshoot/port_scan_page.dart | 1 + macos/Flutter/GeneratedPluginRegistrant.swift | 2 +- macos/Podfile.lock | 4 ++-- pubspec.yaml | 4 ++-- 9 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 devtools_options.yaml create mode 100644 fastlane/metadata/android/en-US/changelogs/17.txt diff --git a/.vscode/launch.json b/.vscode/launch.json index 73aa6e20..d455687b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,10 +10,20 @@ "type": "dart" }, { - "name": "vernet (profile mode)", + "name": "Vernet (profile mode)", + "request": "launch", + "type": "dart", + "flutterMode": "profile" + }, + { + "name": "Vernet F-droid (profile mode)", "request": "launch", "type": "dart", - "flutterMode": "profile" + "flutterMode": "profile", + "args": [ + "--flavor", + "fdroid" + ] }, { "name": "F-droid", diff --git a/devtools_options.yaml b/devtools_options.yaml new file mode 100644 index 00000000..7e7e7f67 --- /dev/null +++ b/devtools_options.yaml @@ -0,0 +1 @@ +extensions: diff --git a/fastlane/metadata/android/en-US/changelogs/17.txt b/fastlane/metadata/android/en-US/changelogs/17.txt new file mode 100644 index 00000000..cd09d340 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/17.txt @@ -0,0 +1,3 @@ +Fixed full port scan freeze issue. +Theme and framework update. +Minor bug fixes and improvements. diff --git a/lib/helper/app_settings.dart b/lib/helper/app_settings.dart index c3403aac..eb364a0a 100644 --- a/lib/helper/app_settings.dart +++ b/lib/helper/app_settings.dart @@ -1,3 +1,4 @@ +import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; class AppSettings { @@ -45,20 +46,24 @@ class AppSettings { } Future load() async { + debugPrint("Fetching all app settings"); _firstSubnet = (await SharedPreferences.getInstance()).getInt(_firstSubnetKey) ?? _firstSubnet; - + debugPrint("First subnet : $_firstSubnet"); _lastSubnet = (await SharedPreferences.getInstance()).getInt(_lastSubnetKey) ?? _lastSubnet; + debugPrint("Last subnet : $_lastSubnet"); _socketTimeout = (await SharedPreferences.getInstance()).getInt(_socketTimeoutKey) ?? _socketTimeout; - + debugPrint("Socket timeout : $_socketTimeout"); _pingCount = (await SharedPreferences.getInstance()).getInt(_pingCountKey) ?? _pingCount; + + debugPrint("Ping count : $_socketTimeout"); } } diff --git a/lib/main.dart b/lib/main.dart index 91eacbc4..ff7bcc06 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,15 +11,16 @@ import 'package:vernet/pages/home_page.dart'; import 'package:vernet/pages/location_consent_page.dart'; import 'package:vernet/pages/settings_page.dart'; -late AppSettings appSettings; +AppSettings appSettings = AppSettings.instance; Future main() async { configureDependencies(Env.prod); WidgetsFlutterBinding.ensureInitialized(); final appDocDirectory = await getApplicationDocumentsDirectory(); - await configureNetworkTools(appDocDirectory.path, enableDebugging: true); + await configureNetworkTools(appDocDirectory.path); final bool allowed = await ConsentLoader.isConsentPageShown(); - appSettings = AppSettings.instance..load(); + // load app settings + await appSettings.load(); runApp(MyApp(allowed)); } diff --git a/lib/pages/network_troubleshoot/port_scan_page.dart b/lib/pages/network_troubleshoot/port_scan_page.dart index c0a7ef2e..204af863 100644 --- a/lib/pages/network_troubleshoot/port_scan_page.dart +++ b/lib/pages/network_troubleshoot/port_scan_page.dart @@ -98,6 +98,7 @@ class _PortScanPageState extends State endPort: int.parse(_endPortEditingController.text), timeout: Duration(milliseconds: appSettings.socketTimeout), progressCallback: _handleProgress, + async: true, ).listen(_handleEvent, onDone: _handleOnDone); } } diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 8d91c82a..3ef206f5 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -13,7 +13,7 @@ import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { NetworkInfoPlusPlugin.register(with: registry.registrar(forPlugin: "NetworkInfoPlusPlugin")) - FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) + FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 54066a3e..08980a31 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -39,8 +39,8 @@ SPEC CHECKSUMS: FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 network_info_plus: f4fbc7877ab7b3294500d9441dfa53cd54972d05 package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce - path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 - shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 + path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c + shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 PODFILE CHECKSUM: 4d1ddd58dcd1dc92dd2b397bbacb622f345603ab diff --git a/pubspec.yaml b/pubspec.yaml index 436c309e..99397464 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A Network Analyzer publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 1.0.1+16 +version: 1.0.2+17 environment: sdk: ">=2.17.0 <3.0.0" @@ -34,7 +34,7 @@ dependencies: # Discover network info and configure themselves accordingly network_info_plus: ^4.0.2 # Helps you discover open ports, devices on subnet and more. - network_tools_flutter: ^1.0.4 + network_tools_flutter: ^1.0.5 # Querying information about the application package, such as CFBundleVersion package_info_plus: ^4.1.0 path_provider: ^2.1.1