From c2ae9623224526878c84201f6a5cb6019ecdce90 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 5 Oct 2023 19:42:29 -0300 Subject: [PATCH 1/2] refactor: Remove redundant zone id cache for Cloudflare --- lib/logic/providers/dns_providers/cloudflare.dart | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/logic/providers/dns_providers/cloudflare.dart b/lib/logic/providers/dns_providers/cloudflare.dart index 4a8062f1..6cf4a494 100644 --- a/lib/logic/providers/dns_providers/cloudflare.dart +++ b/lib/logic/providers/dns_providers/cloudflare.dart @@ -69,13 +69,6 @@ class CloudflareDnsProvider extends DnsProvider { ) .toList(); - /// TODO: Remove when domain selection for more than one domain on account is implemented, move cachedZoneId writing to domain saving method - _adapter = ApiAdapter( - isWithToken: true, - cachedDomain: result.data[0].name, - cachedZoneId: result.data[0].id, - ); - return GenericResult( success: true, data: domains, From 87b58ec6d8f4a437146e0136cdb953b6987eb604 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Sat, 7 Oct 2023 18:49:55 -0300 Subject: [PATCH 2/2] feat: Implement confirmation modal for volume resizing - Resolve https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/308 --- assets/translations/en.json | 1 + .../server_storage/extending_volume.dart | 28 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index d6c03a87..95a22f58 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -304,6 +304,7 @@ "extending_volume_description": "Resizing volume will allow you to store more data on your server without extending the server itself. Volume can only be extended: shrinking is not possible.", "extending_volume_price_info": "Price includes VAT and is estimated from pricing data provided by your server provider. Server will be rebooted after resizing.", "extending_volume_error": "Couldn't initialize volume extending.", + "extending_volume_modal_description": "Upgrade to {} for {} plan per month.", "size": "Size", "price": "Price", "data_migration_title": "Data migration", diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index 9c40e9ee..fd8213b1 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -8,6 +8,7 @@ import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; import 'package:selfprivacy/ui/components/info_box/info_box.dart'; +import 'package:selfprivacy/ui/helpers/modals.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; import 'package:selfprivacy/logic/models/disk_status.dart'; @@ -46,7 +47,6 @@ class _ExtendingVolumePageState extends State { late double _currentSliderGbValue; double _pricePerGb = 1.0; - // TODO: Wtfff hardcode?!?!? final DiskSize maxSize = const DiskSize(byte: 500000000000); late DiskSize minSize; @@ -155,14 +155,24 @@ class _ExtendingVolumePageState extends State { onPressed: _isError || isAlreadyResizing ? null : () { - context.read().resizeVolume( - widget.diskVolumeToResize, - DiskSize.fromGibibyte( - _currentSliderGbValue.truncate().toDouble(), - ), - context.read().reload, - ); - context.router.popUntilRoot(); + showPopUpAlert( + alertTitle: 'storage.extending_volume_title'.tr(), + description: + 'storage.extending_volume_modal_description'.tr( + args: [_sizeController.text, _priceController.text], + ), + actionButtonTitle: 'basis.continue'.tr(), + actionButtonOnPressed: () { + context.read().resizeVolume( + widget.diskVolumeToResize, + DiskSize.fromGibibyte( + _currentSliderGbValue.truncate().toDouble(), + ), + context.read().reload, + ); + context.router.popUntilRoot(); + }, + ); }, child: Text('storage.extend_volume_button.title'.tr()), ),