[mob][photos] Fix connectivityResult check

This commit is contained in:
Neeraj Gupta 2024-04-15 15:09:24 +05:30
parent ab1ac9cf11
commit 5bac629c2b
2 changed files with 8 additions and 5 deletions

View file

@ -134,9 +134,11 @@ abstract class MLFramework {
}
Future<bool> _canDownload() async {
final connectivityResult = await (Connectivity().checkConnectivity());
return connectivityResult != ConnectivityResult.mobile ||
shouldDownloadOverMobileData;
final List<ConnectivityResult> connections =
await (Connectivity().checkConnectivity());
final bool isConnectedToMobile =
connections.contains(ConnectivityResult.mobile);
return !isConnectedToMobile || shouldDownloadOverMobileData;
}
}

View file

@ -355,9 +355,10 @@ class FileUploader {
if (isForceUpload) {
return;
}
final connectivityResult = await (Connectivity().checkConnectivity());
final List<ConnectivityResult> connections =
await (Connectivity().checkConnectivity());
bool canUploadUnderCurrentNetworkConditions = true;
if (connectivityResult == ConnectivityResult.mobile) {
if (connections.any((element) => element == ConnectivityResult.mobile)) {
canUploadUnderCurrentNetworkConditions =
Configuration.instance.shouldBackupOverMobileData();
}