diff --git a/android/fastlane/metadata/android/en-US/changelogs/29.txt b/android/fastlane/metadata/android/en-US/changelogs/29.txt new file mode 100644 index 0000000..b515ef2 --- /dev/null +++ b/android/fastlane/metadata/android/en-US/changelogs/29.txt @@ -0,0 +1 @@ +Fixed slowness of devices scan. \ No newline at end of file diff --git a/integration_test/app_test.dart b/integration_test/app_test.dart index 5b548c7..3054da6 100644 --- a/integration_test/app_test.dart +++ b/integration_test/app_test.dart @@ -53,7 +53,7 @@ void main() { await tester.tap(devicesButton); await tester.pump(); expect(find.byType(AdaptiveListTile), findsAny); - await tester.pumpAndSettle(const Duration(seconds: 4)); + await tester.pumpAndSettle(); await tester.pump(); expect(find.byType(AdaptiveListTile), findsAtLeast(2)); diff --git a/lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart b/lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart index eb7e4d8..e28a589 100644 --- a/lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart +++ b/lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart @@ -9,7 +9,6 @@ import 'package:network_tools_flutter/network_tools_flutter.dart'; import 'package:vernet/helper/utils_helper.dart'; import 'package:vernet/injection.dart'; import 'package:vernet/main.dart'; -import 'package:vernet/models/device_in_the_network.dart'; import 'package:vernet/models/isar/device.dart'; import 'package:vernet/models/isar/scan.dart'; import 'package:vernet/repository/notification_service.dart'; @@ -38,7 +37,7 @@ class HostScanBloc extends Bloc { String? subnet; /// List of all ActiveHost devices that got found in the current scan - final List deviceInTheNetworkList = []; + final Set devicesSet = {}; /// mDNS for each ip final Map mDnsDevices = {}; @@ -47,7 +46,7 @@ class HostScanBloc extends Bloc { Initialized event, Emitter emit, ) async { - deviceInTheNetworkList.clear(); + devicesSet.clear(); mDnsDevices.clear(); emit(const HostScanState.loadInProgress()); await initializeWifiParameters(emit); @@ -82,16 +81,16 @@ class HostScanBloc extends Bloc { ) async { emit(const HostScanState.loadInProgress()); - final Set devices = {}; final deviceStream = getIt().startNewScan(subnet!, ip!, gatewayIp!); await for (final Device device in deviceStream) { - devices.add(device); - emit(HostScanState.foundNewDevice(devices)); + devicesSet.add(device); + emit(const HostScanState.loadInProgress()); + emit(HostScanState.foundNewDevice(devicesSet)); } await NotificationService.showNotificationWithActions(); - emit(HostScanState.loadSuccess(devices)); + emit(HostScanState.loadSuccess(devicesSet)); } Future _loadScanAndShowResults( @@ -100,10 +99,10 @@ class HostScanBloc extends Bloc { ) async { emit(const HostScanState.loadInProgress()); - final Set devicesSet = {}; final deviceStream = await getIt().getOnGoingScan(); deviceStream.listen((devices) { devicesSet.addAll(devices); + emit(const HostScanState.loadInProgress()); emit(HostScanState.foundNewDevice(devicesSet)); }); diff --git a/pubspec.lock b/pubspec.lock index a7c280c..fc4a12e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -995,10 +995,10 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" + sha256: "95f9997ca1fb9799d494d0cb2a780fd7be075818d59f00c43832ed112b158a82" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3" shared_preferences_android: dependency: transitive description: @@ -1224,10 +1224,10 @@ packages: dependency: transitive description: name: url_launcher_linux - sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "3.2.1" url_launcher_macos: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2475515..091f4a5 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.9+28 +version: 1.1.0+29 environment: sdk: ">=2.17.0 <3.0.0"