plus_plugins
plus_plugins copied to clipboard
[Request]: Return if the connection uses a VPN instead of returning VPN as a result
Plugin
connectivity_plus
Use case
When using the plugin to detect if the user is on mobile data, vs non metered networks currently there is no way to tell if a user is connected when using a VPN. Because only VPN is returned we can't know if it's actually connected to the internet, or if it's a metered connection.
Proposal
I would propose a breaking change. Instead of returning an enum, return an object similar to this:
class ConnectivityResult {
final ConnectivityType type; // An enum with the current enum values except vpn
final bool vpnConnection;
}
This allows actually checking the connectivity type when using a VPN. Currently there is no way to do that, at least on Android. On iOS since the VPN information is not exposed the flag could be false.
@js2702 Hey! Looking at the order of conditions within Connectivity.java#L26, it seems like if the device is on WiFi, it will return immediately, without any information about the VPN.
Does this behavior help?
I understand taking a dependency on this implicit contract is not a good idea, but just thought I'll check.