From db208a43353b3a862010e16ecf0c55b521240bdb Mon Sep 17 00:00:00 2001 From: git-elliot Date: Sun, 24 Sep 2023 22:38:52 +0530 Subject: [PATCH 1/2] Use network tools v4.0.1 --- example/lib/main.dart | 5 +- .../Flutter/GeneratedPluginRegistrant.swift | 2 + example/macos/Podfile.lock | 7 ++ .../macos/Runner.xcodeproj/project.pbxproj | 18 ++++ example/pubspec.lock | 96 ++++++++++++++++++- example/pubspec.yaml | 3 +- lib/src/host_scanner_flutter.dart | 9 +- pubspec.yaml | 3 +- test/host_scan_flutter_test.dart | 2 +- test/port_scan_flutter_test.dart | 2 +- 10 files changed, 136 insertions(+), 11 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 5dc8f0f..1d959b0 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,8 +1,11 @@ import 'package:flutter/material.dart'; import 'package:network_tools_flutter/network_tools_flutter.dart'; +import 'package:path_provider/path_provider.dart'; Future main() async { - await configureNetworkTools(enableDebugging: true); + WidgetsFlutterBinding.ensureInitialized(); + final appDocDirectory = await getApplicationDocumentsDirectory(); + await configureNetworkTools(appDocDirectory.path, enableDebugging: true); runApp(const MyApp()); } diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..e777c67 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,8 @@ import FlutterMacOS import Foundation +import path_provider_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) } diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 93410f7..a9883a3 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -1,15 +1,22 @@ PODS: - FlutterMacOS (1.0.0) + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS DEPENDENCIES: - FlutterMacOS (from `Flutter/ephemeral`) + - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) EXTERNAL SOURCES: FlutterMacOS: :path: Flutter/ephemeral + path_provider_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin SPEC CHECKSUMS: FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index 8ad5a00..7de041e 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -240,6 +240,7 @@ 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, + 6FAAE479752EBB508C6EA525 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -381,6 +382,23 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + 6FAAE479752EBB508C6EA525 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; C87B1A810202F6F98C39C119 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/example/pubspec.lock b/example/pubspec.lock index f54ef16..170a25b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -113,6 +113,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + ffi: + dependency: transitive + description: + name: ffi + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" + source: hosted + version: "2.1.0" flutter: dependency: "direct main" description: flutter @@ -247,17 +255,17 @@ packages: dependency: transitive description: name: network_tools - sha256: "872d76529329e43b52a837852f7e4c49b4fdf65be7dedc3ee5722ea135fcad08" + sha256: "84cd355e2d9db58456a05b7ebd4021fcbe42241043b7e6157bff2a0853054dd4" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.1" network_tools_flutter: dependency: "direct main" description: path: ".." relative: true source: path - version: "1.0.4" + version: "1.0.3" path: dependency: transitive description: @@ -266,6 +274,70 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa + url: "https://pub.dev" + source: hosted + version: "2.1.1" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "6b8b19bd80da4f11ce91b2d1fb931f3006911477cec227cce23d3253d80df3f1" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + platform: + dependency: transitive + description: + name: platform + sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + url: "https://pub.dev" + source: hosted + version: "2.1.6" process_run: dependency: transitive description: @@ -391,6 +463,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.1.4-beta" + win32: + dependency: transitive + description: + name: win32 + sha256: c97defd418eef4ec88c0d1652cdce84b9f7b63dd7198e266d06ac1710d527067 + url: "https://pub.dev" + source: hosted + version: "5.0.8" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + url: "https://pub.dev" + source: hosted + version: "1.0.3" yaml: dependency: transitive description: @@ -401,4 +489,4 @@ packages: version: "3.1.2" sdks: dart: ">=3.1.0 <4.0.0" - flutter: ">=2.5.0" + flutter: ">=3.7.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 5593526..73c95aa 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -36,8 +36,9 @@ dependencies: cupertino_icons: ^1.0.2 # Debugging and error logging. logging: ^1.2.0 - network_tools_flutter: + network_tools_flutter: path: ../../network_tools_flutter + path_provider: ^2.1.1 dev_dependencies: flutter_test: diff --git a/lib/src/host_scanner_flutter.dart b/lib/src/host_scanner_flutter.dart index 9dd1050..bc1e124 100644 --- a/lib/src/host_scanner_flutter.dart +++ b/lib/src/host_scanner_flutter.dart @@ -50,7 +50,9 @@ class HostScannerFlutter { i.toString(), limit.toString(), timeoutInSeconds.toString(), - resultsInAddressAscendingOrder.toString() + resultsInAddressAscendingOrder.toString(), + dbDirectory, + enableDebugging.toString() ]); } else if (message is List) { progressCallback @@ -71,7 +73,6 @@ class HostScannerFlutter { /// Will search devices in the network inside new isolate @pragma('vm:entry-point') static Future _startSearchingDevices(SendPort sendPort) async { - configureNetworkTools(); if (Platform.isIOS) { DartPingIOS.register(); } @@ -85,6 +86,10 @@ class HostScannerFlutter { final int lastSubnetIsolate = int.parse(message[2]); final int timeoutInSeconds = int.parse(message[3]); final bool resultsInAddressAscendingOrder = message[4] == "true"; + final String dbDirectory = message[5]; + final bool enableDebugging = message[6] == "true"; + await configureNetworkTools(dbDirectory, + enableDebugging: enableDebugging); /// Will contain all the hosts that got discovered in the network, will /// be use inorder to cancel on dispose of the page. diff --git a/pubspec.yaml b/pubspec.yaml index fbdd9a1..dbba48b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,7 +39,8 @@ dependencies: logging: ^1.2.0 # Deal with internationalized/localized messages and more. intl: ^0.18.0 - network_tools: ^4.0.0 + network_tools: ^4.0.1 + path_provider: ^2.1.1 universal_io: ^2.2.0 dev_dependencies: diff --git a/test/host_scan_flutter_test.dart b/test/host_scan_flutter_test.dart index ede6285..70cc9dc 100644 --- a/test/host_scan_flutter_test.dart +++ b/test/host_scan_flutter_test.dart @@ -14,7 +14,7 @@ void main() { // Fetching interfaceIp and hostIp setUpAll(() async { HttpOverrides.global = FakeResponseHttpOverrides(); - await configureNetworkTools(); + await configureNetworkTools('build'); //open a port in shared way because of portscanner using same, //if passed false then two hosts come up in search and breaks test. server = diff --git a/test/port_scan_flutter_test.dart b/test/port_scan_flutter_test.dart index 4d65bca..fa96030 100644 --- a/test/port_scan_flutter_test.dart +++ b/test/port_scan_flutter_test.dart @@ -13,7 +13,7 @@ void main() { // Fetching interfaceIp and hostIp setUpAll(() async { HttpOverrides.global = FakeResponseHttpOverrides(); - await configureNetworkTools(); + await configureNetworkTools('build'); //open a port in shared way because of hostscanner using same, //if passed false then two hosts come up in search and breaks test. server = From 86a9644bebb253a025e57ee62bbd359b06920546 Mon Sep 17 00:00:00 2001 From: git-elliot Date: Sun, 24 Sep 2023 22:40:13 +0530 Subject: [PATCH 2/2] update version --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9603fa..193ca69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 1.0.4 + +1. Use network_tools v4.0.1 to fix path issue in flutter. + ## 1.0.3 1. Consume latest version of network_tools v4.0.0 diff --git a/pubspec.yaml b/pubspec.yaml index dbba48b..d5c44ba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: network_tools_flutter description: Extended features of network_tools package for flutter framework supporting iOS and Android -version: 1.0.3 +version: 1.0.4 issue_tracker: https://github.com/osociety/network_tools_flutter/issues repository: https://github.com/osociety/network_tools_flutter