fix: NetworkType null safety issues (#1435)

* fix: Networktype null safety issues

Networktype returns nulls when the connectivity result is vpn resulting to null safety issues.
Implemented a case for when the connectivity result is vpn to resolve this issue.

* chore: update connectivity_plus_platform_interface ^1.2.2

* chore: update network state on Rust side

Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
This commit is contained in:
Onyedika Israel Ukwueze
2022-11-13 04:57:47 +01:00
committed by GitHub
parent dd1dcba599
commit a1e0282df0
4 changed files with 13 additions and 9 deletions

View File

@ -6,15 +6,15 @@ pub enum NetworkType {
Wifi = 1,
Cell = 2,
Ethernet = 3,
Bluetooth = 4,
VPN = 5,
}
impl NetworkType {
pub fn is_connect(&self) -> bool {
match self {
NetworkType::UnknownNetworkType => false,
NetworkType::Wifi => true,
NetworkType::Cell => true,
NetworkType::Ethernet => true,
NetworkType::UnknownNetworkType | NetworkType::Bluetooth => false,
NetworkType::Wifi | NetworkType::Cell | NetworkType::Ethernet | NetworkType::VPN => true,
}
}
}