From 4ad43ff1fdd873d44eff42c8a7b1b84be52fbc0d Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 Apr 2024 23:38:24 +0400 Subject: [PATCH] feat(backups): Show how much space a service uses on backup - Resolve: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/434 --- .../pages/backups/create_backups_modal.dart | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/ui/pages/backups/create_backups_modal.dart b/lib/ui/pages/backups/create_backups_modal.dart index f78e1075..eb201f40 100644 --- a/lib/ui/pages/backups/create_backups_modal.dart +++ b/lib/ui/pages/backups/create_backups_modal.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:selfprivacy/logic/bloc/backups/backups_bloc.dart'; import 'package:selfprivacy/logic/bloc/server_jobs/server_jobs_bloc.dart'; +import 'package:selfprivacy/logic/bloc/volumes/volumes_bloc.dart'; import 'package:selfprivacy/logic/models/json/server_job.dart'; import 'package:selfprivacy/logic/models/service.dart'; @@ -103,6 +104,23 @@ class _CreateBackupsModalState extends State { ...widget.services.map( (final Service service) { final bool busy = busyServices.contains(service.id); + String description; + if (busy) { + description = 'backup.service_busy'.tr(); + } else { + description = service.backupDescription; + description += '\n'; + description += 'service_page.uses'.tr( + namedArgs: { + 'usage': service.storageUsage.used.toString(), + 'volume': context + .read() + .state + .getVolume(service.storageUsage.volume ?? '') + .displayName, + }, + ); + } return CheckboxListTile.adaptive( onChanged: !busy ? (final bool? value) { @@ -123,7 +141,7 @@ class _CreateBackupsModalState extends State { service.displayName, ), subtitle: Text( - busy ? 'backup.service_busy'.tr() : service.backupDescription, + description, ), secondary: SvgPicture.string( service.svgIcon,