Fix show Your storage is almost full message in Storage section
This commit is contained in:
@@ -16,6 +16,22 @@ class StorageController extends BaseController with SaaSPremiumMixin {
|
|||||||
return isPremiumAvailable(accountId: accountId, session: session);
|
return isPremiumAvailable(accountId: accountId, session: session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool validateUserHasIsAlreadyHighestSubscription() {
|
||||||
|
final accountId = dashBoardController.accountId.value;
|
||||||
|
final session = dashBoardController.sessionCurrent;
|
||||||
|
|
||||||
|
if (accountId == null || session == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isAlreadyHighestSubscription(accountId: accountId, session: session);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get isUpgradeStorageIsDisabled {
|
||||||
|
return !validatePremiumIsAvailable() ||
|
||||||
|
validateUserHasIsAlreadyHighestSubscription();
|
||||||
|
}
|
||||||
|
|
||||||
void onUpgradeStorage() {
|
void onUpgradeStorage() {
|
||||||
dashBoardController.paywallController?.navigateToPaywall();
|
dashBoardController.paywallController?.navigateToPaywall();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,19 +83,16 @@ class StorageView extends GetWidget<StorageController> with AppLoaderMixin {
|
|||||||
quota: octetsQuota,
|
quota: octetsQuota,
|
||||||
isMobile: isMobile,
|
isMobile: isMobile,
|
||||||
),
|
),
|
||||||
Obx(() {
|
UpgradeStorageWidget(
|
||||||
if (controller.validatePremiumIsAvailable() &&
|
imagePaths: controller.imagePaths,
|
||||||
PlatformInfo.isWeb) {
|
isMobile: isMobile,
|
||||||
return UpgradeStorageWidget(
|
isPremiumAvailable: PlatformInfo.isWeb &&
|
||||||
imagePaths: controller.imagePaths,
|
!controller.isUpgradeStorageIsDisabled,
|
||||||
isMobile: isMobile,
|
isQuotaExceeds90Percent:
|
||||||
onUpgradeStorageAction:
|
octetsQuota.allowedDisplayToQuotaBanner,
|
||||||
controller.onUpgradeStorage,
|
onUpgradeStorageAction:
|
||||||
);
|
controller.onUpgradeStorage,
|
||||||
} else {
|
),
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
+39
-31
@@ -9,6 +9,8 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
|||||||
class UpgradeStorageWidget extends StatelessWidget {
|
class UpgradeStorageWidget extends StatelessWidget {
|
||||||
final ImagePaths imagePaths;
|
final ImagePaths imagePaths;
|
||||||
final bool isMobile;
|
final bool isMobile;
|
||||||
|
final bool isPremiumAvailable;
|
||||||
|
final bool isQuotaExceeds90Percent;
|
||||||
final VoidCallback onUpgradeStorageAction;
|
final VoidCallback onUpgradeStorageAction;
|
||||||
|
|
||||||
const UpgradeStorageWidget({
|
const UpgradeStorageWidget({
|
||||||
@@ -16,6 +18,8 @@ class UpgradeStorageWidget extends StatelessWidget {
|
|||||||
required this.imagePaths,
|
required this.imagePaths,
|
||||||
required this.onUpgradeStorageAction,
|
required this.onUpgradeStorageAction,
|
||||||
this.isMobile = false,
|
this.isMobile = false,
|
||||||
|
this.isPremiumAvailable = false,
|
||||||
|
this.isQuotaExceeds90Percent = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -27,40 +31,44 @@ class UpgradeStorageWidget extends StatelessWidget {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
if (isQuotaExceeds90Percent)
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
Row(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
SvgPicture.asset(
|
children: [
|
||||||
imagePaths.icWarning,
|
SvgPicture.asset(
|
||||||
width: 16,
|
imagePaths.icWarning,
|
||||||
height: 16,
|
width: 16,
|
||||||
fit: BoxFit.fill,
|
height: 16,
|
||||||
),
|
fit: BoxFit.fill,
|
||||||
const SizedBox(width: 7),
|
),
|
||||||
Expanded(
|
const SizedBox(width: 7),
|
||||||
child: Text(
|
Expanded(
|
||||||
appLocalizations.storageIsAlmostFullMessage,
|
child: Text(
|
||||||
style: ThemeUtils.textStyleInter600().copyWith(
|
appLocalizations.storageIsAlmostFullMessage,
|
||||||
color: AppColor.m3Neutral40,
|
style: ThemeUtils.textStyleInter600().copyWith(
|
||||||
fontSize: 12,
|
color: AppColor.m3Neutral40,
|
||||||
height: 16 / 12,
|
fontSize: 12,
|
||||||
letterSpacing: 0.4,
|
height: 16 / 12,
|
||||||
|
letterSpacing: 0.4,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
if (isPremiumAvailable)
|
||||||
const SizedBox(height: 16),
|
Container(
|
||||||
Container(
|
constraints: const BoxConstraints(minWidth: 179),
|
||||||
constraints: const BoxConstraints(minWidth: 179),
|
margin: isQuotaExceeds90Percent
|
||||||
height: 48,
|
? const EdgeInsetsDirectional.only(start: 16)
|
||||||
child: ConfirmDialogButton(
|
: null,
|
||||||
label: appLocalizations.upgradeStorage,
|
height: 48,
|
||||||
backgroundColor: AppColor.primaryMain,
|
child: ConfirmDialogButton(
|
||||||
textColor: Colors.white,
|
label: appLocalizations.upgradeStorage,
|
||||||
onTapAction: onUpgradeStorageAction,
|
backgroundColor: AppColor.primaryMain,
|
||||||
|
textColor: Colors.white,
|
||||||
|
onTapAction: onUpgradeStorageAction,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user