Skip to content

Commit

Permalink
Merge pull request #41 from osociety/dev
Browse files Browse the repository at this point in the history
Dev -> Main
  • Loading branch information
git-elliot authored Mar 17, 2024
2 parents a49b31d + 8538631 commit ccc1e72
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## 2.0.1
1. Bug fixes and improvements

## 2.0.0
1. Unified framework for network_tools and network_tools_flutter

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.0.5"
version: "2.0.0"
path:
dependency: transitive
description:
Expand Down
22 changes: 13 additions & 9 deletions lib/src/configure_flutter.dart
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import 'package:logging/logging.dart';
import 'package:network_tools/network_tools.dart' as pacakges_page;
// ignore: implementation_imports
import 'package:network_tools/src/network_tools_utils.dart';
import 'package:network_tools/network_tools.dart' as packages_page;
// ignore: implementation_imports
import 'package:network_tools/src/services/arp_service.dart';
// ignore: implementation_imports
import 'package:network_tools/src/services/impls/arp_service_sembast_impl.dart';
// ignore: implementation_imports
import 'package:network_tools/src/services/impls/mdns_scanner_service_impl.dart';
import 'package:network_tools_flutter/src/network_tools_flutter_util.dart';
import 'package:network_tools_flutter/src/services_impls/host_scanner_service_flutter_impl.dart';
import 'package:network_tools_flutter/src/services_impls/port_scanner_service_flutter_impl.dart';

Future<void> configureNetworkToolsFlutter(
String dbDirectory, {
bool enableDebugging = false,
}) async {
pacakges_page.enableDebugging = enableDebugging;
pacakges_page.dbDirectory = dbDirectory;
packages_page.enableDebugging = enableDebugging;
packages_page.dbDirectory = dbDirectory;

if (pacakges_page.enableDebugging) {
if (packages_page.enableDebugging) {
Logger.root.level = Level.FINE;
Logger.root.onRecord.listen((record) {
if (record.loggerName == log.name) {
if (record.loggerName == logger.name) {
// ignore: avoid_print
print(
'${record.time.toLocal()}: ${record.level.name}: ${record.loggerName}: ${record.message}',
Expand All @@ -28,12 +29,15 @@ Future<void> configureNetworkToolsFlutter(
});
}

/// Setting dart native classes implementations
// Setting dart native classes implementations
ARPServiceSembastImpl();
MdnsScannerServiceImpl();

// Setting flutter classes implementation
HostScannerServiceFlutterImpl();
PortScannerServiceFlutterImpl();

final arpService = await ARPService.instance.open();
await arpService.buildTable();
await pacakges_page.VendorTable.createVendorTableMap();
await packages_page.VendorTable.createVendorTableMap();
}
3 changes: 3 additions & 0 deletions lib/src/network_tools_flutter_util.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'package:logging/logging.dart';

final logger = Logger("network_tools_flutter");
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ class HostScannerServiceFlutterImpl extends HostScannerServiceImpl {
final bool resultsInAddressAscendingOrder = message[4] == "true";
final String dbDirectory = message[5];
final bool enableDebugging = message[6] == "true";
final List<int> hostIds = message[7]
final String joinedIds = message[7];
final List<int> hostIds = joinedIds
.split(',')
.where((e) => e.isNotEmpty)
.map(int.parse)
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: network_tools_flutter
description: Extended features of network_tools package for flutter framework supporting iOS and Android
version: 2.0.0
version: 2.0.1
issue_tracker: https://github.com/osociety/network_tools_flutter/issues
repository: https://github.com/osociety/network_tools_flutter

Expand Down
7 changes: 4 additions & 3 deletions test/host_scan_flutter_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:network_tools_flutter/network_tools_flutter.dart';
import 'package:network_tools_flutter/src/fake_http_overrides.dart';
import 'package:network_tools_flutter/src/network_tools_flutter_util.dart';
import 'package:universal_io/io.dart';

void main() {
Expand Down Expand Up @@ -29,9 +30,9 @@ void main() {
// Better to restrict to scan from hostId - 1 to hostId + 1 to prevent GHA timeouts
firstHostId = hostId <= 1 ? hostId : hostId - 1;
lastHostId = hostId >= 254 ? hostId : hostId + 1;
// log.fine(
// 'Fetched own host as $myOwnHost and interface address as $interfaceIp',
// );
logger.fine(
'Fetched own host as $myOwnHost and interface address as $interfaceIp',
);
}
});

Expand Down

0 comments on commit ccc1e72

Please sign in to comment.