Skip to content

Commit

Permalink
try/catch network tools configure
Browse files Browse the repository at this point in the history
  • Loading branch information
zlshames committed Apr 18, 2024
1 parent 5c336bb commit 4587af6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/helpers/network/network_tasks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,18 @@ class NetworkTasks {

if (http.originOverride != null) return;

// This was moved from main.dart to here because this is the only place we use it.
// This will also make an API call to a github file containing a mapping of MAC addresses
// to vendor information. That info is used to display metadata about an ActiveHost found
// on the network via a port scan. We don't want that API call to happen on first-boot, nor
// do we need it to.
await configureNetworkTools(fs.appDocDir.path, enableDebugging: kDebugMode);
try {
// This was moved from main.dart to here because this is the only place we use it.
// This will also make an API call to a github file containing a mapping of MAC addresses
// to vendor information. That info is used to display metadata about an ActiveHost found
// on the network via a port scan. We don't want that API call to happen on first-boot, nor
// do we need it to.
await configureNetworkTools(fs.appDocDir.path, enableDebugging: kDebugMode);
} catch (ex) {
// If this fails, it will likely be due to a failed network request to github.
// It's not a critical failure, so we'll just log it and move on.
Logger.error("Failed to configure network tools (continuing): ${ex.toString()}");
}

Logger.debug("Falling back to port scanning");
final wifiIP = await NetworkInfo().getWifiIP();
Expand Down

0 comments on commit 4587af6

Please sign in to comment.