From fa4939d7c62db219577283aed3c8f068f5b54e11 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 7 Jun 2023 00:11:36 -0300 Subject: [PATCH] chore: Implement better Price abstraction for Digital Ocean server provider --- .../cubit/provider_volumes/provider_volume_cubit.dart | 2 +- lib/logic/providers/server_providers/digital_ocean.dart | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index 43bd7005..46137c59 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -27,7 +27,7 @@ class ApiProviderVolumeCubit } Future getPricePerGb() async => - ProvidersController.currentServerProvider!.getPricePerGb(); + (await ProvidersController.currentServerProvider!.getPricePerGb()).data; Future refresh() async { emit(const ApiProviderVolumeState([], LoadingStatus.refreshing, false)); diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index a745434d..67808d6e 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -779,9 +779,12 @@ class DigitalOceanServerProvider extends ServerProvider { /// Hardcoded on their documentation and there is no pricing API at all /// Probably we should scrap the doc page manually @override - Future getPricePerGb() async => Price( - value: 0.10, - currency: 'USD', + Future> getPricePerGb() async => GenericResult( + success: true, + data: Price( + value: 0.10, + currency: 'USD', + ), ); @override