Merge pull request 'More nicely handle errors in setting up dbus/network manager listeners' (#720) from stable-blockers into trunk
continuous-integration/drone/push Build is pending
Details
continuous-integration/drone/push Build is pending
Details
Reviewed-on: #720 Reviewed-by: Dan Ballard <dan@openprivacy.ca>
This commit is contained in:
commit
b570a127ad
|
@ -50,13 +50,18 @@ class ConnectivityPlusLinuxPlugin extends ConnectivityPlatform {
|
|||
|
||||
Future<void> _startListenConnectivity() async {
|
||||
_client ??= createClient();
|
||||
await _client!.connect();
|
||||
_addConnectivity(_client!);
|
||||
_client!.propertiesChanged.listen((properties) {
|
||||
if (properties.contains('Connectivity')) {
|
||||
_addConnectivity(_client!);
|
||||
}
|
||||
});
|
||||
try {
|
||||
await _client!.connect();
|
||||
_addConnectivity(_client!);
|
||||
_client!.propertiesChanged.listen((properties) {
|
||||
if (properties.contains('Connectivity')) {
|
||||
_addConnectivity(_client!);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
// This will just cause connectivity manager to not have any listenable sources, this should not impact core functionality.
|
||||
print("Dbus or NetworkManager support is unavailable. Cwtch will be unable to efficiently respond to changes in Networking State, however core functionality will be unimpacted.");
|
||||
}
|
||||
}
|
||||
|
||||
void _addConnectivity(NetworkManagerClient client) {
|
||||
|
|
|
@ -296,7 +296,7 @@ class NetworkManagerClient {
|
|||
|
||||
// Big old grody Hack
|
||||
// DBus/nm doesnt seem to offer a way to deter ine if dbus is available on system
|
||||
// worse the first connections get triggered in dbus_client onListen an isn't a catahable exception so crashes the app
|
||||
// worse the first connections get triggered in dbus_client onListen an isn't a catchable exception so crashes the app
|
||||
// this is a hacky way to force an exception on thread if dbus isn't available and bail with out crashing
|
||||
try {
|
||||
await _root.client.getNameOwner(_root.name);
|
||||
|
|
Loading…
Reference in New Issue