TF-4045 Only show upgrade storage when premium is available and quota is available

This commit is contained in:
dab246
2025-10-01 17:55:22 +07:00
committed by Dat H. Pham
parent 2cc727c209
commit dcb19992c6
16 changed files with 184 additions and 97 deletions
@@ -1,16 +1,8 @@
import 'package:core/utils/app_logger.dart';
import 'package:collection/collection.dart';
import 'package:jmap_dart_client/jmap/quotas/data_types.dart';
import 'package:jmap_dart_client/jmap/quotas/quota.dart';
extension ListQuotasExtensions on List<Quota> {
Quota? get octetsQuota {
try {
return firstWhere((quota) => quota.resourceType == ResourceType.octets);
} catch(e) {
logError('ListQuotasExtensions::octetsQuota: Not found octets quota');
return null;
}
}
Quota? get octetsQuota =>
firstWhereOrNull((quota) => quota.resourceType == ResourceType.octets);
}
@@ -51,7 +51,7 @@ extension QuotasExtensions on Quota {
bool get isStorageUsageIndicatorAppear {
if (storageAvailable) {
return used!.value <= presentationHardLimit!.value * 0.8;
return used!.value > presentationHardLimit!.value * 0.8;
} else {
return false;
}