Skip to content

Commit

Permalink
localInterface added
Browse files Browse the repository at this point in the history
  • Loading branch information
git-elliot committed Nov 18, 2024
1 parent 85ada08 commit e8a5cc7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class HostScanBloc extends Bloc<HostScanEvent, HostScanState> {
debugPrint('Unimplemented error $e');

Check warning on line 57 in lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart#L57

Added line #L57 was not covered by tests
}
ip = await info.getWifiIP();
final interface = await NetInterface.localInterface();
if (appSettings.customSubnet.isNotEmpty) {
gatewayIp = appSettings.customSubnet;
debugPrint('Taking gatewayIp from appSettings: $gatewayIp');

Check warning on line 63 in lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart#L63

Added line #L63 was not covered by tests
Expand All @@ -65,11 +66,16 @@ class HostScanBloc extends Bloc<HostScanEvent, HostScanState> {
debugPrint(
'Taking gatewayIp from NetworkInfo().getWifiGatewayIP(): $gatewayIp',
);
} else {
} else if (ip != null) {

Check warning on line 69 in lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart#L69

Added line #L69 was not covered by tests
// NetworkInfo().getWifiGatewayIP() is null on android 35, so fail-safe
// to NetworkInfo().getWifiIP()
gatewayIp = ip;
debugPrint('Taking gatewayIp from NetworkInfo().getWifiIP(): $gatewayIp');

Check warning on line 73 in lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart#L73

Added line #L73 was not covered by tests
} else if (interface != null) {
gatewayIp = interface.ipAddress;
debugPrint(
'Taking gatewayIp from NetInterface.localInterface(): $gatewayIp',

Check warning on line 77 in lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/host_scan_page/host_scan_bloc/host_scan_bloc.dart#L75-L77

Added lines #L75 - L77 were not covered by tests
);
}
if (gatewayIp == null) {
emit(const HostScanState.error());
Expand Down

0 comments on commit e8a5cc7

Please sign in to comment.