From 53cf228748466f9fd0b5ca0cdc5eb7d9984dbe92 Mon Sep 17 00:00:00 2001 From: def Date: Fri, 19 May 2023 11:45:22 +0300 Subject: [PATCH 01/15] fix old link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index feb332f2..1e132b91 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ SelfPrivacy — is a platform on your cloud hosting, that allows to deploy your own private services and control them using mobile application. -To use this application, you'll be required to create accounts of different service providers. Please reffer to this manual: https://selfprivacy.org/en/second +To use this application, you'll be required to create accounts of different service providers. Please reffer to this manual: https://selfprivacy.org/docs/getting-started/ Application will do the following things for you: From b41b4159b4d11256afb1b025e3d16a346f1da6b5 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 9 May 2023 03:15:48 -0300 Subject: [PATCH 02/15] feat: Implement infrastructure for new DNS provider deSEC --- assets/images/logos/desec.svg | 89 +++++ lib/config/hive_config.dart | 3 + .../rest_maps/api_factory_creator.dart | 3 + .../rest_maps/dns_providers/desec/desec.dart | 287 ++++++++++++++++ .../dns_providers/desec/desec_factory.dart | 16 + .../server_installation_cubit.dart | 9 + .../server_installation_repository.dart | 4 + lib/logic/get_it/api_config.dart | 10 + lib/logic/models/hive/server_domain.dart | 2 + .../initializing/dns_provider_picker.dart | 307 ++++++++++++++++++ .../setup/initializing/initializing.dart | 60 +--- 11 files changed, 742 insertions(+), 48 deletions(-) create mode 100644 assets/images/logos/desec.svg create mode 100644 lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart create mode 100644 lib/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart create mode 100644 lib/ui/pages/setup/initializing/dns_provider_picker.dart diff --git a/assets/images/logos/desec.svg b/assets/images/logos/desec.svg new file mode 100644 index 00000000..cb54b268 --- /dev/null +++ b/assets/images/logos/desec.svg @@ -0,0 +1,89 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/lib/config/hive_config.dart b/lib/config/hive_config.dart index b6ba018c..44b03f26 100644 --- a/lib/config/hive_config.dart +++ b/lib/config/hive_config.dart @@ -93,6 +93,9 @@ class BNames { /// A String field of [serverInstallationBox] box. static String serverProvider = 'serverProvider'; + /// A String field of [serverInstallationBox] box. + static String dnsProvider = 'dnsProvider'; + /// A String field of [serverLocation] box. static String serverLocation = 'serverLocation'; diff --git a/lib/logic/api_maps/rest_maps/api_factory_creator.dart b/lib/logic/api_maps/rest_maps/api_factory_creator.dart index 25518f3c..c1762429 100644 --- a/lib/logic/api_maps/rest_maps/api_factory_creator.dart +++ b/lib/logic/api_maps/rest_maps/api_factory_creator.dart @@ -1,5 +1,6 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare_factory.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_factory.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_factory.dart'; @@ -30,6 +31,8 @@ class ApiFactoryCreator { final DnsProviderApiFactorySettings settings, ) { switch (settings.provider) { + case DnsProvider.desec: + return DesecApiFactory(); case DnsProvider.cloudflare: return CloudflareApiFactory(); case DnsProvider.unknown: diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart new file mode 100644 index 00000000..1906be55 --- /dev/null +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -0,0 +1,287 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/logic/models/json/dns_records.dart'; + +class DesecApi extends DnsProviderApi { + DesecApi({ + this.hasLogger = false, + this.isWithToken = true, + this.customToken, + }); + @override + final bool hasLogger; + @override + final bool isWithToken; + + final String? customToken; + + @override + RegExp getApiTokenValidation() => + RegExp(r'\s+|[!$%^&*()@+|~=`{}\[\]:<>?,.\/]'); + + @override + BaseOptions get options { + final BaseOptions options = BaseOptions(baseUrl: rootAddress); + if (isWithToken) { + final String? token = getIt().cloudFlareKey; + assert(token != null); + options.headers = {'Authorization': 'Bearer $token'}; + } + + if (customToken != null) { + options.headers = {'Authorization': 'Bearer $customToken'}; + } + + if (validateStatus != null) { + options.validateStatus = validateStatus!; + } + return options; + } + + @override + String rootAddress = 'https://desec.io/api/v1/domains/'; + + @override + Future> isApiTokenValid(final String token) async { + bool isValid = false; + Response? response; + String message = ''; + final Dio client = await getClient(); + try { + response = await client.get( + '', + options: Options( + followRedirects: false, + validateStatus: (final status) => + status != null && (status >= 200 || status == 401), + headers: {'Authorization': 'Token $token'}, + ), + ); + } catch (e) { + print(e); + isValid = false; + message = e.toString(); + } finally { + close(client); + } + + if (response == null) { + return APIGenericResult( + data: isValid, + success: false, + message: message, + ); + } + + if (response.statusCode == HttpStatus.ok) { + isValid = true; + } else if (response.statusCode == HttpStatus.unauthorized) { + isValid = false; + } else { + throw Exception('code: ${response.statusCode}'); + } + + return APIGenericResult( + data: isValid, + success: true, + message: response.statusMessage, + ); + } + + @override + Future getZoneId(final String domain) async => domain; + + @override + Future> removeSimilarRecords({ + required final ServerDomain domain, + final String? ip4, + }) async { + final String domainName = domain.domainName; + final String url = '/$domainName/rrsets/'; + + final Dio client = await getClient(); + try { + final Response response = await client.get(url); + + final List records = response.data['result'] ?? []; + await client.put(url, data: records); + } catch (e) { + print(e); + return APIGenericResult( + success: false, + data: null, + message: e.toString(), + ); + } finally { + close(client); + } + + return APIGenericResult(success: true, data: null); + } + + @override + Future> getDnsRecords({ + required final ServerDomain domain, + }) async { + Response response; + final String domainName = domain.domainName; + final List allRecords = []; + + final String url = '/$domainName/rrsets/'; + + final Dio client = await getClient(); + try { + response = await client.get(url); + final List records = response.data['result'] ?? []; + + for (final record in records) { + allRecords.add( + DnsRecord( + name: record['subname'], + type: record['type'], + content: record['records'], + ttl: record['ttl'], + ), + ); + } + } catch (e) { + print(e); + } finally { + close(client); + } + + return allRecords; + } + + @override + Future> createMultipleDnsRecords({ + required final ServerDomain domain, + final String? ip4, + }) async { + final String domainName = domain.domainName; + final List listDnsRecords = projectDnsRecords(domainName, ip4); + final List allCreateFutures = []; + + final Dio client = await getClient(); + try { + for (final DnsRecord record in listDnsRecords) { + allCreateFutures.add( + client.post( + '/$domainName/rrsets/', + data: record.toJson(), + ), + ); + } + await Future.wait(allCreateFutures); + } on DioError catch (e) { + print(e.message); + rethrow; + } catch (e) { + print(e); + return APIGenericResult( + success: false, + data: null, + message: e.toString(), + ); + } finally { + close(client); + } + + return APIGenericResult(success: true, data: null); + } + + List projectDnsRecords( + final String? domainName, + final String? ip4, + ) { + final DnsRecord domainA = + DnsRecord(type: 'A', name: domainName, content: ip4); + + final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); + final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); + final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); + final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); + final DnsRecord meetA = DnsRecord(type: 'A', name: 'meet', content: ip4); + final DnsRecord passwordA = + DnsRecord(type: 'A', name: 'password', content: ip4); + final DnsRecord socialA = + DnsRecord(type: 'A', name: 'social', content: ip4); + final DnsRecord vpn = DnsRecord(type: 'A', name: 'vpn', content: ip4); + + final DnsRecord txt1 = DnsRecord( + type: 'TXT', + name: '_dmarc', + content: 'v=DMARC1; p=none', + ttl: 18000, + ); + + final DnsRecord txt2 = DnsRecord( + type: 'TXT', + name: domainName, + content: 'v=spf1 a mx ip4:$ip4 -all', + ttl: 18000, + ); + + return [ + domainA, + apiA, + cloudA, + gitA, + meetA, + passwordA, + socialA, + mx, + txt1, + txt2, + vpn + ]; + } + + @override + Future setDnsRecord( + final DnsRecord record, + final ServerDomain domain, + ) async { + final String domainZoneId = domain.zoneId; + final String url = '$rootAddress/zones/$domainZoneId/dns_records'; + + final Dio client = await getClient(); + try { + await client.post( + url, + data: record.toJson(), + ); + } catch (e) { + print(e); + } finally { + close(client); + } + } + + @override + Future> domainList() async { + final String url = '$rootAddress/zones'; + List domains = []; + + final Dio client = await getClient(); + try { + final Response response = await client.get( + url, + queryParameters: {'per_page': 50}, + ); + domains = response.data['result'] + .map((final el) => el['name'] as String) + .toList(); + } catch (e) { + print(e); + } finally { + close(client); + } + + return domains; + } +} diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart new file mode 100644 index 00000000..6c10259b --- /dev/null +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec_factory.dart @@ -0,0 +1,16 @@ +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/desec/desec.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart'; + +class DesecApiFactory extends DnsProviderApiFactory { + @override + DnsProviderApi getDnsProvider({ + final DnsProviderApiSettings settings = const DnsProviderApiSettings(), + }) => + DesecApi( + hasLogger: settings.hasLogger, + isWithToken: settings.isWithToken, + customToken: settings.customToken, + ); +} diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 5638b765..06df6d5a 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -66,6 +66,15 @@ class ServerInstallationCubit extends Cubit { ); } + void setDnsProviderType(final DnsProvider providerType) async { + await repository.saveDnsProviderType(providerType); + ApiController.initDnsProviderApiFactory( + DnsProviderApiFactorySettings( + provider: providerType, + ), + ); + } + ProviderApiTokenValidation serverProviderApiTokenValidation() => ApiController.currentServerProviderApiFactory! .getServerProvider() diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 5d45e7b9..851b2be5 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -706,6 +706,10 @@ class ServerInstallationRepository { getIt().init(); } + Future saveDnsProviderType(final DnsProvider type) async { + await getIt().storeDnsProviderType(type); + } + Future saveBackblazeKey( final BackblazeCredential backblazeCredential, ) async { diff --git a/lib/logic/get_it/api_config.dart b/lib/logic/get_it/api_config.dart index 434c9b32..11d73a85 100644 --- a/lib/logic/get_it/api_config.dart +++ b/lib/logic/get_it/api_config.dart @@ -14,6 +14,8 @@ class ApiConfigModel { String? get serverType => _serverType; String? get cloudFlareKey => _cloudFlareKey; ServerProvider? get serverProvider => _serverProvider; + DnsProvider? get dnsProvider => _dnsProvider; + BackblazeCredential? get backblazeCredential => _backblazeCredential; ServerDomain? get serverDomain => _serverDomain; BackblazeBucket? get backblazeBucket => _backblazeBucket; @@ -23,6 +25,7 @@ class ApiConfigModel { String? _cloudFlareKey; String? _serverType; ServerProvider? _serverProvider; + DnsProvider? _dnsProvider; ServerHostingDetails? _serverDetails; BackblazeCredential? _backblazeCredential; ServerDomain? _serverDomain; @@ -33,6 +36,11 @@ class ApiConfigModel { _serverProvider = value; } + Future storeDnsProviderType(final DnsProvider value) async { + await _box.put(BNames.dnsProvider, value); + _dnsProvider = value; + } + Future storeServerProviderKey(final String value) async { await _box.put(BNames.hetznerKey, value); _serverProviderKey = value; @@ -75,6 +83,7 @@ class ApiConfigModel { void clear() { _serverProviderKey = null; + _dnsProvider = null; _serverLocation = null; _cloudFlareKey = null; _backblazeCredential = null; @@ -95,5 +104,6 @@ class ApiConfigModel { _backblazeBucket = _box.get(BNames.backblazeBucket); _serverType = _box.get(BNames.serverTypeIdentifier); _serverProvider = _box.get(BNames.serverProvider); + _dnsProvider = _box.get(BNames.dnsProvider); } } diff --git a/lib/logic/models/hive/server_domain.dart b/lib/logic/models/hive/server_domain.dart index 9b5d32c1..913fcd42 100644 --- a/lib/logic/models/hive/server_domain.dart +++ b/lib/logic/models/hive/server_domain.dart @@ -29,4 +29,6 @@ enum DnsProvider { unknown, @HiveField(1) cloudflare, + @HiveField(2) + desec } diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart new file mode 100644 index 00000000..cb0d2111 --- /dev/null +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -0,0 +1,307 @@ +import 'package:cubit_form/cubit_form.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:selfprivacy/config/brand_theme.dart'; +import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; +import 'package:selfprivacy/ui/components/brand_md/brand_md.dart'; +import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; +import 'package:selfprivacy/ui/components/buttons/outlined_button.dart'; +import 'package:selfprivacy/ui/components/cards/outlined_card.dart'; +import 'package:selfprivacy/utils/launch_url.dart'; + +class DnsProviderPicker extends StatefulWidget { + const DnsProviderPicker({ + required this.formCubit, + required this.serverInstallationCubit, + super.key, + }); + + final DnsProviderFormCubit formCubit; + final ServerInstallationCubit serverInstallationCubit; + + @override + State createState() => _DnsProviderPickerState(); +} + +class _DnsProviderPickerState extends State { + DnsProvider selectedProvider = DnsProvider.unknown; + + void setProvider(final DnsProvider provider) { + setState(() { + selectedProvider = provider; + }); + } + + @override + Widget build(final BuildContext context) { + switch (selectedProvider) { + case DnsProvider.unknown: + return ProviderSelectionPage( + serverInstallationCubit: widget.serverInstallationCubit, + callback: setProvider, + ); + + case DnsProvider.cloudflare: + return ProviderInputDataPage( + providerCubit: widget.formCubit, + providerInfo: ProviderPageInfo( + providerType: DnsProvider.cloudflare, + pathToHow: 'how_cloudflare', + image: Image.asset( + 'assets/images/logos/cloudflare.png', + width: 150, + ), + ), + ); + + case DnsProvider.desec: + return ProviderInputDataPage( + providerCubit: widget.formCubit, + providerInfo: ProviderPageInfo( + providerType: DnsProvider.desec, + pathToHow: 'how_digital_ocean_dns', + image: Image.asset( + 'assets/images/logos/digital_ocean.png', + width: 150, + ), + ), + ); + } + } +} + +class ProviderPageInfo { + const ProviderPageInfo({ + required this.providerType, + required this.pathToHow, + required this.image, + }); + + final String pathToHow; + final Image image; + final DnsProvider providerType; +} + +class ProviderInputDataPage extends StatelessWidget { + const ProviderInputDataPage({ + required this.providerInfo, + required this.providerCubit, + super.key, + }); + + final ProviderPageInfo providerInfo; + final DnsProviderFormCubit providerCubit; + + @override + Widget build(final BuildContext context) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'initializing.connect_to_dns'.tr(), + style: Theme.of(context).textTheme.headlineSmall, + ), + const SizedBox(height: 16), + Text( + 'initializing.connect_to_server_provider_text'.tr(), + style: Theme.of(context).textTheme.bodyMedium, + ), + const SizedBox(height: 32), + CubitFormTextField( + formFieldCubit: providerCubit.apiKey, + textAlign: TextAlign.center, + scrollPadding: const EdgeInsets.only(bottom: 70), + decoration: const InputDecoration( + hintText: 'Provider API Token', + ), + ), + const SizedBox(height: 32), + BrandButton.rised( + text: 'basis.connect'.tr(), + onPressed: () => providerCubit.trySubmit(), + ), + const SizedBox(height: 10), + BrandOutlinedButton( + child: Text('initializing.how'.tr()), + onPressed: () => showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (final BuildContext context) => Padding( + padding: paddingH15V0, + child: ListView( + padding: const EdgeInsets.symmetric(vertical: 16), + children: [ + BrandMarkdown( + fileName: providerInfo.pathToHow, + ), + ], + ), + ), + ), + ), + ], + ); +} + +class ProviderSelectionPage extends StatelessWidget { + const ProviderSelectionPage({ + required this.callback, + required this.serverInstallationCubit, + super.key, + }); + + final Function callback; + final ServerInstallationCubit serverInstallationCubit; + + @override + Widget build(final BuildContext context) => SizedBox( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'initializing.select_dns'.tr(), + style: Theme.of(context).textTheme.headlineSmall, + ), + const SizedBox(height: 10), + Text( + 'initializing.select_provider'.tr(), + style: Theme.of(context).textTheme.bodyMedium, + ), + const SizedBox(height: 10), + OutlinedCard( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 40, + height: 40, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(40), + color: const Color.fromARGB(255, 241, 215, 166), + ), + child: SvgPicture.asset( + 'assets/images/logos/cloudflare.svg', + ), + ), + const SizedBox(width: 16), + Text( + 'Hetzner Cloud', + style: Theme.of(context).textTheme.titleMedium, + ), + ], + ), + const SizedBox(height: 16), + Text( + 'initializing.select_provider_price_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + Text( + 'initializing.select_provider_price_free'.tr(), + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 16), + Text( + 'initializing.select_provider_payment_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + Text( + 'initializing.select_provider_payment_text_cloudflare' + .tr(), + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 16), + BrandButton.rised( + text: 'basis.select'.tr(), + onPressed: () { + serverInstallationCubit + .setDnsProviderType(DnsProvider.cloudflare); + callback(DnsProvider.cloudflare); + }, + ), + // Outlined button that will open website + BrandOutlinedButton( + onPressed: () => + launchURL('https://dash.cloudflare.com/'), + title: 'initializing.select_provider_site_button'.tr(), + ), + ], + ), + ), + ), + const SizedBox(height: 16), + OutlinedCard( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 40, + height: 40, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(40), + color: const Color.fromARGB(255, 245, 229, 82), + ), + child: SvgPicture.asset( + 'assets/images/logos/desec.svg', + ), + ), + const SizedBox(width: 16), + Text( + 'deSEC', + style: Theme.of(context).textTheme.titleMedium, + ), + ], + ), + const SizedBox(height: 16), + Text( + 'initializing.select_provider_price_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + Text( + 'initializing.select_provider_price_free'.tr(), + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 16), + Text( + 'initializing.select_provider_payment_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + Text( + 'initializing.select_provider_payment_text_do'.tr(), + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 16), + BrandButton.rised( + text: 'basis.select'.tr(), + onPressed: () { + serverInstallationCubit + .setDnsProviderType(DnsProvider.desec); + callback(DnsProvider.desec); + }, + ), + // Outlined button that will open website + BrandOutlinedButton( + onPressed: () => launchURL('https://desec.io/'), + title: 'initializing.select_provider_site_button'.tr(), + ), + ], + ), + ), + ), + ], + ), + ); +} diff --git a/lib/ui/pages/setup/initializing/initializing.dart b/lib/ui/pages/setup/initializing/initializing.dart index 199203c3..749fbdc9 100644 --- a/lib/ui/pages/setup/initializing/initializing.dart +++ b/lib/ui/pages/setup/initializing/initializing.dart @@ -17,6 +17,7 @@ import 'package:selfprivacy/ui/components/drawers/progress_drawer.dart'; import 'package:selfprivacy/ui/components/progress_bar/progress_bar.dart'; import 'package:selfprivacy/ui/components/drawers/support_drawer.dart'; import 'package:selfprivacy/ui/layouts/responsive_layout_with_infobox.dart'; +import 'package:selfprivacy/ui/pages/setup/initializing/dns_provider_picker.dart'; import 'package:selfprivacy/ui/pages/setup/initializing/server_provider_picker.dart'; import 'package:selfprivacy/ui/pages/setup/initializing/server_type_picker.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_routing.dart'; @@ -39,7 +40,7 @@ class InitializingPage extends StatelessWidget { actualInitializingPage = [ () => _stepServerProviderToken(cubit), () => _stepServerType(cubit), - () => _stepCloudflare(cubit), + () => _stepDnsProviderToken(cubit), () => _stepBackblaze(cubit), () => _stepDomain(cubit), () => _stepUser(cubit), @@ -238,56 +239,19 @@ class InitializingPage extends StatelessWidget { ), ); - Widget _stepCloudflare(final ServerInstallationCubit initializingCubit) => + Widget _stepDnsProviderToken( + final ServerInstallationCubit initializingCubit, + ) => BlocProvider( create: (final context) => DnsProviderFormCubit(initializingCubit), child: Builder( - builder: (final context) => ResponsiveLayoutWithInfobox( - topChild: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '${'initializing.connect_to_server_provider'.tr()}Cloudflare', - style: Theme.of(context).textTheme.headlineSmall, - ), - const SizedBox(height: 16), - Text( - 'initializing.manage_domain_dns'.tr(), - style: Theme.of(context).textTheme.bodyMedium, - ), - ], - ), - primaryColumn: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CubitFormTextField( - formFieldCubit: context.read().apiKey, - textAlign: TextAlign.center, - scrollPadding: const EdgeInsets.only(bottom: 70), - decoration: InputDecoration( - hintText: 'initializing.cloudflare_api_token'.tr(), - ), - ), - const SizedBox(height: 32), - BrandButton.filled( - onPressed: () => - context.read().trySubmit(), - text: 'basis.connect'.tr(), - ), - const SizedBox(height: 10), - BrandOutlinedButton( - onPressed: () { - context.read().showArticle( - article: 'how_cloudflare', - context: context, - ); - Scaffold.of(context).openEndDrawer(); - }, - title: 'initializing.how'.tr(), - ), - ], - ), - ), + builder: (final context) { + final providerCubit = context.watch(); + return DnsProviderPicker( + formCubit: providerCubit, + serverInstallationCubit: initializingCubit, + ); + }, ), ); From 01c09aaae431525695d37f358c39eaa15d857e4f Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 12 May 2023 03:07:43 -0300 Subject: [PATCH 03/15] feat: Implement deSEC API support --- .../rest_maps/dns_providers/desec/desec.dart | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index 1906be55..63c7acba 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -172,7 +172,18 @@ class DesecApi extends DnsProviderApi { allCreateFutures.add( client.post( '/$domainName/rrsets/', - data: record.toJson(), + data: record.name == null + ? { + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + } + : { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + }, ), ); } @@ -198,10 +209,9 @@ class DesecApi extends DnsProviderApi { final String? domainName, final String? ip4, ) { - final DnsRecord domainA = - DnsRecord(type: 'A', name: domainName, content: ip4); + final DnsRecord domainA = DnsRecord(type: 'A', name: null, content: ip4); - final DnsRecord mx = DnsRecord(type: 'MX', name: '@', content: domainName); + final DnsRecord mx = DnsRecord(type: 'MX', name: null, content: domainName); final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); @@ -221,7 +231,7 @@ class DesecApi extends DnsProviderApi { final DnsRecord txt2 = DnsRecord( type: 'TXT', - name: domainName, + name: null, content: 'v=spf1 a mx ip4:$ip4 -all', ttl: 18000, ); @@ -246,14 +256,24 @@ class DesecApi extends DnsProviderApi { final DnsRecord record, final ServerDomain domain, ) async { - final String domainZoneId = domain.zoneId; - final String url = '$rootAddress/zones/$domainZoneId/dns_records'; + final String url = '/${domain.domainName}/rrsets/'; final Dio client = await getClient(); try { await client.post( url, - data: record.toJson(), + data: record.name == null + ? { + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + } + : { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + }, ); } catch (e) { print(e); @@ -264,14 +284,12 @@ class DesecApi extends DnsProviderApi { @override Future> domainList() async { - final String url = '$rootAddress/zones'; List domains = []; final Dio client = await getClient(); try { final Response response = await client.get( - url, - queryParameters: {'per_page': 50}, + '', ); domains = response.data['result'] .map((final el) => el['name'] as String) From c67e37a40e1a016b23612ffcec29bddd707396d5 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Fri, 12 May 2023 16:32:19 -0300 Subject: [PATCH 04/15] fix: Adjust graphql schemas to new dns provider - fix runtime bugs --- .../schema/disk_volumes.graphql.dart | 1 + .../graphql_maps/schema/schema.graphql | 3 +- .../graphql_maps/schema/schema.graphql.dart | 6 +- .../graphql_maps/schema/server_api.graphql | 9 + .../schema/server_api.graphql.dart | 546 +++++++++++++++++- .../schema/server_settings.graphql.dart | 2 +- .../graphql_maps/schema/services.graphql.dart | 1 - .../graphql_maps/schema/users.graphql.dart | 2 +- .../graphql_maps/server_api/server_api.dart | 20 + .../dns_providers/cloudflare/cloudflare.dart | 2 +- .../rest_maps/dns_providers/desec/desec.dart | 12 +- .../digital_ocean/digital_ocean.dart | 4 +- .../server_providers/hetzner/hetzner.dart | 6 +- .../server_providers/server_provider.dart | 15 + .../initializing/dns_provider_form_cubit.dart | 4 +- .../server_installation_cubit.dart | 37 +- .../server_installation_repository.dart | 45 +- .../server_installation_state.dart | 40 +- lib/logic/get_it/api_config.dart | 12 +- lib/logic/models/hive/server_domain.dart | 14 +- lib/logic/models/hive/server_domain.g.dart | 5 + ...udflare.dart => recovery_confirm_dns.dart} | 4 +- .../setup/recovering/recovery_routing.dart | 6 +- lib/ui/router/router.gr.dart | 526 ++++++++--------- 24 files changed, 968 insertions(+), 354 deletions(-) rename lib/ui/pages/setup/recovering/{recovery_confirm_cloudflare.dart => recovery_confirm_dns.dart} (96%) diff --git a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart index 22409ef9..9ffbfe0b 100644 --- a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart @@ -3,6 +3,7 @@ import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql b/lib/logic/api_maps/graphql_maps/schema/schema.graphql index ed167742..89bc30c8 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql @@ -75,7 +75,8 @@ type DeviceApiTokenMutationReturn implements MutationReturnInterface { } enum DnsProvider { - CLOUDFLARE + CLOUDFLARE, + DESEC } type DnsRecord { diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart index 1b92ccad..8548e4dd 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart @@ -1096,12 +1096,14 @@ class _CopyWithStubImpl$Input$UserMutationInput _res; } -enum Enum$DnsProvider { CLOUDFLARE, $unknown } +enum Enum$DnsProvider { CLOUDFLARE, DESEC, $unknown } String toJson$Enum$DnsProvider(Enum$DnsProvider e) { switch (e) { case Enum$DnsProvider.CLOUDFLARE: return r'CLOUDFLARE'; + case Enum$DnsProvider.DESEC: + return r'DESEC'; case Enum$DnsProvider.$unknown: return r'$unknown'; } @@ -1111,6 +1113,8 @@ Enum$DnsProvider fromJson$Enum$DnsProvider(String value) { switch (value) { case r'CLOUDFLARE': return Enum$DnsProvider.CLOUDFLARE; + case r'DESEC': + return Enum$DnsProvider.DESEC; default: return Enum$DnsProvider.$unknown; } diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql index d4339094..35df3749 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql @@ -72,6 +72,15 @@ query SystemServerProvider { } } +query SystemDnsProvider { + system { + domainInfo { + provider + } + } +} + + query GetApiTokens { api { devices { diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart index 4bb33228..4eda2c92 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart @@ -1,9 +1,9 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ @@ -6380,6 +6380,550 @@ class _CopyWithStubImpl$Query$SystemServerProvider$system$provider _res; } +class Query$SystemDnsProvider { + Query$SystemDnsProvider({ + required this.system, + required this.$__typename, + }); + + factory Query$SystemDnsProvider.fromJson(Map json) { + final l$system = json['system']; + final l$$__typename = json['__typename']; + return Query$SystemDnsProvider( + system: Query$SystemDnsProvider$system.fromJson( + (l$system as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Query$SystemDnsProvider$system system; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$system = system; + _resultData['system'] = l$system.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$system = system; + final l$$__typename = $__typename; + return Object.hashAll([ + l$system, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Query$SystemDnsProvider) || + runtimeType != other.runtimeType) { + return false; + } + final l$system = system; + final lOther$system = other.system; + if (l$system != lOther$system) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Query$SystemDnsProvider on Query$SystemDnsProvider { + CopyWith$Query$SystemDnsProvider get copyWith => + CopyWith$Query$SystemDnsProvider( + this, + (i) => i, + ); +} + +abstract class CopyWith$Query$SystemDnsProvider { + factory CopyWith$Query$SystemDnsProvider( + Query$SystemDnsProvider instance, + TRes Function(Query$SystemDnsProvider) then, + ) = _CopyWithImpl$Query$SystemDnsProvider; + + factory CopyWith$Query$SystemDnsProvider.stub(TRes res) = + _CopyWithStubImpl$Query$SystemDnsProvider; + + TRes call({ + Query$SystemDnsProvider$system? system, + String? $__typename, + }); + CopyWith$Query$SystemDnsProvider$system get system; +} + +class _CopyWithImpl$Query$SystemDnsProvider + implements CopyWith$Query$SystemDnsProvider { + _CopyWithImpl$Query$SystemDnsProvider( + this._instance, + this._then, + ); + + final Query$SystemDnsProvider _instance; + + final TRes Function(Query$SystemDnsProvider) _then; + + static const _undefined = {}; + + TRes call({ + Object? system = _undefined, + Object? $__typename = _undefined, + }) => + _then(Query$SystemDnsProvider( + system: system == _undefined || system == null + ? _instance.system + : (system as Query$SystemDnsProvider$system), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); + CopyWith$Query$SystemDnsProvider$system get system { + final local$system = _instance.system; + return CopyWith$Query$SystemDnsProvider$system( + local$system, (e) => call(system: e)); + } +} + +class _CopyWithStubImpl$Query$SystemDnsProvider + implements CopyWith$Query$SystemDnsProvider { + _CopyWithStubImpl$Query$SystemDnsProvider(this._res); + + TRes _res; + + call({ + Query$SystemDnsProvider$system? system, + String? $__typename, + }) => + _res; + CopyWith$Query$SystemDnsProvider$system get system => + CopyWith$Query$SystemDnsProvider$system.stub(_res); +} + +const documentNodeQuerySystemDnsProvider = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.query, + name: NameNode(value: 'SystemDnsProvider'), + variableDefinitions: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'system'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'domainInfo'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'provider'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), +]); +Query$SystemDnsProvider _parserFn$Query$SystemDnsProvider( + Map data) => + Query$SystemDnsProvider.fromJson(data); + +class Options$Query$SystemDnsProvider + extends graphql.QueryOptions { + Options$Query$SystemDnsProvider({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Duration? pollInterval, + graphql.Context? context, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + pollInterval: pollInterval, + context: context, + document: documentNodeQuerySystemDnsProvider, + parserFn: _parserFn$Query$SystemDnsProvider, + ); +} + +class WatchOptions$Query$SystemDnsProvider + extends graphql.WatchQueryOptions { + WatchOptions$Query$SystemDnsProvider({ + String? operationName, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult, + context: context, + document: documentNodeQuerySystemDnsProvider, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Query$SystemDnsProvider, + ); +} + +class FetchMoreOptions$Query$SystemDnsProvider + extends graphql.FetchMoreOptions { + FetchMoreOptions$Query$SystemDnsProvider( + {required graphql.UpdateQuery updateQuery}) + : super( + updateQuery: updateQuery, + document: documentNodeQuerySystemDnsProvider, + ); +} + +extension ClientExtension$Query$SystemDnsProvider on graphql.GraphQLClient { + Future> query$SystemDnsProvider( + [Options$Query$SystemDnsProvider? options]) async => + await this.query(options ?? Options$Query$SystemDnsProvider()); + graphql.ObservableQuery watchQuery$SystemDnsProvider( + [WatchOptions$Query$SystemDnsProvider? options]) => + this.watchQuery(options ?? WatchOptions$Query$SystemDnsProvider()); + void writeQuery$SystemDnsProvider({ + required Query$SystemDnsProvider data, + bool broadcast = true, + }) => + this.writeQuery( + graphql.Request( + operation: graphql.Operation( + document: documentNodeQuerySystemDnsProvider)), + data: data.toJson(), + broadcast: broadcast, + ); + Query$SystemDnsProvider? readQuery$SystemDnsProvider( + {bool optimistic = true}) { + final result = this.readQuery( + graphql.Request( + operation: + graphql.Operation(document: documentNodeQuerySystemDnsProvider)), + optimistic: optimistic, + ); + return result == null ? null : Query$SystemDnsProvider.fromJson(result); + } +} + +class Query$SystemDnsProvider$system { + Query$SystemDnsProvider$system({ + required this.domainInfo, + required this.$__typename, + }); + + factory Query$SystemDnsProvider$system.fromJson(Map json) { + final l$domainInfo = json['domainInfo']; + final l$$__typename = json['__typename']; + return Query$SystemDnsProvider$system( + domainInfo: Query$SystemDnsProvider$system$domainInfo.fromJson( + (l$domainInfo as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Query$SystemDnsProvider$system$domainInfo domainInfo; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$domainInfo = domainInfo; + _resultData['domainInfo'] = l$domainInfo.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$domainInfo = domainInfo; + final l$$__typename = $__typename; + return Object.hashAll([ + l$domainInfo, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Query$SystemDnsProvider$system) || + runtimeType != other.runtimeType) { + return false; + } + final l$domainInfo = domainInfo; + final lOther$domainInfo = other.domainInfo; + if (l$domainInfo != lOther$domainInfo) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Query$SystemDnsProvider$system + on Query$SystemDnsProvider$system { + CopyWith$Query$SystemDnsProvider$system + get copyWith => CopyWith$Query$SystemDnsProvider$system( + this, + (i) => i, + ); +} + +abstract class CopyWith$Query$SystemDnsProvider$system { + factory CopyWith$Query$SystemDnsProvider$system( + Query$SystemDnsProvider$system instance, + TRes Function(Query$SystemDnsProvider$system) then, + ) = _CopyWithImpl$Query$SystemDnsProvider$system; + + factory CopyWith$Query$SystemDnsProvider$system.stub(TRes res) = + _CopyWithStubImpl$Query$SystemDnsProvider$system; + + TRes call({ + Query$SystemDnsProvider$system$domainInfo? domainInfo, + String? $__typename, + }); + CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo; +} + +class _CopyWithImpl$Query$SystemDnsProvider$system + implements CopyWith$Query$SystemDnsProvider$system { + _CopyWithImpl$Query$SystemDnsProvider$system( + this._instance, + this._then, + ); + + final Query$SystemDnsProvider$system _instance; + + final TRes Function(Query$SystemDnsProvider$system) _then; + + static const _undefined = {}; + + TRes call({ + Object? domainInfo = _undefined, + Object? $__typename = _undefined, + }) => + _then(Query$SystemDnsProvider$system( + domainInfo: domainInfo == _undefined || domainInfo == null + ? _instance.domainInfo + : (domainInfo as Query$SystemDnsProvider$system$domainInfo), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); + CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo { + final local$domainInfo = _instance.domainInfo; + return CopyWith$Query$SystemDnsProvider$system$domainInfo( + local$domainInfo, (e) => call(domainInfo: e)); + } +} + +class _CopyWithStubImpl$Query$SystemDnsProvider$system + implements CopyWith$Query$SystemDnsProvider$system { + _CopyWithStubImpl$Query$SystemDnsProvider$system(this._res); + + TRes _res; + + call({ + Query$SystemDnsProvider$system$domainInfo? domainInfo, + String? $__typename, + }) => + _res; + CopyWith$Query$SystemDnsProvider$system$domainInfo get domainInfo => + CopyWith$Query$SystemDnsProvider$system$domainInfo.stub(_res); +} + +class Query$SystemDnsProvider$system$domainInfo { + Query$SystemDnsProvider$system$domainInfo({ + required this.provider, + required this.$__typename, + }); + + factory Query$SystemDnsProvider$system$domainInfo.fromJson( + Map json) { + final l$provider = json['provider']; + final l$$__typename = json['__typename']; + return Query$SystemDnsProvider$system$domainInfo( + provider: fromJson$Enum$DnsProvider((l$provider as String)), + $__typename: (l$$__typename as String), + ); + } + + final Enum$DnsProvider provider; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$provider = provider; + _resultData['provider'] = toJson$Enum$DnsProvider(l$provider); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$provider = provider; + final l$$__typename = $__typename; + return Object.hashAll([ + l$provider, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Query$SystemDnsProvider$system$domainInfo) || + runtimeType != other.runtimeType) { + return false; + } + final l$provider = provider; + final lOther$provider = other.provider; + if (l$provider != lOther$provider) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Query$SystemDnsProvider$system$domainInfo + on Query$SystemDnsProvider$system$domainInfo { + CopyWith$Query$SystemDnsProvider$system$domainInfo< + Query$SystemDnsProvider$system$domainInfo> + get copyWith => CopyWith$Query$SystemDnsProvider$system$domainInfo( + this, + (i) => i, + ); +} + +abstract class CopyWith$Query$SystemDnsProvider$system$domainInfo { + factory CopyWith$Query$SystemDnsProvider$system$domainInfo( + Query$SystemDnsProvider$system$domainInfo instance, + TRes Function(Query$SystemDnsProvider$system$domainInfo) then, + ) = _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo; + + factory CopyWith$Query$SystemDnsProvider$system$domainInfo.stub(TRes res) = + _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo; + + TRes call({ + Enum$DnsProvider? provider, + String? $__typename, + }); +} + +class _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo + implements CopyWith$Query$SystemDnsProvider$system$domainInfo { + _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo( + this._instance, + this._then, + ); + + final Query$SystemDnsProvider$system$domainInfo _instance; + + final TRes Function(Query$SystemDnsProvider$system$domainInfo) _then; + + static const _undefined = {}; + + TRes call({ + Object? provider = _undefined, + Object? $__typename = _undefined, + }) => + _then(Query$SystemDnsProvider$system$domainInfo( + provider: provider == _undefined || provider == null + ? _instance.provider + : (provider as Enum$DnsProvider), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo + implements CopyWith$Query$SystemDnsProvider$system$domainInfo { + _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo(this._res); + + TRes _res; + + call({ + Enum$DnsProvider? provider, + String? $__typename, + }) => + _res; +} + class Query$GetApiTokens { Query$GetApiTokens({ required this.api, diff --git a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart index 14996423..8da4e347 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart @@ -1,8 +1,8 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'schema.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ diff --git a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart index dfea309c..1501d709 100644 --- a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:selfprivacy/utils/scalars.dart'; diff --git a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart index c2d0027f..dbc8eccc 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -1,8 +1,8 @@ import 'dart:async'; -import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'schema.graphql.dart'; +import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ diff --git a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart index bb703103..51da63ac 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/server_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/server_api.dart @@ -11,6 +11,7 @@ import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/users.graphql.dar import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_bucket.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; +import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/json/api_token.dart'; import 'package:selfprivacy/logic/models/json/backup.dart'; @@ -87,6 +88,25 @@ class ServerApi extends ApiMap return providerType; } + Future getDnsProviderType() async { + QueryResult response; + DnsProvider providerType = DnsProvider.unknown; + + try { + final GraphQLClient client = await getClient(); + response = await client.query$SystemDnsProvider(); + if (response.hasException) { + print(response.exception.toString()); + } + providerType = DnsProvider.fromGraphQL( + response.parsedData!.system.domainInfo.provider, + ); + } catch (e) { + print(e); + } + return providerType; + } + Future isUsingBinds() async { QueryResult response; bool usesBinds = false; diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart index 14cf5c96..04ff622b 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart @@ -27,7 +27,7 @@ class CloudflareApi extends DnsProviderApi { BaseOptions get options { final BaseOptions options = BaseOptions(baseUrl: rootAddress); if (isWithToken) { - final String? token = getIt().cloudFlareKey; + final String? token = getIt().dnsProviderKey; assert(token != null); options.headers = {'Authorization': 'Bearer $token'}; } diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index 63c7acba..4e55bbfa 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -27,13 +27,13 @@ class DesecApi extends DnsProviderApi { BaseOptions get options { final BaseOptions options = BaseOptions(baseUrl: rootAddress); if (isWithToken) { - final String? token = getIt().cloudFlareKey; + final String? token = getIt().dnsProviderKey; assert(token != null); - options.headers = {'Authorization': 'Bearer $token'}; + options.headers = {'Authorization': 'Token $token'}; } if (customToken != null) { - options.headers = {'Authorization': 'Bearer $customToken'}; + options.headers = {'Authorization': 'Token $customToken'}; } if (validateStatus != null) { @@ -107,7 +107,7 @@ class DesecApi extends DnsProviderApi { try { final Response response = await client.get(url); - final List records = response.data['result'] ?? []; + final List records = response.data; await client.put(url, data: records); } catch (e) { print(e); @@ -136,7 +136,7 @@ class DesecApi extends DnsProviderApi { final Dio client = await getClient(); try { response = await client.get(url); - final List records = response.data['result'] ?? []; + final List records = response.data; for (final record in records) { allRecords.add( @@ -291,7 +291,7 @@ class DesecApi extends DnsProviderApi { final Response response = await client.get( '', ); - domains = response.data['result'] + domains = response.data .map((final el) => el['name'] as String) .toList(); } catch (e) { diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart index b2f4c624..21861dd8 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean.dart @@ -332,6 +332,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { required final User rootUser, required final String domainName, required final String serverType, + required final DnsProvider dnsProvider, }) async { ServerHostingDetails? serverDetails; @@ -344,9 +345,10 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi { final String formattedHostname = getHostnameFromDomain(domainName); const String infectBranch = 'providers/digital-ocean'; final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; + final String dnsProviderType = dnsProviderToInfectName(dnsProvider); final String userdataString = - "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | PROVIDER=$infectProviderName STAGING_ACME='$stagingAcme' DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$formattedHostname bash 2>&1 | tee /tmp/infect.log"; + "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | DNS_PROVIDER_TYPE=$dnsProviderType PROVIDER=$infectProviderName STAGING_ACME='$stagingAcme' DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$formattedHostname bash 2>&1 | tee /tmp/infect.log"; print(userdataString); Response? serverCreateResponse; diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart index 7f51c768..c2228030 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart @@ -356,6 +356,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { required final User rootUser, required final String domainName, required final String serverType, + required final DnsProvider dnsProvider, }) async { final APIGenericResult newVolumeResponse = await createVolume(); @@ -374,6 +375,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { domainName: domainName, volume: newVolumeResponse.data!, serverType: serverType, + dnsProvider: dnsProvider, ); } @@ -383,6 +385,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { required final String domainName, required final ServerVolume volume, required final String serverType, + required final DnsProvider dnsProvider, }) async { final Dio client = await getClient(); @@ -395,9 +398,10 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; final String base64Password = base64.encode(utf8.encode(rootUser.password ?? 'PASS')); + final String dnsProviderType = dnsProviderToInfectName(dnsProvider); final String userdataString = - "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$hostname bash 2>&1 | tee /tmp/infect.log"; + "#cloud-config\nruncmd:\n- curl https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/raw/branch/$infectBranch/nixos-infect | DNS_PROVIDER_TYPE=$dnsProviderType STAGING_ACME='$stagingAcme' PROVIDER=$infectProviderName NIX_CHANNEL=nixos-21.05 DOMAIN='$domainName' LUSER='${rootUser.login}' ENCODED_PASSWORD='$base64Password' CF_TOKEN=$dnsApiToken DB_PASSWORD=$dbPassword API_TOKEN=$apiToken HOSTNAME=$hostname bash 2>&1 | tee /tmp/infect.log"; Response? serverCreateResponse; ServerHostingDetails? serverDetails; diff --git a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart index c858d67b..ae7911d0 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/server_provider.dart @@ -39,6 +39,7 @@ abstract class ServerProviderApi extends ApiMap { required final User rootUser, required final String domainName, required final String serverType, + required final DnsProvider dnsProvider, }); Future> createReverseDns({ required final ServerHostingDetails serverDetails, @@ -54,6 +55,20 @@ abstract class ServerProviderApi extends ApiMap { final DateTime end, ); + String dnsProviderToInfectName(final DnsProvider dnsProvider) { + String dnsProviderType; + switch (dnsProvider) { + case DnsProvider.desec: + dnsProviderType = 'DESEC'; + break; + case DnsProvider.cloudflare: + default: + dnsProviderType = 'CLOUDFLARE'; + break; + } + return dnsProviderType; + } + /// Provider name key which lets infect understand what kind of installation /// it requires, for example 'digitaloceal' for Digital Ocean String get infectProviderName; diff --git a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart index 553c3492..edb97de6 100644 --- a/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; -import 'package:selfprivacy/logic/cubit/forms/validations/validations.dart'; class DnsProviderFormCubit extends FormCubit { DnsProviderFormCubit(this.initializingCubit) { @@ -11,7 +10,6 @@ class DnsProviderFormCubit extends FormCubit { initalValue: '', validations: [ RequiredStringValidation('validations.required'.tr()), - LengthStringNotEqualValidation(40) ], ); @@ -20,7 +18,7 @@ class DnsProviderFormCubit extends FormCubit { @override FutureOr onSubmit() async { - initializingCubit.setCloudflareKey(apiKey.state.value); + initializingCubit.setDnsApiToken(apiKey.state.value); } final ServerInstallationCubit initializingCubit; diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index 06df6d5a..cc5bffcc 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -110,16 +110,6 @@ class ServerInstallationCubit extends Cubit { Future isDnsProviderApiTokenValid( final String providerToken, ) async { - if (ApiController.currentDnsProviderApiFactory == null) { - // No other DNS provider is supported for now, - // so it's safe to hardcode Cloudflare - ApiController.initDnsProviderApiFactory( - DnsProviderApiFactorySettings( - provider: DnsProvider.cloudflare, - ), - ); - } - final APIGenericResult apiResponse = await ApiController.currentDnsProviderApiFactory! .getDnsProvider( @@ -223,16 +213,16 @@ class ServerInstallationCubit extends Cubit { ); } - void setCloudflareKey(final String cloudFlareKey) async { + void setDnsApiToken(final String dnsApiToken) async { if (state is ServerInstallationRecovery) { - setAndValidateCloudflareToken(cloudFlareKey); + setAndValidateDnsApiToken(dnsApiToken); return; } - await repository.saveCloudFlareKey(cloudFlareKey); + await repository.saveDnsProviderKey(dnsApiToken); emit( (state as ServerInstallationNotFinished) - .copyWith(cloudFlareKey: cloudFlareKey), + .copyWith(dnsApiToken: dnsApiToken), ); } @@ -293,7 +283,7 @@ class ServerInstallationCubit extends Cubit { await repository.createServer( state.rootUser!, state.serverDomain!.domainName, - state.cloudFlareKey!, + state.dnsApiToken!, state.backblazeCredential!, onCancel: onCancel, onSuccess: onSuccess, @@ -595,7 +585,7 @@ class ServerInstallationCubit extends Cubit { ), ); break; - case RecoveryStep.cloudflareToken: + case RecoveryStep.dnsProviderToken: repository.deleteServerDetails(); emit( dataState.copyWith( @@ -691,12 +681,12 @@ class ServerInstallationCubit extends Cubit { emit( dataState.copyWith( serverDetails: serverDetails, - currentStep: RecoveryStep.cloudflareToken, + currentStep: RecoveryStep.dnsProviderToken, ), ); } - Future setAndValidateCloudflareToken(final String token) async { + Future setAndValidateDnsApiToken(final String token) async { final ServerInstallationRecovery dataState = state as ServerInstallationRecovery; final ServerDomain? serverDomain = dataState.serverDomain; @@ -714,10 +704,13 @@ class ServerInstallationCubit extends Cubit { ServerDomain( domainName: serverDomain.domainName, zoneId: zoneId, - provider: DnsProvider.cloudflare, + provider: await ServerApi( + customToken: token, + isWithToken: true, + ).getDnsProviderType(), ), ); - await repository.saveCloudFlareKey(token); + await repository.saveDnsProviderKey(token); emit( dataState.copyWith( serverDomain: ServerDomain( @@ -725,7 +718,7 @@ class ServerInstallationCubit extends Cubit { zoneId: zoneId, provider: DnsProvider.cloudflare, ), - cloudFlareKey: token, + dnsApiToken: token, currentStep: RecoveryStep.backblazeToken, ), ); @@ -776,7 +769,7 @@ class ServerInstallationCubit extends Cubit { ServerInstallationNotFinished( providerApiToken: state.providerApiToken, serverDomain: state.serverDomain, - cloudFlareKey: state.cloudFlareKey, + dnsApiToken: state.dnsApiToken, backblazeCredential: state.backblazeCredential, rootUser: state.rootUser, serverDetails: null, diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 851b2be5..ff167518 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -45,7 +45,7 @@ class ServerInstallationRepository { Future load() async { final String? providerApiToken = getIt().serverProviderKey; final String? location = getIt().serverLocation; - final String? cloudflareToken = getIt().cloudFlareKey; + final String? dnsApiToken = getIt().dnsProviderKey; final String? serverTypeIdentificator = getIt().serverType; final ServerDomain? serverDomain = getIt().serverDomain; final ServerProvider? serverProvider = @@ -54,6 +54,7 @@ class ServerInstallationRepository { getIt().backblazeCredential; final ServerHostingDetails? serverDetails = getIt().serverDetails; + final DnsProvider? dnsProvider = getIt().dnsProvider; if (serverProvider != null || (serverDetails != null && @@ -75,18 +76,21 @@ class ServerInstallationRepository { ); } - // No other DNS provider is supported for now, so it's fine. - ApiController.initDnsProviderApiFactory( - DnsProviderApiFactorySettings( - provider: DnsProvider.cloudflare, - ), - ); + if (dnsProvider != null || + (serverDomain != null && + serverDomain.provider != DnsProvider.unknown)) { + ApiController.initDnsProviderApiFactory( + DnsProviderApiFactorySettings( + provider: dnsProvider ?? serverDomain!.provider, + ), + ); + } if (box.get(BNames.hasFinalChecked, defaultValue: false)) { return ServerInstallationFinished( providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', - cloudFlareKey: cloudflareToken!, + dnsApiToken: dnsApiToken!, serverDomain: serverDomain!, backblazeCredential: backblazeCredential!, serverDetails: serverDetails!, @@ -103,14 +107,14 @@ class ServerInstallationRepository { serverDomain != null) { return ServerInstallationRecovery( providerApiToken: providerApiToken, - cloudFlareKey: cloudflareToken, + dnsApiToken: dnsApiToken, serverDomain: serverDomain, backblazeCredential: backblazeCredential, serverDetails: serverDetails, rootUser: box.get(BNames.rootUser), currentStep: _getCurrentRecoveryStep( providerApiToken, - cloudflareToken, + dnsApiToken, serverDomain, serverDetails, ), @@ -120,7 +124,7 @@ class ServerInstallationRepository { return ServerInstallationNotFinished( providerApiToken: providerApiToken, - cloudFlareKey: cloudflareToken, + dnsApiToken: dnsApiToken, serverDomain: serverDomain, backblazeCredential: backblazeCredential, serverDetails: serverDetails, @@ -147,7 +151,7 @@ class ServerInstallationRepository { if (serverDomain.provider != DnsProvider.unknown) { return RecoveryStep.backblazeToken; } - return RecoveryStep.cloudflareToken; + return RecoveryStep.dnsProviderToken; } return RecoveryStep.serverSelection; } @@ -238,7 +242,7 @@ class ServerInstallationRepository { Future createServer( final User rootUser, final String domainName, - final String cloudFlareKey, + final String dnsApiToken, final BackblazeCredential backblazeCredential, { required final void Function() onCancel, required final Future Function(ServerHostingDetails serverDetails) @@ -256,7 +260,8 @@ class ServerInstallationRepository { ServerHostingDetails? serverDetails; try { final APIGenericResult createResult = await api.createServer( - dnsApiToken: cloudFlareKey, + dnsProvider: getIt().dnsProvider!, + dnsApiToken: dnsApiToken, rootUser: rootUser, domainName: domainName, serverType: getIt().serverType!, @@ -280,7 +285,8 @@ class ServerInstallationRepository { try { final APIGenericResult createServerResult = await api.createServer( - dnsApiToken: cloudFlareKey, + dnsProvider: getIt().dnsProvider!, + dnsApiToken: dnsApiToken, rootUser: rootUser, domainName: domainName, serverType: getIt().serverType!, @@ -304,7 +310,8 @@ class ServerInstallationRepository { ServerHostingDetails? serverDetails; try { final APIGenericResult createResult = await api.createServer( - dnsApiToken: cloudFlareKey, + dnsProvider: getIt().dnsProvider!, + dnsApiToken: dnsApiToken, rootUser: rootUser, domainName: domainName, serverType: getIt().serverType!, @@ -721,11 +728,11 @@ class ServerInstallationRepository { getIt().init(); } - Future saveCloudFlareKey(final String key) async { - await getIt().storeCloudFlareKey(key); + Future saveDnsProviderKey(final String key) async { + await getIt().storeDnsProviderKey(key); } - Future deleteCloudFlareKey() async { + Future deleteDnsProviderKey() async { await box.delete(BNames.cloudFlareKey); getIt().init(); } diff --git a/lib/logic/cubit/server_installation/server_installation_state.dart b/lib/logic/cubit/server_installation/server_installation_state.dart index 331c3e2a..5ceaafdd 100644 --- a/lib/logic/cubit/server_installation/server_installation_state.dart +++ b/lib/logic/cubit/server_installation/server_installation_state.dart @@ -4,7 +4,7 @@ abstract class ServerInstallationState extends Equatable { const ServerInstallationState({ required this.providerApiToken, required this.serverTypeIdentificator, - required this.cloudFlareKey, + required this.dnsApiToken, required this.backblazeCredential, required this.serverDomain, required this.rootUser, @@ -18,7 +18,7 @@ abstract class ServerInstallationState extends Equatable { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -28,7 +28,7 @@ abstract class ServerInstallationState extends Equatable { ]; final String? providerApiToken; - final String? cloudFlareKey; + final String? dnsApiToken; final String? serverTypeIdentificator; final BackblazeCredential? backblazeCredential; final ServerDomain? serverDomain; @@ -40,7 +40,7 @@ abstract class ServerInstallationState extends Equatable { bool get isServerProviderApiKeyFilled => providerApiToken != null; bool get isServerTypeFilled => serverTypeIdentificator != null; - bool get isDnsProviderFilled => cloudFlareKey != null; + bool get isDnsProviderFilled => dnsApiToken != null; bool get isBackupsProviderFilled => backblazeCredential != null; bool get isDomainSelected => serverDomain != null; bool get isPrimaryUserFilled => rootUser != null; @@ -87,7 +87,7 @@ class TimerState extends ServerInstallationNotFinished { }) : super( providerApiToken: dataState.providerApiToken, serverTypeIdentificator: dataState.serverTypeIdentificator, - cloudFlareKey: dataState.cloudFlareKey, + dnsApiToken: dataState.dnsApiToken, backblazeCredential: dataState.backblazeCredential, serverDomain: dataState.serverDomain, rootUser: dataState.rootUser, @@ -114,7 +114,7 @@ enum ServerSetupProgress { nothingYet, serverProviderFilled, servertTypeFilled, - cloudFlareFilled, + dnsProviderFilled, backblazeFilled, domainFilled, userFilled, @@ -133,7 +133,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { required this.dnsMatches, super.providerApiToken, super.serverTypeIdentificator, - super.cloudFlareKey, + super.dnsApiToken, super.backblazeCredential, super.serverDomain, super.rootUser, @@ -146,7 +146,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -160,7 +160,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { ServerInstallationNotFinished copyWith({ final String? providerApiToken, final String? serverTypeIdentificator, - final String? cloudFlareKey, + final String? dnsApiToken, final BackblazeCredential? backblazeCredential, final ServerDomain? serverDomain, final User? rootUser, @@ -175,7 +175,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { providerApiToken: providerApiToken ?? this.providerApiToken, serverTypeIdentificator: serverTypeIdentificator ?? this.serverTypeIdentificator, - cloudFlareKey: cloudFlareKey ?? this.cloudFlareKey, + dnsApiToken: dnsApiToken ?? this.dnsApiToken, backblazeCredential: backblazeCredential ?? this.backblazeCredential, serverDomain: serverDomain ?? this.serverDomain, rootUser: rootUser ?? this.rootUser, @@ -192,7 +192,7 @@ class ServerInstallationNotFinished extends ServerInstallationState { ServerInstallationFinished finish() => ServerInstallationFinished( providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', - cloudFlareKey: cloudFlareKey!, + dnsApiToken: dnsApiToken!, backblazeCredential: backblazeCredential!, serverDomain: serverDomain!, rootUser: rootUser!, @@ -208,7 +208,7 @@ class ServerInstallationEmpty extends ServerInstallationNotFinished { : super( providerApiToken: null, serverTypeIdentificator: null, - cloudFlareKey: null, + dnsApiToken: null, backblazeCredential: null, serverDomain: null, rootUser: null, @@ -225,7 +225,7 @@ class ServerInstallationFinished extends ServerInstallationState { const ServerInstallationFinished({ required String super.providerApiToken, required String super.serverTypeIdentificator, - required String super.cloudFlareKey, + required String super.dnsApiToken, required BackblazeCredential super.backblazeCredential, required ServerDomain super.serverDomain, required User super.rootUser, @@ -239,7 +239,7 @@ class ServerInstallationFinished extends ServerInstallationState { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -256,7 +256,7 @@ enum RecoveryStep { oldToken, serverProviderToken, serverSelection, - cloudflareToken, + dnsProviderToken, backblazeToken, } @@ -278,7 +278,7 @@ class ServerInstallationRecovery extends ServerInstallationState { required this.recoveryCapabilities, super.providerApiToken, super.serverTypeIdentificator, - super.cloudFlareKey, + super.dnsApiToken, super.backblazeCredential, super.serverDomain, super.rootUser, @@ -295,7 +295,7 @@ class ServerInstallationRecovery extends ServerInstallationState { List get props => [ providerApiToken, serverTypeIdentificator, - cloudFlareKey, + dnsApiToken, backblazeCredential, serverDomain, rootUser, @@ -308,7 +308,7 @@ class ServerInstallationRecovery extends ServerInstallationState { ServerInstallationRecovery copyWith({ final String? providerApiToken, final String? serverTypeIdentificator, - final String? cloudFlareKey, + final String? dnsApiToken, final BackblazeCredential? backblazeCredential, final ServerDomain? serverDomain, final User? rootUser, @@ -320,7 +320,7 @@ class ServerInstallationRecovery extends ServerInstallationState { providerApiToken: providerApiToken ?? this.providerApiToken, serverTypeIdentificator: serverTypeIdentificator ?? this.serverTypeIdentificator, - cloudFlareKey: cloudFlareKey ?? this.cloudFlareKey, + dnsApiToken: dnsApiToken ?? this.dnsApiToken, backblazeCredential: backblazeCredential ?? this.backblazeCredential, serverDomain: serverDomain ?? this.serverDomain, rootUser: rootUser ?? this.rootUser, @@ -332,7 +332,7 @@ class ServerInstallationRecovery extends ServerInstallationState { ServerInstallationFinished finish() => ServerInstallationFinished( providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', - cloudFlareKey: cloudFlareKey!, + dnsApiToken: dnsApiToken!, backblazeCredential: backblazeCredential!, serverDomain: serverDomain!, rootUser: rootUser!, diff --git a/lib/logic/get_it/api_config.dart b/lib/logic/get_it/api_config.dart index 11d73a85..ba49b9b3 100644 --- a/lib/logic/get_it/api_config.dart +++ b/lib/logic/get_it/api_config.dart @@ -12,7 +12,7 @@ class ApiConfigModel { String? get serverProviderKey => _serverProviderKey; String? get serverLocation => _serverLocation; String? get serverType => _serverType; - String? get cloudFlareKey => _cloudFlareKey; + String? get dnsProviderKey => _dnsProviderKey; ServerProvider? get serverProvider => _serverProvider; DnsProvider? get dnsProvider => _dnsProvider; @@ -22,7 +22,7 @@ class ApiConfigModel { String? _serverProviderKey; String? _serverLocation; - String? _cloudFlareKey; + String? _dnsProviderKey; String? _serverType; ServerProvider? _serverProvider; DnsProvider? _dnsProvider; @@ -46,9 +46,9 @@ class ApiConfigModel { _serverProviderKey = value; } - Future storeCloudFlareKey(final String value) async { + Future storeDnsProviderKey(final String value) async { await _box.put(BNames.cloudFlareKey, value); - _cloudFlareKey = value; + _dnsProviderKey = value; } Future storeServerTypeIdentifier(final String typeIdentifier) async { @@ -85,7 +85,7 @@ class ApiConfigModel { _serverProviderKey = null; _dnsProvider = null; _serverLocation = null; - _cloudFlareKey = null; + _dnsProviderKey = null; _backblazeCredential = null; _serverDomain = null; _serverDetails = null; @@ -97,7 +97,7 @@ class ApiConfigModel { void init() { _serverProviderKey = _box.get(BNames.hetznerKey); _serverLocation = _box.get(BNames.serverLocation); - _cloudFlareKey = _box.get(BNames.cloudFlareKey); + _dnsProviderKey = _box.get(BNames.cloudFlareKey); _backblazeCredential = _box.get(BNames.backblazeCredential); _serverDomain = _box.get(BNames.serverDomain); _serverDetails = _box.get(BNames.serverDetails); diff --git a/lib/logic/models/hive/server_domain.dart b/lib/logic/models/hive/server_domain.dart index 913fcd42..de3ef92a 100644 --- a/lib/logic/models/hive/server_domain.dart +++ b/lib/logic/models/hive/server_domain.dart @@ -1,4 +1,5 @@ import 'package:hive/hive.dart'; +import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/schema.graphql.dart'; part 'server_domain.g.dart'; @@ -30,5 +31,16 @@ enum DnsProvider { @HiveField(1) cloudflare, @HiveField(2) - desec + desec; + + factory DnsProvider.fromGraphQL(final Enum$DnsProvider provider) { + switch (provider) { + case Enum$DnsProvider.CLOUDFLARE: + return cloudflare; + case Enum$DnsProvider.DESEC: + return desec; + default: + return unknown; + } + } } diff --git a/lib/logic/models/hive/server_domain.g.dart b/lib/logic/models/hive/server_domain.g.dart index 3265db6b..6770d9bc 100644 --- a/lib/logic/models/hive/server_domain.g.dart +++ b/lib/logic/models/hive/server_domain.g.dart @@ -58,6 +58,8 @@ class DnsProviderAdapter extends TypeAdapter { return DnsProvider.unknown; case 1: return DnsProvider.cloudflare; + case 2: + return DnsProvider.desec; default: return DnsProvider.unknown; } @@ -72,6 +74,9 @@ class DnsProviderAdapter extends TypeAdapter { case DnsProvider.cloudflare: writer.writeByte(1); break; + case DnsProvider.desec: + writer.writeByte(2); + break; } } diff --git a/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart b/lib/ui/pages/setup/recovering/recovery_confirm_dns.dart similarity index 96% rename from lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart rename to lib/ui/pages/setup/recovering/recovery_confirm_dns.dart index 93c889a5..9dcad056 100644 --- a/lib/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart +++ b/lib/ui/pages/setup/recovering/recovery_confirm_dns.dart @@ -7,8 +7,8 @@ import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; -class RecoveryConfirmCloudflare extends StatelessWidget { - const RecoveryConfirmCloudflare({super.key}); +class RecoveryConfirmDns extends StatelessWidget { + const RecoveryConfirmDns({super.key}); @override Widget build(final BuildContext context) { diff --git a/lib/ui/pages/setup/recovering/recovery_routing.dart b/lib/ui/pages/setup/recovering/recovery_routing.dart index 14c3f9a7..be5eb2ea 100644 --- a/lib/ui/pages/setup/recovering/recovery_routing.dart +++ b/lib/ui/pages/setup/recovering/recovery_routing.dart @@ -12,7 +12,7 @@ import 'package:selfprivacy/ui/pages/setup/recovering/recover_by_old_token.dart' import 'package:selfprivacy/ui/pages/setup/recovering/recover_by_recovery_key.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recover_by_new_device_key.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_confirm_backblaze.dart'; -import 'package:selfprivacy/ui/pages/setup/recovering/recovery_confirm_cloudflare.dart'; +import 'package:selfprivacy/ui/pages/setup/recovering/recovery_confirm_dns.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_confirm_server.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_server_provider_connected.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_method_select.dart'; @@ -55,8 +55,8 @@ class RecoveryRouting extends StatelessWidget { case RecoveryStep.serverSelection: currentPage = const RecoveryConfirmServer(); break; - case RecoveryStep.cloudflareToken: - currentPage = const RecoveryConfirmCloudflare(); + case RecoveryStep.dnsProviderToken: + currentPage = const RecoveryConfirmDns(); break; case RecoveryStep.backblazeToken: currentPage = const RecoveryConfirmBackblaze(); diff --git a/lib/ui/router/router.gr.dart b/lib/ui/router/router.gr.dart index 328c5f76..675056f3 100644 --- a/lib/ui/router/router.gr.dart +++ b/lib/ui/router/router.gr.dart @@ -14,52 +14,16 @@ abstract class _$RootRouter extends RootStackRouter { @override final Map pagesMap = { - AboutApplicationRoute.name: (routeData) { + BackupDetailsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const AboutApplicationPage(), + child: const BackupDetailsPage(), ); }, - AppSettingsRoute.name: (routeData) { + RootRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const AppSettingsPage(), - ); - }, - DeveloperSettingsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const DeveloperSettingsPage(), - ); - }, - ConsoleRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ConsolePage(), - ); - }, - MoreRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const MorePage(), - ); - }, - OnboardingRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const OnboardingPage(), - ); - }, - ProvidersRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ProvidersPage(), - ); - }, - ServerDetailsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ServerDetailsScreen(), + child: WrappedRoute(child: const RootPage()), ); }, ServiceRoute.name: (routeData) { @@ -78,6 +42,12 @@ abstract class _$RootRouter extends RootStackRouter { child: const ServicesPage(), ); }, + ServerDetailsRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ServerDetailsScreen(), + ); + }, UsersRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, @@ -100,10 +70,46 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, - BackupDetailsRoute.name: (routeData) { + AppSettingsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const BackupDetailsPage(), + child: const AppSettingsPage(), + ); + }, + DeveloperSettingsRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const DeveloperSettingsPage(), + ); + }, + MoreRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const MorePage(), + ); + }, + AboutApplicationRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const AboutApplicationPage(), + ); + }, + ConsoleRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ConsolePage(), + ); + }, + ProvidersRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ProvidersPage(), + ); + }, + RecoveryKeyRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const RecoveryKeyPage(), ); }, DnsDetailsRoute.name: (routeData) { @@ -124,26 +130,12 @@ abstract class _$RootRouter extends RootStackRouter { child: const InitializingPage(), ); }, - RecoveryKeyRoute.name: (routeData) { + ServerStorageRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: const RecoveryKeyPage(), - ); - }, - DevicesRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const DevicesScreen(), - ); - }, - ServicesMigrationRoute.name: (routeData) { - final args = routeData.argsAs(); - return AutoRoutePage( - routeData: routeData, - child: ServicesMigrationPage( - services: args.services, + child: ServerStoragePage( diskStatus: args.diskStatus, - isMigration: args.isMigration, key: args.key, ), ); @@ -159,133 +151,57 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, - ServerStorageRoute.name: (routeData) { - final args = routeData.argsAs(); + ServicesMigrationRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: ServerStoragePage( + child: ServicesMigrationPage( + services: args.services, diskStatus: args.diskStatus, + isMigration: args.isMigration, key: args.key, ), ); }, - RootRoute.name: (routeData) { + DevicesRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: WrappedRoute(child: const RootPage()), + child: const DevicesScreen(), + ); + }, + OnboardingRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const OnboardingPage(), ); }, }; } /// generated route for -/// [AboutApplicationPage] -class AboutApplicationRoute extends PageRouteInfo { - const AboutApplicationRoute({List? children}) +/// [BackupDetailsPage] +class BackupDetailsRoute extends PageRouteInfo { + const BackupDetailsRoute({List? children}) : super( - AboutApplicationRoute.name, + BackupDetailsRoute.name, initialChildren: children, ); - static const String name = 'AboutApplicationRoute'; + static const String name = 'BackupDetailsRoute'; static const PageInfo page = PageInfo(name); } /// generated route for -/// [AppSettingsPage] -class AppSettingsRoute extends PageRouteInfo { - const AppSettingsRoute({List? children}) +/// [RootPage] +class RootRoute extends PageRouteInfo { + const RootRoute({List? children}) : super( - AppSettingsRoute.name, + RootRoute.name, initialChildren: children, ); - static const String name = 'AppSettingsRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [DeveloperSettingsPage] -class DeveloperSettingsRoute extends PageRouteInfo { - const DeveloperSettingsRoute({List? children}) - : super( - DeveloperSettingsRoute.name, - initialChildren: children, - ); - - static const String name = 'DeveloperSettingsRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [ConsolePage] -class ConsoleRoute extends PageRouteInfo { - const ConsoleRoute({List? children}) - : super( - ConsoleRoute.name, - initialChildren: children, - ); - - static const String name = 'ConsoleRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [MorePage] -class MoreRoute extends PageRouteInfo { - const MoreRoute({List? children}) - : super( - MoreRoute.name, - initialChildren: children, - ); - - static const String name = 'MoreRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [OnboardingPage] -class OnboardingRoute extends PageRouteInfo { - const OnboardingRoute({List? children}) - : super( - OnboardingRoute.name, - initialChildren: children, - ); - - static const String name = 'OnboardingRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [ProvidersPage] -class ProvidersRoute extends PageRouteInfo { - const ProvidersRoute({List? children}) - : super( - ProvidersRoute.name, - initialChildren: children, - ); - - static const String name = 'ProvidersRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [ServerDetailsScreen] -class ServerDetailsRoute extends PageRouteInfo { - const ServerDetailsRoute({List? children}) - : super( - ServerDetailsRoute.name, - initialChildren: children, - ); - - static const String name = 'ServerDetailsRoute'; + static const String name = 'RootRoute'; static const PageInfo page = PageInfo(name); } @@ -342,6 +258,20 @@ class ServicesRoute extends PageRouteInfo { static const PageInfo page = PageInfo(name); } +/// generated route for +/// [ServerDetailsScreen] +class ServerDetailsRoute extends PageRouteInfo { + const ServerDetailsRoute({List? children}) + : super( + ServerDetailsRoute.name, + initialChildren: children, + ); + + static const String name = 'ServerDetailsRoute'; + + static const PageInfo page = PageInfo(name); +} + /// generated route for /// [UsersPage] class UsersRoute extends PageRouteInfo { @@ -409,15 +339,99 @@ class UserDetailsRouteArgs { } /// generated route for -/// [BackupDetailsPage] -class BackupDetailsRoute extends PageRouteInfo { - const BackupDetailsRoute({List? children}) +/// [AppSettingsPage] +class AppSettingsRoute extends PageRouteInfo { + const AppSettingsRoute({List? children}) : super( - BackupDetailsRoute.name, + AppSettingsRoute.name, initialChildren: children, ); - static const String name = 'BackupDetailsRoute'; + static const String name = 'AppSettingsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [DeveloperSettingsPage] +class DeveloperSettingsRoute extends PageRouteInfo { + const DeveloperSettingsRoute({List? children}) + : super( + DeveloperSettingsRoute.name, + initialChildren: children, + ); + + static const String name = 'DeveloperSettingsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [MorePage] +class MoreRoute extends PageRouteInfo { + const MoreRoute({List? children}) + : super( + MoreRoute.name, + initialChildren: children, + ); + + static const String name = 'MoreRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [AboutApplicationPage] +class AboutApplicationRoute extends PageRouteInfo { + const AboutApplicationRoute({List? children}) + : super( + AboutApplicationRoute.name, + initialChildren: children, + ); + + static const String name = 'AboutApplicationRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [ConsolePage] +class ConsoleRoute extends PageRouteInfo { + const ConsoleRoute({List? children}) + : super( + ConsoleRoute.name, + initialChildren: children, + ); + + static const String name = 'ConsoleRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [ProvidersPage] +class ProvidersRoute extends PageRouteInfo { + const ProvidersRoute({List? children}) + : super( + ProvidersRoute.name, + initialChildren: children, + ); + + static const String name = 'ProvidersRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [RecoveryKeyPage] +class RecoveryKeyRoute extends PageRouteInfo { + const RecoveryKeyRoute({List? children}) + : super( + RecoveryKeyRoute.name, + initialChildren: children, + ); + + static const String name = 'RecoveryKeyRoute'; static const PageInfo page = PageInfo(name); } @@ -465,31 +479,84 @@ class InitializingRoute extends PageRouteInfo { } /// generated route for -/// [RecoveryKeyPage] -class RecoveryKeyRoute extends PageRouteInfo { - const RecoveryKeyRoute({List? children}) - : super( - RecoveryKeyRoute.name, +/// [ServerStoragePage] +class ServerStorageRoute extends PageRouteInfo { + ServerStorageRoute({ + required DiskStatus diskStatus, + Key? key, + List? children, + }) : super( + ServerStorageRoute.name, + args: ServerStorageRouteArgs( + diskStatus: diskStatus, + key: key, + ), initialChildren: children, ); - static const String name = 'RecoveryKeyRoute'; + static const String name = 'ServerStorageRoute'; - static const PageInfo page = PageInfo(name); + static const PageInfo page = + PageInfo(name); +} + +class ServerStorageRouteArgs { + const ServerStorageRouteArgs({ + required this.diskStatus, + this.key, + }); + + final DiskStatus diskStatus; + + final Key? key; + + @override + String toString() { + return 'ServerStorageRouteArgs{diskStatus: $diskStatus, key: $key}'; + } } /// generated route for -/// [DevicesScreen] -class DevicesRoute extends PageRouteInfo { - const DevicesRoute({List? children}) - : super( - DevicesRoute.name, +/// [ExtendingVolumePage] +class ExtendingVolumeRoute extends PageRouteInfo { + ExtendingVolumeRoute({ + required DiskVolume diskVolumeToResize, + required DiskStatus diskStatus, + Key? key, + List? children, + }) : super( + ExtendingVolumeRoute.name, + args: ExtendingVolumeRouteArgs( + diskVolumeToResize: diskVolumeToResize, + diskStatus: diskStatus, + key: key, + ), initialChildren: children, ); - static const String name = 'DevicesRoute'; + static const String name = 'ExtendingVolumeRoute'; - static const PageInfo page = PageInfo(name); + static const PageInfo page = + PageInfo(name); +} + +class ExtendingVolumeRouteArgs { + const ExtendingVolumeRouteArgs({ + required this.diskVolumeToResize, + required this.diskStatus, + this.key, + }); + + final DiskVolume diskVolumeToResize; + + final DiskStatus diskStatus; + + final Key? key; + + @override + String toString() { + return 'ExtendingVolumeRouteArgs{diskVolumeToResize: $diskVolumeToResize, diskStatus: $diskStatus, key: $key}'; + } } /// generated route for @@ -541,96 +608,29 @@ class ServicesMigrationRouteArgs { } /// generated route for -/// [ExtendingVolumePage] -class ExtendingVolumeRoute extends PageRouteInfo { - ExtendingVolumeRoute({ - required DiskVolume diskVolumeToResize, - required DiskStatus diskStatus, - Key? key, - List? children, - }) : super( - ExtendingVolumeRoute.name, - args: ExtendingVolumeRouteArgs( - diskVolumeToResize: diskVolumeToResize, - diskStatus: diskStatus, - key: key, - ), - initialChildren: children, - ); - - static const String name = 'ExtendingVolumeRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ExtendingVolumeRouteArgs { - const ExtendingVolumeRouteArgs({ - required this.diskVolumeToResize, - required this.diskStatus, - this.key, - }); - - final DiskVolume diskVolumeToResize; - - final DiskStatus diskStatus; - - final Key? key; - - @override - String toString() { - return 'ExtendingVolumeRouteArgs{diskVolumeToResize: $diskVolumeToResize, diskStatus: $diskStatus, key: $key}'; - } -} - -/// generated route for -/// [ServerStoragePage] -class ServerStorageRoute extends PageRouteInfo { - ServerStorageRoute({ - required DiskStatus diskStatus, - Key? key, - List? children, - }) : super( - ServerStorageRoute.name, - args: ServerStorageRouteArgs( - diskStatus: diskStatus, - key: key, - ), - initialChildren: children, - ); - - static const String name = 'ServerStorageRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ServerStorageRouteArgs { - const ServerStorageRouteArgs({ - required this.diskStatus, - this.key, - }); - - final DiskStatus diskStatus; - - final Key? key; - - @override - String toString() { - return 'ServerStorageRouteArgs{diskStatus: $diskStatus, key: $key}'; - } -} - -/// generated route for -/// [RootPage] -class RootRoute extends PageRouteInfo { - const RootRoute({List? children}) +/// [DevicesScreen] +class DevicesRoute extends PageRouteInfo { + const DevicesRoute({List? children}) : super( - RootRoute.name, + DevicesRoute.name, initialChildren: children, ); - static const String name = 'RootRoute'; + static const String name = 'DevicesRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [OnboardingPage] +class OnboardingRoute extends PageRouteInfo { + const OnboardingRoute({List? children}) + : super( + OnboardingRoute.name, + initialChildren: children, + ); + + static const String name = 'OnboardingRoute'; static const PageInfo page = PageInfo(name); } From 32ef162f9b7f6e77c9b078b30f087c08e68a4b44 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 11:06:01 -0300 Subject: [PATCH 05/15] feat: Implement polymorphic DNS check for DNS API --- .../dns_providers/cloudflare/cloudflare.dart | 144 +++++++++++ .../rest_maps/dns_providers/desec/desec.dart | 226 +++++++++++++++--- .../rest_maps/dns_providers/dns_provider.dart | 12 +- .../server_providers/hetzner/hetzner.dart | 2 +- .../cubit/dns_records/dns_records_cubit.dart | 92 +++---- lib/utils/network_utils.dart | 81 ------- 6 files changed, 385 insertions(+), 172 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart index 04ff622b..eb22e4d8 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/cloudflare/cloudflare.dart @@ -5,6 +5,7 @@ import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; +import 'package:selfprivacy/utils/network_utils.dart'; class CloudflareApi extends DnsProviderApi { CloudflareApi({ @@ -317,4 +318,147 @@ class CloudflareApi extends DnsProviderApi { return domains; } + + @override + Future>> validateDnsRecords( + final ServerDomain domain, + final String ip4, + final String dkimPublicKey, + ) async { + final List records = await getDnsRecords(domain: domain); + final List foundRecords = []; + try { + final List desiredRecords = + getDesiredDnsRecords(domain.domainName, ip4, dkimPublicKey); + for (final DesiredDnsRecord record in desiredRecords) { + if (record.description == 'record.dkim') { + final DnsRecord foundRecord = records.firstWhere( + (final r) => (r.name == record.name) && r.type == record.type, + orElse: () => DnsRecord( + name: record.name, + type: record.type, + content: '', + ttl: 800, + proxied: false, + ), + ); + // remove all spaces and tabulators from + // the foundRecord.content and the record.content + // to compare them + final String? foundContent = + foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); + final String content = record.content.replaceAll(RegExp(r'\s+'), ''); + if (foundContent == content) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } else { + if (records.any( + (final r) => + (r.name == record.name) && + r.type == record.type && + r.content == record.content, + )) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } + } + } catch (e) { + print(e); + return APIGenericResult( + data: [], + success: false, + message: e.toString(), + ); + } + return APIGenericResult( + data: foundRecords, + success: true, + ); + } + + @override + List getDesiredDnsRecords( + final String? domainName, + final String? ip4, + final String? dkimPublicKey, + ) { + if (domainName == null || ip4 == null) { + return []; + } + return [ + DesiredDnsRecord( + name: domainName, + content: ip4, + description: 'record.root', + ), + DesiredDnsRecord( + name: 'api.$domainName', + content: ip4, + description: 'record.api', + ), + DesiredDnsRecord( + name: 'cloud.$domainName', + content: ip4, + description: 'record.cloud', + ), + DesiredDnsRecord( + name: 'git.$domainName', + content: ip4, + description: 'record.git', + ), + DesiredDnsRecord( + name: 'meet.$domainName', + content: ip4, + description: 'record.meet', + ), + DesiredDnsRecord( + name: 'social.$domainName', + content: ip4, + description: 'record.social', + ), + DesiredDnsRecord( + name: 'password.$domainName', + content: ip4, + description: 'record.password', + ), + DesiredDnsRecord( + name: 'vpn.$domainName', + content: ip4, + description: 'record.vpn', + ), + DesiredDnsRecord( + name: domainName, + content: domainName, + description: 'record.mx', + type: 'MX', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '_dmarc.$domainName', + content: 'v=DMARC1; p=none', + description: 'record.dmarc', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: domainName, + content: 'v=spf1 a mx ip4:$ip4 -all', + description: 'record.spf', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + if (dkimPublicKey != null) + DesiredDnsRecord( + name: 'selector._domainkey.$domainName', + content: dkimPublicKey, + description: 'record.dkim', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + ]; + } } diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index 4e55bbfa..91eed57a 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -5,6 +5,7 @@ import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; +import 'package:selfprivacy/utils/network_utils.dart'; class DesecApi extends DnsProviderApi { DesecApi({ @@ -61,6 +62,7 @@ class DesecApi extends DnsProviderApi { headers: {'Authorization': 'Token $token'}, ), ); + await Future.delayed(const Duration(seconds: 1)); } catch (e) { print(e); isValid = false; @@ -102,13 +104,29 @@ class DesecApi extends DnsProviderApi { }) async { final String domainName = domain.domainName; final String url = '/$domainName/rrsets/'; + final List listDnsRecords = projectDnsRecords(domainName, ip4); final Dio client = await getClient(); try { - final Response response = await client.get(url); - - final List records = response.data; - await client.put(url, data: records); + final List bulkRecords = []; + for (final DnsRecord record in listDnsRecords) { + bulkRecords.add( + record.name == null + ? { + 'type': record.type, + 'ttl': record.ttl, + 'records': [], + } + : { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [], + }, + ); + } + await client.put(url, data: bulkRecords); + await Future.delayed(const Duration(seconds: 1)); } catch (e) { print(e); return APIGenericResult( @@ -136,14 +154,18 @@ class DesecApi extends DnsProviderApi { final Dio client = await getClient(); try { response = await client.get(url); + await Future.delayed(const Duration(seconds: 1)); final List records = response.data; for (final record in records) { + final String? content = (record['records'] is List) + ? record['records'][0] + : record['records']; allRecords.add( DnsRecord( name: record['subname'], type: record['type'], - content: record['records'], + content: content, ttl: record['ttl'], ), ); @@ -164,30 +186,31 @@ class DesecApi extends DnsProviderApi { }) async { final String domainName = domain.domainName; final List listDnsRecords = projectDnsRecords(domainName, ip4); - final List allCreateFutures = []; final Dio client = await getClient(); try { + final List bulkRecords = []; for (final DnsRecord record in listDnsRecords) { - allCreateFutures.add( - client.post( - '/$domainName/rrsets/', - data: record.name == null - ? { - 'type': record.type, - 'ttl': record.ttl, - 'records': [record.content], - } - : { - 'subname': record.name, - 'type': record.type, - 'ttl': record.ttl, - 'records': [record.content], - }, - ), + bulkRecords.add( + record.name == null + ? { + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + } + : { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [record.content], + }, ); } - await Future.wait(allCreateFutures); + await client.post( + '/$domainName/rrsets/', + data: bulkRecords, + ); + await Future.delayed(const Duration(seconds: 1)); } on DioError catch (e) { print(e.message); rethrow; @@ -209,9 +232,10 @@ class DesecApi extends DnsProviderApi { final String? domainName, final String? ip4, ) { - final DnsRecord domainA = DnsRecord(type: 'A', name: null, content: ip4); + final DnsRecord domainA = DnsRecord(type: 'A', name: '', content: ip4); - final DnsRecord mx = DnsRecord(type: 'MX', name: null, content: domainName); + final DnsRecord mx = + DnsRecord(type: 'MX', name: '', content: '10 $domainName.'); final DnsRecord apiA = DnsRecord(type: 'A', name: 'api', content: ip4); final DnsRecord cloudA = DnsRecord(type: 'A', name: 'cloud', content: ip4); final DnsRecord gitA = DnsRecord(type: 'A', name: 'git', content: ip4); @@ -225,14 +249,14 @@ class DesecApi extends DnsProviderApi { final DnsRecord txt1 = DnsRecord( type: 'TXT', name: '_dmarc', - content: 'v=DMARC1; p=none', + content: '"v=DMARC1; p=none"', ttl: 18000, ); final DnsRecord txt2 = DnsRecord( type: 'TXT', - name: null, - content: 'v=spf1 a mx ip4:$ip4 -all', + name: '', + content: '"v=spf1 a mx ip4:$ip4 -all"', ttl: 18000, ); @@ -275,6 +299,7 @@ class DesecApi extends DnsProviderApi { 'records': [record.content], }, ); + await Future.delayed(const Duration(seconds: 1)); } catch (e) { print(e); } finally { @@ -291,6 +316,7 @@ class DesecApi extends DnsProviderApi { final Response response = await client.get( '', ); + await Future.delayed(const Duration(seconds: 1)); domains = response.data .map((final el) => el['name'] as String) .toList(); @@ -302,4 +328,148 @@ class DesecApi extends DnsProviderApi { return domains; } + + @override + Future>> validateDnsRecords( + final ServerDomain domain, + final String ip4, + final String dkimPublicKey, + ) async { + final List records = await getDnsRecords(domain: domain); + final List foundRecords = []; + try { + final List desiredRecords = + getDesiredDnsRecords(domain.domainName, ip4, dkimPublicKey); + for (final DesiredDnsRecord record in desiredRecords) { + if (record.description == 'record.dkim') { + final DnsRecord foundRecord = records.firstWhere( + (final r) => (r.name == record.name) && r.type == record.type, + orElse: () => DnsRecord( + name: record.name, + type: record.type, + content: '', + ttl: 800, + proxied: false, + ), + ); + // remove all spaces and tabulators from + // the foundRecord.content and the record.content + // to compare them + final String? foundContent = + foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); + final String content = record.content.replaceAll(RegExp(r'\s+'), ''); + if (foundContent == content) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } else { + if (records.any( + (final r) => + ('${r.name}.${domain.domainName}' == record.name || + record.name == '') && + r.type == record.type && + r.content == record.content, + )) { + foundRecords.add(record.copyWith(isSatisfied: true)); + } else { + foundRecords.add(record.copyWith(isSatisfied: false)); + } + } + } + } catch (e) { + print(e); + return APIGenericResult( + data: [], + success: false, + message: e.toString(), + ); + } + return APIGenericResult( + data: foundRecords, + success: true, + ); + } + + @override + List getDesiredDnsRecords( + final String? domainName, + final String? ip4, + final String? dkimPublicKey, + ) { + if (domainName == null || ip4 == null) { + return []; + } + return [ + DesiredDnsRecord( + name: '', + content: ip4, + description: 'record.root', + ), + DesiredDnsRecord( + name: 'api.$domainName', + content: ip4, + description: 'record.api', + ), + DesiredDnsRecord( + name: 'cloud.$domainName', + content: ip4, + description: 'record.cloud', + ), + DesiredDnsRecord( + name: 'git.$domainName', + content: ip4, + description: 'record.git', + ), + DesiredDnsRecord( + name: 'meet.$domainName', + content: ip4, + description: 'record.meet', + ), + DesiredDnsRecord( + name: 'social.$domainName', + content: ip4, + description: 'record.social', + ), + DesiredDnsRecord( + name: 'password.$domainName', + content: ip4, + description: 'record.password', + ), + DesiredDnsRecord( + name: 'vpn.$domainName', + content: ip4, + description: 'record.vpn', + ), + DesiredDnsRecord( + name: '', + content: '10 $domainName.', + description: 'record.mx', + type: 'MX', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '_dmarc.$domainName', + content: '"v=DMARC1; p=none"', + description: 'record.dmarc', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + DesiredDnsRecord( + name: '', + content: '"v=spf1 a mx ip4:$ip4 -all"', + description: 'record.spf', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + if (dkimPublicKey != null) + DesiredDnsRecord( + name: 'selector._domainkey.$domainName', + content: dkimPublicKey, + description: 'record.dkim', + type: 'TXT', + category: DnsRecordsCategory.email, + ), + ]; + } } diff --git a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart index 106d185c..b85f94d1 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/dns_provider.dart @@ -2,6 +2,7 @@ import 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_map.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; +import 'package:selfprivacy/utils/network_utils.dart'; export 'package:selfprivacy/logic/api_maps/api_generic_result.dart'; @@ -26,9 +27,18 @@ abstract class DnsProviderApi extends ApiMap { final DnsRecord record, final ServerDomain domain, ); + Future>> validateDnsRecords( + final ServerDomain domain, + final String ip4, + final String dkimPublicKey, + ); + List getDesiredDnsRecords( + final String? domainName, + final String? ip4, + final String? dkimPublicKey, + ); Future getZoneId(final String domain); Future> domainList(); - Future> isApiTokenValid(final String token); RegExp getApiTokenValidation(); } diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart index c2228030..f9a2104e 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart @@ -394,7 +394,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final String apiToken = StringGenerators.apiToken(); final String hostname = getHostnameFromDomain(domainName); - const String infectBranch = 'providers/hetzner'; + const String infectBranch = 'testing/desec'; final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; final String base64Password = base64.encode(utf8.encode(rootUser.password ?? 'PASS')); diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 3403dc68..de87910d 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -25,11 +25,13 @@ class DnsRecordsCubit emit( DnsRecordsState( dnsState: DnsRecordsStatus.refreshing, - dnsRecords: getDesiredDnsRecords( - serverInstallationCubit.state.serverDomain?.domainName, - '', - '', - ), + dnsRecords: ApiController.currentDnsProviderApiFactory! + .getDnsProvider() + .getDesiredDnsRecords( + serverInstallationCubit.state.serverDomain?.domainName, + '', + '', + ), ), ); @@ -37,64 +39,32 @@ class DnsRecordsCubit final ServerDomain? domain = serverInstallationCubit.state.serverDomain; final String? ipAddress = serverInstallationCubit.state.serverDetails?.ip4; - if (domain != null && ipAddress != null) { - final List records = await ApiController - .currentDnsProviderApiFactory! - .getDnsProvider() - .getDnsRecords(domain: domain); - final String? dkimPublicKey = - extractDkimRecord(await api.getDnsRecords())?.content; - final List desiredRecords = - getDesiredDnsRecords(domain.domainName, ipAddress, dkimPublicKey); - final List foundRecords = []; - for (final DesiredDnsRecord record in desiredRecords) { - if (record.description == 'record.dkim') { - final DnsRecord foundRecord = records.firstWhere( - (final r) => r.name == record.name && r.type == record.type, - orElse: () => DnsRecord( - name: record.name, - type: record.type, - content: '', - ttl: 800, - proxied: false, - ), - ); - // remove all spaces and tabulators from - // the foundRecord.content and the record.content - // to compare them - final String? foundContent = - foundRecord.content?.replaceAll(RegExp(r'\s+'), ''); - final String content = - record.content.replaceAll(RegExp(r'\s+'), ''); - if (foundContent == content) { - foundRecords.add(record.copyWith(isSatisfied: true)); - } else { - foundRecords.add(record.copyWith(isSatisfied: false)); - } - } else { - if (records.any( - (final r) => - r.name == record.name && - r.type == record.type && - r.content == record.content, - )) { - foundRecords.add(record.copyWith(isSatisfied: true)); - } else { - foundRecords.add(record.copyWith(isSatisfied: false)); - } - } - } - emit( - DnsRecordsState( - dnsRecords: foundRecords, - dnsState: foundRecords.any((final r) => r.isSatisfied == false) - ? DnsRecordsStatus.error - : DnsRecordsStatus.good, - ), - ); - } else { + if (domain == null && ipAddress == null) { emit(const DnsRecordsState()); + return; } + + final foundRecords = await ApiController.currentDnsProviderApiFactory! + .getDnsProvider() + .validateDnsRecords( + domain!, + ipAddress!, + extractDkimRecord(await api.getDnsRecords())?.content ?? '', + ); + + if (!foundRecords.success || foundRecords.data.isEmpty) { + emit(const DnsRecordsState()); + return; + } + + emit( + DnsRecordsState( + dnsRecords: foundRecords.data, + dnsState: foundRecords.data.any((final r) => r.isSatisfied == false) + ? DnsRecordsStatus.error + : DnsRecordsStatus.good, + ), + ); } } diff --git a/lib/utils/network_utils.dart b/lib/utils/network_utils.dart index fc06ecb8..3b7f9219 100644 --- a/lib/utils/network_utils.dart +++ b/lib/utils/network_utils.dart @@ -41,87 +41,6 @@ class DesiredDnsRecord { ); } -List getDesiredDnsRecords( - final String? domainName, - final String? ipAddress, - final String? dkimPublicKey, -) { - if (domainName == null || ipAddress == null) { - return []; - } - return [ - DesiredDnsRecord( - name: domainName, - content: ipAddress, - description: 'record.root', - ), - DesiredDnsRecord( - name: 'api.$domainName', - content: ipAddress, - description: 'record.api', - ), - DesiredDnsRecord( - name: 'cloud.$domainName', - content: ipAddress, - description: 'record.cloud', - ), - DesiredDnsRecord( - name: 'git.$domainName', - content: ipAddress, - description: 'record.git', - ), - DesiredDnsRecord( - name: 'meet.$domainName', - content: ipAddress, - description: 'record.meet', - ), - DesiredDnsRecord( - name: 'social.$domainName', - content: ipAddress, - description: 'record.social', - ), - DesiredDnsRecord( - name: 'password.$domainName', - content: ipAddress, - description: 'record.password', - ), - DesiredDnsRecord( - name: 'vpn.$domainName', - content: ipAddress, - description: 'record.vpn', - ), - DesiredDnsRecord( - name: domainName, - content: domainName, - description: 'record.mx', - type: 'MX', - category: DnsRecordsCategory.email, - ), - DesiredDnsRecord( - name: '_dmarc.$domainName', - content: 'v=DMARC1; p=none', - description: 'record.dmarc', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - DesiredDnsRecord( - name: domainName, - content: 'v=spf1 a mx ip4:$ipAddress -all', - description: 'record.spf', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - if (dkimPublicKey != null) - DesiredDnsRecord( - name: 'selector._domainkey.$domainName', - content: dkimPublicKey, - description: 'record.dkim', - type: 'TXT', - category: DnsRecordsCategory.email, - ), - ]; -} - DnsRecord? extractDkimRecord(final List records) { DnsRecord? dkimRecord; From 6bee028188b8ce9a76c2fcf6458b3e7f6964dcfd Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 12:49:55 -0300 Subject: [PATCH 06/15] feat: Implement proper DKIM creation for deSEC --- assets/translations/en.json | 4 +++- assets/translations/ru.json | 4 +++- .../rest_maps/dns_providers/desec/desec.dart | 19 ++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 0d825bff..b902c3a2 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -286,11 +286,13 @@ "select_provider_countries_text_hetzner": "Germany, Finland, USA", "select_provider_countries_text_do": "USA, Netherlands, Singapore, UK, Germany, Canada, India, Australia", "select_provider_price_title": "Average price", + "select_provider_price_free": "Free", "select_provider_price_text_hetzner": "€8 per month for a relatively small server and 50GB of disk storage", "select_provider_price_text_do": "$17 per month for a relatively small server and 50GB of disk storage", "select_provider_payment_title": "Payment methods", "select_provider_payment_text_hetzner": "Credit cards, SWIFT, SEPA, PayPal", "select_provider_payment_text_do": "Credit cards, Google Pay, PayPal", + "select_provider_payment_text_cloudflare": "Credit cards", "select_provider_email_notice": "E-mail hosting won't be available for new clients. Nevertheless it will be unlocked as soon as you complete your first payment.", "select_provider_site_button": "Visit site", "connect_to_server_provider": "Now log in ", @@ -506,4 +508,4 @@ "reset_onboarding_description": "Reset onboarding switch to show onboarding screen again", "cubit_statuses": "Cubit loading statuses" } -} +} \ No newline at end of file diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 35498bd9..6b624c70 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -280,10 +280,12 @@ "select_provider_countries_text_hetzner": "Германия, Финляндия, США", "select_provider_countries_text_do": "США, Нидерланды, Сингапур, Великобритания, Германия, Канада, Индия, Австралия", "select_provider_price_title": "Средняя цена", + "select_provider_price_free": "Бесплатно", "select_provider_price_text_hetzner": "€8 в месяц за небольшой сервер и 50GB места на диске", "select_provider_price_text_do": "$17 в месяц за небольшой сервер и 50GB места на диске", "select_provider_payment_title": "Методы оплаты", "select_provider_payment_text_hetzner": "Банковские карты, SWIFT, SEPA, PayPal", + "select_provider_payment_text_cloudflare": "Банковские карты", "select_provider_payment_text_do": "Банковские карты, Google Pay, PayPal", "select_provider_email_notice": "Хостинг электронной почты недоступен для новых клиентов. Разблокировать можно будет после первой оплаты.", "select_provider_site_button": "Посетить сайт", @@ -473,4 +475,4 @@ "length_not_equal": "Длина строки [], должна быть равна {}", "length_longer": "Длина строки [], должна быть меньше либо равна {}" } -} +} \ No newline at end of file diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index 91eed57a..0a8197dc 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -196,13 +196,13 @@ class DesecApi extends DnsProviderApi { ? { 'type': record.type, 'ttl': record.ttl, - 'records': [record.content], + 'records': [extractContent(record)], } : { 'subname': record.name, 'type': record.type, 'ttl': record.ttl, - 'records': [record.content], + 'records': [extractContent(record)], }, ); } @@ -275,6 +275,15 @@ class DesecApi extends DnsProviderApi { ]; } + String? extractContent(final DnsRecord record) { + String? content = record.content; + if (record.type == 'TXT' && content != null && !content.startsWith('"')) { + content = '"$content"'; + } + + return content; + } + @override Future setDnsRecord( final DnsRecord record, @@ -290,13 +299,13 @@ class DesecApi extends DnsProviderApi { ? { 'type': record.type, 'ttl': record.ttl, - 'records': [record.content], + 'records': [extractContent(record)], } : { 'subname': record.name, 'type': record.type, 'ttl': record.ttl, - 'records': [record.content], + 'records': [extractContent(record)], }, ); await Future.delayed(const Duration(seconds: 1)); @@ -465,7 +474,7 @@ class DesecApi extends DnsProviderApi { if (dkimPublicKey != null) DesiredDnsRecord( name: 'selector._domainkey.$domainName', - content: dkimPublicKey, + content: '"$dkimPublicKey"', description: 'record.dkim', type: 'TXT', category: DnsRecordsCategory.email, From 8b0d318eac1835f27cec59a03c663b6f9f107232 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 14:58:51 -0300 Subject: [PATCH 07/15] chore: Add assets for deSEC --- assets/images/logos/cloudflare.svg | 1 + assets/markdown/how_desec-en.md | 9 +++++++++ assets/markdown/how_desec-ru.md | 9 +++++++++ assets/translations/en.json | 8 ++++---- assets/translations/ru.json | 8 ++++---- 5 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 assets/images/logos/cloudflare.svg create mode 100644 assets/markdown/how_desec-en.md create mode 100644 assets/markdown/how_desec-ru.md diff --git a/assets/images/logos/cloudflare.svg b/assets/images/logos/cloudflare.svg new file mode 100644 index 00000000..7099a7e9 --- /dev/null +++ b/assets/images/logos/cloudflare.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/markdown/how_desec-en.md b/assets/markdown/how_desec-en.md new file mode 100644 index 00000000..c86d3855 --- /dev/null +++ b/assets/markdown/how_desec-en.md @@ -0,0 +1,9 @@ +### How to get deSEC API Token +1. Log in at: https://desec.io/login +2. Go to **Domains** page at: https://desec.io/domains +3. Go to **Token management** tab. +4. Click on the round "plus" button in the upper right corner. +5. **"Generate New Token"** dialogue must be displayed. Enter any **Token name** you wish. *Advanced settings* are not required, so do not touch anything there. +6. Click on **Save**. +7. Make sure you **save** the token's **secret value** as it will only be displayed once. +8. Now you can safely **close** the dialogue. \ No newline at end of file diff --git a/assets/markdown/how_desec-ru.md b/assets/markdown/how_desec-ru.md new file mode 100644 index 00000000..a93acc77 --- /dev/null +++ b/assets/markdown/how_desec-ru.md @@ -0,0 +1,9 @@ +### Как получить deSEC API Токен +1. Авторизуемся в deSEC: https://desec.io/login +2. Переходим на страницу **Domains** по ссылке: https://desec.io/domains +3. Переходим на вкладку **Token management**. +4. Нажимаем на большую кнопку с плюсом в правом верхнем углу страницы. +5. Должен был появиться **"Generate New Token"** диалог. Вводим любое имя токена в **Token name**. *Advanced settings* необязательны, так что ничего там не трогаем. +6. Кликаем **Save**. +7. Обязательно сохраняем "**secret value**" ключ токена, потому что он отображается исключительно один раз. +8. Теперь спокойно закрываем диалог, нажав **close**. \ No newline at end of file diff --git a/assets/translations/en.json b/assets/translations/en.json index b902c3a2..653e33f8 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -313,13 +313,13 @@ "choose_server_type_storage": "{} GB of system storage", "choose_server_type_payment_per_month": "{} per month", "no_server_types_found": "No available server types found. Make sure your account is accessible and try to change your server location.", - "cloudflare_bad_key_error": "Cloudflare API key is invalid", + "cloudflare_bad_key_error": "DNS Provider API key is invalid", "backblaze_bad_key_error": "Backblaze storage information is invalid", "select_dns": "Now let's select a DNS provider", "manage_domain_dns": "To manage your domain's DNS", "use_this_domain": "Use this domain?", "use_this_domain_text": "The token you provided gives access to the following domain", - "cloudflare_api_token": "CloudFlare API Token", + "cloudflare_api_token": "DNS Provider API Token", "connect_backblaze_storage": "Connect Backblaze storage", "no_connected_domains": "No connected domains at the moment", "loading_domain_list": "Loading domain list", @@ -390,8 +390,8 @@ "modal_confirmation_dns_invalid": "Reverse DNS points to another domain", "modal_confirmation_ip_valid": "IP is the same as in DNS record", "modal_confirmation_ip_invalid": "IP is not the same as in DNS record", - "confirm_cloudflare": "Connect to CloudFlare", - "confirm_cloudflare_description": "Enter a Cloudflare token with access to {}:", + "confirm_cloudflare": "Connect to your DNS Provider", + "confirm_cloudflare_description": "Enter a token of your DNS Provider with access to {}:", "confirm_backblaze": "Connect to Backblaze", "confirm_backblaze_description": "Enter a Backblaze token with access to backup storage:" }, diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 6b624c70..b4bdd938 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -307,12 +307,12 @@ "choose_server_type_storage": "{} GB системного хранилища", "choose_server_type_payment_per_month": "{} в месяц", "no_server_types_found": "Не найдено доступных типов сервера! Пожалуйста, убедитесь, что у вас есть доступ к провайдеру сервера...", - "cloudflare_bad_key_error": "Cloudflare API ключ неверен", + "cloudflare_bad_key_error": "API ключ неверен", "backblaze_bad_key_error": "Информация о Backblaze хранилище неверна", "manage_domain_dns": "Для управления DNS вашего домена", "use_this_domain": "Используем этот домен?", "use_this_domain_text": "Указанный вами токен даёт контроль над этим доменом", - "cloudflare_api_token": "CloudFlare API ключ", + "cloudflare_api_token": "API ключ DNS провайдера", "connect_backblaze_storage": "Подключите облачное хранилище Backblaze", "no_connected_domains": "На данный момент подлюченных доменов нет", "loading_domain_list": "Загружаем список доменов", @@ -368,8 +368,8 @@ "modal_confirmation_dns_invalid": "Обратный DNS указывает на другой домен", "modal_confirmation_ip_valid": "IP совпадает с указанным в DNS записи", "modal_confirmation_ip_invalid": "IP не совпадает с указанным в DNS записи", - "confirm_cloudflare": "Подключение к Cloudflare", - "confirm_cloudflare_description": "Введите токен Cloudflare, который имеет права на {}:", + "confirm_cloudflare": "Подключение к DNS Провайдеру", + "confirm_cloudflare_description": "Введите токен DNS Провайдера, который имеет права на {}:", "confirm_backblaze_description": "Введите токен Backblaze, который имеет права на хранилище резервных копий:", "confirm_backblaze": "Подключение к Backblaze", "server_provider_connected": "Подключение к вашему серверному провайдеру", From 73ec2687b2c40642206a66fde233fbe3c493d326 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 15:03:31 -0300 Subject: [PATCH 08/15] fix: Make minor improvements for deSEC --- .../rest_maps/dns_providers/desec/desec.dart | 4 ++- .../initializing/dns_provider_picker.dart | 35 +++++++------------ .../recovery_server_provider_connected.dart | 4 +-- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index 0a8197dc..aea1d0da 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -352,7 +352,9 @@ class DesecApi extends DnsProviderApi { for (final DesiredDnsRecord record in desiredRecords) { if (record.description == 'record.dkim') { final DnsRecord foundRecord = records.firstWhere( - (final r) => (r.name == record.name) && r.type == record.type, + (final r) => + ('${r.name}.${domain.domainName}' == record.name) && + r.type == record.type, orElse: () => DnsRecord( name: record.name, type: record.type, diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index cb0d2111..7ee580a7 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart'; +import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/ui/components/brand_md/brand_md.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; @@ -51,7 +52,7 @@ class _DnsProviderPickerState extends State { providerType: DnsProvider.cloudflare, pathToHow: 'how_cloudflare', image: Image.asset( - 'assets/images/logos/cloudflare.png', + 'assets/images/logos/cloudflare.svg', width: 150, ), ), @@ -62,9 +63,9 @@ class _DnsProviderPickerState extends State { providerCubit: widget.formCubit, providerInfo: ProviderPageInfo( providerType: DnsProvider.desec, - pathToHow: 'how_digital_ocean_dns', + pathToHow: 'how_desec', image: Image.asset( - 'assets/images/logos/digital_ocean.png', + 'assets/images/logos/desec.svg', width: 150, ), ), @@ -100,7 +101,7 @@ class ProviderInputDataPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'initializing.connect_to_dns'.tr(), + 'initializing.cloudflare_api_token'.tr(), style: Theme.of(context).textTheme.headlineSmall, ), const SizedBox(height: 16), @@ -125,22 +126,12 @@ class ProviderInputDataPage extends StatelessWidget { const SizedBox(height: 10), BrandOutlinedButton( child: Text('initializing.how'.tr()), - onPressed: () => showModalBottomSheet( - context: context, - isScrollControlled: true, - backgroundColor: Colors.transparent, - builder: (final BuildContext context) => Padding( - padding: paddingH15V0, - child: ListView( - padding: const EdgeInsets.symmetric(vertical: 16), - children: [ - BrandMarkdown( - fileName: providerInfo.pathToHow, - ), - ], - ), - ), - ), + onPressed: () { + context.read().showArticle( + article: providerInfo.pathToHow, + context: context, + ); + }, ), ], ); @@ -186,7 +177,7 @@ class ProviderSelectionPage extends StatelessWidget { padding: const EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(40), - color: const Color.fromARGB(255, 241, 215, 166), + color: const Color.fromARGB(255, 244, 128, 31), ), child: SvgPicture.asset( 'assets/images/logos/cloudflare.svg', @@ -194,7 +185,7 @@ class ProviderSelectionPage extends StatelessWidget { ), const SizedBox(width: 16), Text( - 'Hetzner Cloud', + 'Cloudflare', style: Theme.of(context).textTheme.titleMedium, ), ], diff --git a/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart b/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart index 91999fb9..93d0eb87 100644 --- a/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart +++ b/lib/ui/pages/setup/recovering/recovery_server_provider_connected.dart @@ -45,9 +45,7 @@ class RecoveryServerProviderConnected extends StatelessWidget { ), const SizedBox(height: 16), BrandButton.filled( - onPressed: formCubitState.isSubmitting - ? null - : () => context.read().trySubmit(), + onPressed: () => context.read().trySubmit(), child: Text('basis.continue'.tr()), ), const SizedBox(height: 16), From 25eb82c131d844ee1b2a4f136d4625322dd65d07 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 15:49:03 -0300 Subject: [PATCH 09/15] feat: Implement proper access recovery for DNS providers --- lib/logic/api_maps/graphql_maps/api_map.dart | 2 +- lib/logic/api_maps/staging_options.dart | 12 +++++++++-- .../cubit/dns_records/dns_records_cubit.dart | 3 +++ .../server_installation_cubit.dart | 18 ++++++++++++----- .../server_installation_repository.dart | 20 +++++++++++-------- 5 files changed, 39 insertions(+), 16 deletions(-) diff --git a/lib/logic/api_maps/graphql_maps/api_map.dart b/lib/logic/api_maps/graphql_maps/api_map.dart index a633866e..34e39b7a 100644 --- a/lib/logic/api_maps/graphql_maps/api_map.dart +++ b/lib/logic/api_maps/graphql_maps/api_map.dart @@ -56,7 +56,7 @@ class ResponseLoggingParser extends ResponseParser { abstract class ApiMap { Future getClient() async { IOClient? ioClient; - if (StagingOptions.stagingAcme) { + if (StagingOptions.stagingAcme || !StagingOptions.verifyCertificate) { final HttpClient httpClient = HttpClient(); httpClient.badCertificateCallback = ( final cert, diff --git a/lib/logic/api_maps/staging_options.dart b/lib/logic/api_maps/staging_options.dart index 7d3084b7..a4e98fe8 100644 --- a/lib/logic/api_maps/staging_options.dart +++ b/lib/logic/api_maps/staging_options.dart @@ -1,8 +1,16 @@ -/// Controls staging environment for network, is used during manual -/// integration testing and such +/// Controls staging environment for network class StagingOptions { /// Whether we request for staging temprorary certificates. /// Hardcode to 'true' in the middle of testing to not /// get your domain banned by constant certificate renewal + /// + /// If set to 'true', the 'verifyCertificate' becomes useless static bool get stagingAcme => false; + + /// Should we consider CERTIFICATE_VERIFY_FAILED code an error + /// For now it's just a global variable and DNS API + /// classes can change it at will + /// + /// Doesn't matter if 'statingAcme' is set to 'true' + static bool verifyCertificate = false; } diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index de87910d..2e57f0f7 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -1,7 +1,10 @@ import 'package:cubit_form/cubit_form.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; +import 'package:selfprivacy/logic/get_it/api_config.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index cc5bffcc..fa0a04e1 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -541,13 +541,20 @@ class ServerInstallationCubit extends Cubit { customToken: serverDetails.apiToken, isWithToken: true, ).getServerProviderType(); - if (provider == ServerProvider.unknown) { + final dnsProvider = await ServerApi( + customToken: serverDetails.apiToken, + isWithToken: true, + ).getDnsProviderType(); + if (provider == ServerProvider.unknown || + dnsProvider == DnsProvider.unknown) { getIt() .showSnackBar('recovering.generic_error'.tr()); return; } await repository.saveServerDetails(serverDetails); + await repository.saveDnsProviderType(dnsProvider); setServerProviderType(provider); + setDnsProviderType(dnsProvider); emit( dataState.copyWith( serverDetails: serverDetails, @@ -700,14 +707,15 @@ class ServerInstallationCubit extends Cubit { .showSnackBar('recovering.domain_not_available_on_token'.tr()); return; } + final dnsProviderType = await ServerApi( + customToken: dataState.serverDetails!.apiToken, + isWithToken: true, + ).getDnsProviderType(); await repository.saveDomain( ServerDomain( domainName: serverDomain.domainName, zoneId: zoneId, - provider: await ServerApi( - customToken: token, - isWithToken: true, - ).getDnsProviderType(), + provider: dnsProviderType, ), ); await repository.saveDnsProviderKey(token); diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index ff167518..bc92f645 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -15,6 +15,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider. import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; +import 'package:selfprivacy/logic/api_maps/staging_options.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; @@ -76,17 +77,20 @@ class ServerInstallationRepository { ); } - if (dnsProvider != null || - (serverDomain != null && - serverDomain.provider != DnsProvider.unknown)) { - ApiController.initDnsProviderApiFactory( - DnsProviderApiFactorySettings( - provider: dnsProvider ?? serverDomain!.provider, - ), - ); + if (ApiController.currentDnsProviderApiFactory == null) { + if (dnsProvider != null || + (serverDomain != null && + serverDomain.provider != DnsProvider.unknown)) { + ApiController.initDnsProviderApiFactory( + DnsProviderApiFactorySettings( + provider: dnsProvider ?? serverDomain!.provider, + ), + ); + } } if (box.get(BNames.hasFinalChecked, defaultValue: false)) { + StagingOptions.verifyCertificate = true; return ServerInstallationFinished( providerApiToken: providerApiToken!, serverTypeIdentificator: serverTypeIdentificator ?? '', From 0e3e560485d434a1b742dbc0cc5e9462eeff2de6 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Tue, 16 May 2023 16:55:26 -0300 Subject: [PATCH 10/15] feat: Remove certificate check during installation --- .../rest_maps/dns_providers/desec/desec.dart | 62 ++++++++----------- .../server_providers/hetzner/hetzner.dart | 2 +- .../cubit/dns_records/dns_records_cubit.dart | 18 +++--- .../server_installation_cubit.dart | 3 + 4 files changed, 38 insertions(+), 47 deletions(-) diff --git a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart index aea1d0da..c1a8f43b 100644 --- a/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart +++ b/lib/logic/api_maps/rest_maps/dns_providers/desec/desec.dart @@ -111,20 +111,22 @@ class DesecApi extends DnsProviderApi { final List bulkRecords = []; for (final DnsRecord record in listDnsRecords) { bulkRecords.add( - record.name == null - ? { - 'type': record.type, - 'ttl': record.ttl, - 'records': [], - } - : { - 'subname': record.name, - 'type': record.type, - 'ttl': record.ttl, - 'records': [], - }, + { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [], + }, ); } + bulkRecords.add( + { + 'subname': 'selector._domainkey', + 'type': 'TXT', + 'ttl': 18000, + 'records': [], + }, + ); await client.put(url, data: bulkRecords); await Future.delayed(const Duration(seconds: 1)); } catch (e) { @@ -192,18 +194,12 @@ class DesecApi extends DnsProviderApi { final List bulkRecords = []; for (final DnsRecord record in listDnsRecords) { bulkRecords.add( - record.name == null - ? { - 'type': record.type, - 'ttl': record.ttl, - 'records': [extractContent(record)], - } - : { - 'subname': record.name, - 'type': record.type, - 'ttl': record.ttl, - 'records': [extractContent(record)], - }, + { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [extractContent(record)], + }, ); } await client.post( @@ -295,18 +291,12 @@ class DesecApi extends DnsProviderApi { try { await client.post( url, - data: record.name == null - ? { - 'type': record.type, - 'ttl': record.ttl, - 'records': [extractContent(record)], - } - : { - 'subname': record.name, - 'type': record.type, - 'ttl': record.ttl, - 'records': [extractContent(record)], - }, + data: { + 'subname': record.name, + 'type': record.type, + 'ttl': record.ttl, + 'records': [extractContent(record)], + }, ); await Future.delayed(const Duration(seconds: 1)); } catch (e) { diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart index f9a2104e..c2228030 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner.dart @@ -394,7 +394,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi { final String apiToken = StringGenerators.apiToken(); final String hostname = getHostnameFromDomain(domainName); - const String infectBranch = 'testing/desec'; + const String infectBranch = 'providers/hetzner'; final String stagingAcme = StagingOptions.stagingAcme ? 'true' : 'false'; final String base64Password = base64.encode(utf8.encode(rootUser.password ?? 'PASS')); diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 2e57f0f7..472ed954 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -1,10 +1,7 @@ import 'package:cubit_form/cubit_form.dart'; -import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart'; -import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; -import 'package:selfprivacy/logic/get_it/api_config.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/json/dns_records.dart'; @@ -28,13 +25,14 @@ class DnsRecordsCubit emit( DnsRecordsState( dnsState: DnsRecordsStatus.refreshing, - dnsRecords: ApiController.currentDnsProviderApiFactory! - .getDnsProvider() - .getDesiredDnsRecords( - serverInstallationCubit.state.serverDomain?.domainName, - '', - '', - ), + dnsRecords: ApiController.currentDnsProviderApiFactory + ?.getDnsProvider() + .getDesiredDnsRecords( + serverInstallationCubit.state.serverDomain?.domainName, + '', + '', + ) ?? + [], ), ); diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index fa0a04e1..47952c9a 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -10,6 +10,7 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_api_settings.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart'; +import 'package:selfprivacy/logic/api_maps/staging_options.dart'; import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; @@ -436,6 +437,7 @@ class ServerInstallationCubit extends Cubit { emit(TimerState(dataState: dataState, isLoading: true)); final bool isServerWorking = await repository.isHttpServerWorking(); + StagingOptions.verifyCertificate = true; if (isServerWorking) { bool dkimCreated = true; @@ -758,6 +760,7 @@ class ServerInstallationCubit extends Cubit { void clearAppConfig() { closeTimer(); ApiController.clearProviderApiFactories(); + StagingOptions.verifyCertificate = false; repository.clearAppConfig(); emit(const ServerInstallationEmpty()); } From 0c038fda43fcb7daf5b74baa2e899706e1324bad Mon Sep 17 00:00:00 2001 From: NaiJi Date: Thu, 18 May 2023 19:06:13 -0300 Subject: [PATCH 11/15] fix: Remove price lists for DNS and move deSEC onto above Cloudflare --- .../initializing/dns_provider_picker.dart | 133 ++++++++---------- 1 file changed, 56 insertions(+), 77 deletions(-) diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index 7ee580a7..7e494af4 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -2,12 +2,10 @@ import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart'; import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -import 'package:selfprivacy/ui/components/brand_md/brand_md.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; import 'package:selfprivacy/ui/components/buttons/outlined_button.dart'; import 'package:selfprivacy/ui/components/cards/outlined_card.dart'; @@ -163,72 +161,6 @@ class ProviderSelectionPage extends StatelessWidget { style: Theme.of(context).textTheme.bodyMedium, ), const SizedBox(height: 10), - OutlinedCard( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - width: 40, - height: 40, - padding: const EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: const Color.fromARGB(255, 244, 128, 31), - ), - child: SvgPicture.asset( - 'assets/images/logos/cloudflare.svg', - ), - ), - const SizedBox(width: 16), - Text( - 'Cloudflare', - style: Theme.of(context).textTheme.titleMedium, - ), - ], - ), - const SizedBox(height: 16), - Text( - 'initializing.select_provider_price_title'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - Text( - 'initializing.select_provider_price_free'.tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), - Text( - 'initializing.select_provider_payment_title'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - Text( - 'initializing.select_provider_payment_text_cloudflare' - .tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), - BrandButton.rised( - text: 'basis.select'.tr(), - onPressed: () { - serverInstallationCubit - .setDnsProviderType(DnsProvider.cloudflare); - callback(DnsProvider.cloudflare); - }, - ), - // Outlined button that will open website - BrandOutlinedButton( - onPressed: () => - launchURL('https://dash.cloudflare.com/'), - title: 'initializing.select_provider_site_button'.tr(), - ), - ], - ), - ), - ), - const SizedBox(height: 16), OutlinedCard( child: Padding( padding: const EdgeInsets.all(16.0), @@ -266,15 +198,6 @@ class ProviderSelectionPage extends StatelessWidget { style: Theme.of(context).textTheme.bodySmall, ), const SizedBox(height: 16), - Text( - 'initializing.select_provider_payment_title'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - Text( - 'initializing.select_provider_payment_text_do'.tr(), - style: Theme.of(context).textTheme.bodySmall, - ), - const SizedBox(height: 16), BrandButton.rised( text: 'basis.select'.tr(), onPressed: () { @@ -292,6 +215,62 @@ class ProviderSelectionPage extends StatelessWidget { ), ), ), + const SizedBox(height: 16), + OutlinedCard( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 40, + height: 40, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(40), + color: const Color.fromARGB(255, 244, 128, 31), + ), + child: SvgPicture.asset( + 'assets/images/logos/cloudflare.svg', + ), + ), + const SizedBox(width: 16), + Text( + 'Cloudflare', + style: Theme.of(context).textTheme.titleMedium, + ), + ], + ), + const SizedBox(height: 16), + Text( + 'initializing.select_provider_price_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + Text( + 'initializing.select_provider_price_free'.tr(), + style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 16), + BrandButton.rised( + text: 'basis.select'.tr(), + onPressed: () { + serverInstallationCubit + .setDnsProviderType(DnsProvider.cloudflare); + callback(DnsProvider.cloudflare); + }, + ), + // Outlined button that will open website + BrandOutlinedButton( + onPressed: () => + launchURL('https://dash.cloudflare.com/'), + title: 'initializing.select_provider_site_button'.tr(), + ), + ], + ), + ), + ), ], ), ); From 523a1a6df8639edf5a1fb370df9803b0cc4cea3d Mon Sep 17 00:00:00 2001 From: def Date: Fri, 19 May 2023 12:53:53 +0300 Subject: [PATCH 12/15] update desec markdown --- assets/markdown/how_desec-en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/markdown/how_desec-en.md b/assets/markdown/how_desec-en.md index c86d3855..b5bac67c 100644 --- a/assets/markdown/how_desec-en.md +++ b/assets/markdown/how_desec-en.md @@ -5,5 +5,5 @@ 4. Click on the round "plus" button in the upper right corner. 5. **"Generate New Token"** dialogue must be displayed. Enter any **Token name** you wish. *Advanced settings* are not required, so do not touch anything there. 6. Click on **Save**. -7. Make sure you **save** the token's **secret value** as it will only be displayed once. +7. Make sure you save the token's "**secret value**" as it will only be displayed once. 8. Now you can safely **close** the dialogue. \ No newline at end of file From 4e65d5f945a0589fb894d2f56fdc70832b99ba03 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Tue, 30 May 2023 20:25:46 +0300 Subject: [PATCH 13/15] refactor: Migrate to Flutter 3.10 and Dart 3.0 --- android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../schema/disk_volumes.graphql.dart | 377 ++++++++-- .../graphql_maps/schema/schema.graphql.dart | 22 +- .../schema/server_api.graphql.dart | 693 +++++++++++++----- .../schema/server_settings.graphql.dart | 389 ++++++++-- .../graphql_maps/schema/services.graphql.dart | 374 +++++++--- .../graphql_maps/schema/users.graphql.dart | 387 ++++++++-- lib/logic/api_maps/rest_maps/api_map.dart | 4 +- lib/main.dart | 17 +- .../components/list_tiles/log_list_tile.dart | 52 +- .../setup/initializing/initializing.dart | 1 - lib/ui/router/router.dart | 3 +- lib/ui/router/router.gr.dart | 517 ++++++------- macos/Flutter/GeneratedPluginRegistrant.swift | 2 - pubspec.lock | 320 ++++---- pubspec.yaml | 59 +- 17 files changed, 2248 insertions(+), 973 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index bf7e09c6..13645686 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -39,6 +39,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index cc5527d7..02e5f581 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip diff --git a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart index 9ffbfe0b..84550cc2 100644 --- a/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/disk_volumes.graphql.dart @@ -3,7 +3,6 @@ import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; -import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ @@ -142,6 +141,177 @@ extension UtilityExtension$Fragment$basicMutationReturnFields this, (i) => i, ); + _T when<_T>({ + required _T Function( + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + apiKeyMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + autoUpgradeSettingsMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) + deviceApiTokenMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$GenericJobButationReturn) + genericJobButationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$GenericMutationReturn) + genericMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) + serviceJobMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$ServiceMutationReturn) + serviceMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn) + timezoneMutationReturn, + required _T Function(Fragment$basicMutationReturnFields$$UserMutationReturn) + userMutationReturn, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ApiKeyMutationReturn": + return apiKeyMutationReturn( + this as Fragment$basicMutationReturnFields$$ApiKeyMutationReturn); + + case "AutoUpgradeSettingsMutationReturn": + return autoUpgradeSettingsMutationReturn(this + as Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn); + + case "DeviceApiTokenMutationReturn": + return deviceApiTokenMutationReturn(this + as Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn); + + case "GenericJobButationReturn": + return genericJobButationReturn(this + as Fragment$basicMutationReturnFields$$GenericJobButationReturn); + + case "GenericMutationReturn": + return genericMutationReturn( + this as Fragment$basicMutationReturnFields$$GenericMutationReturn); + + case "ServiceJobMutationReturn": + return serviceJobMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceJobMutationReturn); + + case "ServiceMutationReturn": + return serviceMutationReturn( + this as Fragment$basicMutationReturnFields$$ServiceMutationReturn); + + case "TimezoneMutationReturn": + return timezoneMutationReturn( + this as Fragment$basicMutationReturnFields$$TimezoneMutationReturn); + + case "UserMutationReturn": + return userMutationReturn( + this as Fragment$basicMutationReturnFields$$UserMutationReturn); + + default: + return orElse(); + } + } + + _T maybeWhen<_T>({ + _T Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn)? + apiKeyMutationReturn, + _T Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn)? + autoUpgradeSettingsMutationReturn, + _T Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn)? + deviceApiTokenMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$GenericJobButationReturn)? + genericJobButationReturn, + _T Function(Fragment$basicMutationReturnFields$$GenericMutationReturn)? + genericMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn)? + serviceJobMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn)? + serviceMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$TimezoneMutationReturn)? + timezoneMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$UserMutationReturn)? + userMutationReturn, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ApiKeyMutationReturn": + if (apiKeyMutationReturn != null) { + return apiKeyMutationReturn( + this as Fragment$basicMutationReturnFields$$ApiKeyMutationReturn); + } else { + return orElse(); + } + + case "AutoUpgradeSettingsMutationReturn": + if (autoUpgradeSettingsMutationReturn != null) { + return autoUpgradeSettingsMutationReturn(this + as Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn); + } else { + return orElse(); + } + + case "DeviceApiTokenMutationReturn": + if (deviceApiTokenMutationReturn != null) { + return deviceApiTokenMutationReturn(this + as Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn); + } else { + return orElse(); + } + + case "GenericJobButationReturn": + if (genericJobButationReturn != null) { + return genericJobButationReturn(this + as Fragment$basicMutationReturnFields$$GenericJobButationReturn); + } else { + return orElse(); + } + + case "GenericMutationReturn": + if (genericMutationReturn != null) { + return genericMutationReturn(this + as Fragment$basicMutationReturnFields$$GenericMutationReturn); + } else { + return orElse(); + } + + case "ServiceJobMutationReturn": + if (serviceJobMutationReturn != null) { + return serviceJobMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceJobMutationReturn); + } else { + return orElse(); + } + + case "ServiceMutationReturn": + if (serviceMutationReturn != null) { + return serviceMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceMutationReturn); + } else { + return orElse(); + } + + case "TimezoneMutationReturn": + if (timezoneMutationReturn != null) { + return timezoneMutationReturn(this + as Fragment$basicMutationReturnFields$$TimezoneMutationReturn); + } else { + return orElse(); + } + + case "UserMutationReturn": + if (userMutationReturn != null) { + return userMutationReturn( + this as Fragment$basicMutationReturnFields$$UserMutationReturn); + } else { + return orElse(); + } + + default: + return orElse(); + } + } } abstract class CopyWith$Fragment$basicMutationReturnFields { @@ -172,7 +342,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields final TRes Function(Fragment$basicMutationReturnFields) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -298,7 +468,7 @@ class Fragment$basicMutationReturnFields$$ApiKeyMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ApiKeyMutationReturn', }); factory Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.fromJson( @@ -429,7 +599,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -477,7 +647,7 @@ class Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'AutoUpgradeSettingsMutationReturn', }); factory Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.fromJson( @@ -613,7 +783,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutat Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -662,7 +832,7 @@ class Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'DeviceApiTokenMutationReturn', }); factory Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.fromJson( @@ -796,7 +966,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationRe final TRes Function( Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -844,7 +1014,7 @@ class Fragment$basicMutationReturnFields$$GenericJobButationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericJobButationReturn', }); factory Fragment$basicMutationReturnFields$$GenericJobButationReturn.fromJson( @@ -976,7 +1146,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn final TRes Function( Fragment$basicMutationReturnFields$$GenericJobButationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1024,7 +1194,7 @@ class Fragment$basicMutationReturnFields$$GenericMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Fragment$basicMutationReturnFields$$GenericMutationReturn.fromJson( @@ -1155,7 +1325,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1203,7 +1373,7 @@ class Fragment$basicMutationReturnFields$$ServiceJobMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceJobMutationReturn', }); factory Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.fromJson( @@ -1335,7 +1505,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn final TRes Function( Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1383,7 +1553,7 @@ class Fragment$basicMutationReturnFields$$ServiceMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceMutationReturn', }); factory Fragment$basicMutationReturnFields$$ServiceMutationReturn.fromJson( @@ -1514,7 +1684,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1562,7 +1732,7 @@ class Fragment$basicMutationReturnFields$$TimezoneMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'TimezoneMutationReturn', }); factory Fragment$basicMutationReturnFields$$TimezoneMutationReturn.fromJson( @@ -1694,7 +1864,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< final TRes Function( Fragment$basicMutationReturnFields$$TimezoneMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1742,7 +1912,7 @@ class Fragment$basicMutationReturnFields$$UserMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'UserMutationReturn', }); factory Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( @@ -1870,7 +2040,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn final TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1914,7 +2084,7 @@ class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn< class Query$GetServerDiskVolumes { Query$GetServerDiskVolumes({ required this.storage, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$GetServerDiskVolumes.fromJson(Map json) { @@ -2009,7 +2179,7 @@ class _CopyWithImpl$Query$GetServerDiskVolumes final TRes Function(Query$GetServerDiskVolumes) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? storage = _undefined, @@ -2233,6 +2403,10 @@ const documentNodeQueryGetServerDiskVolumes = DocumentNode(definitions: [ Query$GetServerDiskVolumes _parserFn$Query$GetServerDiskVolumes( Map data) => Query$GetServerDiskVolumes.fromJson(data); +typedef OnQueryComplete$Query$GetServerDiskVolumes = FutureOr Function( + Map?, + Query$GetServerDiskVolumes?, +); class Options$Query$GetServerDiskVolumes extends graphql.QueryOptions { @@ -2242,19 +2416,42 @@ class Options$Query$GetServerDiskVolumes graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$GetServerDiskVolumes? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$GetServerDiskVolumes? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null + ? null + : _parserFn$Query$GetServerDiskVolumes(data), + ), + onError: onError, document: documentNodeQueryGetServerDiskVolumes, parserFn: _parserFn$Query$GetServerDiskVolumes, ); + + final OnQueryComplete$Query$GetServerDiskVolumes? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$GetServerDiskVolumes @@ -2265,6 +2462,7 @@ class WatchOptions$Query$GetServerDiskVolumes graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$GetServerDiskVolumes? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -2275,7 +2473,7 @@ class WatchOptions$Query$GetServerDiskVolumes fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQueryGetServerDiskVolumes, pollInterval: pollInterval, @@ -2331,7 +2529,7 @@ extension ClientExtension$Query$GetServerDiskVolumes on graphql.GraphQLClient { class Query$GetServerDiskVolumes$storage { Query$GetServerDiskVolumes$storage({ required this.volumes, - required this.$__typename, + this.$__typename = 'Storage', }); factory Query$GetServerDiskVolumes$storage.fromJson( @@ -2442,7 +2640,7 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage final TRes Function(Query$GetServerDiskVolumes$storage) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? volumes = _undefined, @@ -2495,7 +2693,7 @@ class Query$GetServerDiskVolumes$storage$volumes { required this.type, required this.usages, required this.usedSpace, - required this.$__typename, + this.$__typename = 'StorageVolume', }); factory Query$GetServerDiskVolumes$storage$volumes.fromJson( @@ -2719,7 +2917,7 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes final TRes Function(Query$GetServerDiskVolumes$storage$volumes) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? freeSpace = _undefined, @@ -2890,6 +3088,41 @@ extension UtilityExtension$Query$GetServerDiskVolumes$storage$volumes$usages this, (i) => i, ); + _T when<_T>({ + required _T Function( + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage) + serviceStorageUsage, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ServiceStorageUsage": + return serviceStorageUsage(this + as Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage); + + default: + return orElse(); + } + } + + _T maybeWhen<_T>({ + _T Function( + Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage)? + serviceStorageUsage, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ServiceStorageUsage": + if (serviceStorageUsage != null) { + return serviceStorageUsage(this + as Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage); + } else { + return orElse(); + } + + default: + return orElse(); + } + } } abstract class CopyWith$Query$GetServerDiskVolumes$storage$volumes$usages< @@ -2922,7 +3155,7 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages final TRes Function(Query$GetServerDiskVolumes$storage$volumes$usages) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? title = _undefined, @@ -2962,7 +3195,7 @@ class Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage implements Query$GetServerDiskVolumes$storage$volumes$usages { Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage({ this.service, - required this.$__typename, + this.$__typename = 'ServiceStorageUsage', required this.title, required this.usedSpace, }); @@ -3107,7 +3340,7 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceSt Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? service = _undefined, @@ -3172,7 +3405,7 @@ class Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$ser required this.id, required this.isMovable, required this.displayName, - required this.$__typename, + this.$__typename = 'Service', }); factory Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service.fromJson( @@ -3308,7 +3541,7 @@ class _CopyWithImpl$Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceSt Query$GetServerDiskVolumes$storage$volumes$usages$$ServiceStorageUsage$service) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? id = _undefined, @@ -3427,7 +3660,7 @@ class _CopyWithImpl$Variables$Mutation$MountVolume final TRes Function(Variables$Mutation$MountVolume) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? name = _undefined}) => _then(Variables$Mutation$MountVolume._({ @@ -3448,7 +3681,7 @@ class _CopyWithStubImpl$Variables$Mutation$MountVolume class Mutation$MountVolume { Mutation$MountVolume({ required this.mountVolume, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$MountVolume.fromJson(Map json) { @@ -3541,7 +3774,7 @@ class _CopyWithImpl$Mutation$MountVolume final TRes Function(Mutation$MountVolume) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? mountVolume = _undefined, @@ -3633,7 +3866,7 @@ Mutation$MountVolume _parserFn$Mutation$MountVolume( Map data) => Mutation$MountVolume.fromJson(data); typedef OnMutationCompleted$Mutation$MountVolume = FutureOr Function( - dynamic, + Map?, Mutation$MountVolume?, ); @@ -3646,6 +3879,7 @@ class Options$Mutation$MountVolume graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$MountVolume? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$MountVolume? onCompleted, graphql.OnMutationUpdate? update, @@ -3657,7 +3891,7 @@ class Options$Mutation$MountVolume fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -3691,6 +3925,7 @@ class WatchOptions$Mutation$MountVolume graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$MountVolume? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -3702,7 +3937,7 @@ class WatchOptions$Mutation$MountVolume fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationMountVolume, pollInterval: pollInterval, @@ -3728,7 +3963,7 @@ class Mutation$MountVolume$mountVolume required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$MountVolume$mountVolume.fromJson(Map json) { @@ -3849,7 +4084,7 @@ class _CopyWithImpl$Mutation$MountVolume$mountVolume final TRes Function(Mutation$MountVolume$mountVolume) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -3964,7 +4199,7 @@ class _CopyWithImpl$Variables$Mutation$ResizeVolume final TRes Function(Variables$Mutation$ResizeVolume) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? name = _undefined}) => _then(Variables$Mutation$ResizeVolume._({ @@ -3985,7 +4220,7 @@ class _CopyWithStubImpl$Variables$Mutation$ResizeVolume class Mutation$ResizeVolume { Mutation$ResizeVolume({ required this.resizeVolume, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$ResizeVolume.fromJson(Map json) { @@ -4078,7 +4313,7 @@ class _CopyWithImpl$Mutation$ResizeVolume final TRes Function(Mutation$ResizeVolume) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? resizeVolume = _undefined, @@ -4170,7 +4405,7 @@ Mutation$ResizeVolume _parserFn$Mutation$ResizeVolume( Map data) => Mutation$ResizeVolume.fromJson(data); typedef OnMutationCompleted$Mutation$ResizeVolume = FutureOr Function( - dynamic, + Map?, Mutation$ResizeVolume?, ); @@ -4183,6 +4418,7 @@ class Options$Mutation$ResizeVolume graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$ResizeVolume? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$ResizeVolume? onCompleted, graphql.OnMutationUpdate? update, @@ -4194,7 +4430,7 @@ class Options$Mutation$ResizeVolume fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -4228,6 +4464,7 @@ class WatchOptions$Mutation$ResizeVolume graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$ResizeVolume? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -4239,7 +4476,7 @@ class WatchOptions$Mutation$ResizeVolume fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationResizeVolume, pollInterval: pollInterval, @@ -4265,7 +4502,7 @@ class Mutation$ResizeVolume$resizeVolume required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$ResizeVolume$resizeVolume.fromJson( @@ -4388,7 +4625,7 @@ class _CopyWithImpl$Mutation$ResizeVolume$resizeVolume final TRes Function(Mutation$ResizeVolume$resizeVolume) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -4503,7 +4740,7 @@ class _CopyWithImpl$Variables$Mutation$UnmountVolume final TRes Function(Variables$Mutation$UnmountVolume) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? name = _undefined}) => _then(Variables$Mutation$UnmountVolume._({ @@ -4524,7 +4761,7 @@ class _CopyWithStubImpl$Variables$Mutation$UnmountVolume class Mutation$UnmountVolume { Mutation$UnmountVolume({ required this.unmountVolume, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$UnmountVolume.fromJson(Map json) { @@ -4618,7 +4855,7 @@ class _CopyWithImpl$Mutation$UnmountVolume final TRes Function(Mutation$UnmountVolume) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? unmountVolume = _undefined, @@ -4710,7 +4947,7 @@ Mutation$UnmountVolume _parserFn$Mutation$UnmountVolume( Map data) => Mutation$UnmountVolume.fromJson(data); typedef OnMutationCompleted$Mutation$UnmountVolume = FutureOr Function( - dynamic, + Map?, Mutation$UnmountVolume?, ); @@ -4723,6 +4960,7 @@ class Options$Mutation$UnmountVolume graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$UnmountVolume? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$UnmountVolume? onCompleted, graphql.OnMutationUpdate? update, @@ -4734,7 +4972,7 @@ class Options$Mutation$UnmountVolume fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -4770,6 +5008,7 @@ class WatchOptions$Mutation$UnmountVolume graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$UnmountVolume? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -4781,7 +5020,7 @@ class WatchOptions$Mutation$UnmountVolume fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationUnmountVolume, pollInterval: pollInterval, @@ -4807,7 +5046,7 @@ class Mutation$UnmountVolume$unmountVolume required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$UnmountVolume$unmountVolume.fromJson( @@ -4930,7 +5169,7 @@ class _CopyWithImpl$Mutation$UnmountVolume$unmountVolume final TRes Function(Mutation$UnmountVolume$unmountVolume) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -5049,7 +5288,7 @@ class _CopyWithImpl$Variables$Mutation$MigrateToBinds final TRes Function(Variables$Mutation$MigrateToBinds) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? input = _undefined}) => _then(Variables$Mutation$MigrateToBinds._({ @@ -5071,7 +5310,7 @@ class _CopyWithStubImpl$Variables$Mutation$MigrateToBinds class Mutation$MigrateToBinds { Mutation$MigrateToBinds({ required this.migrateToBinds, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$MigrateToBinds.fromJson(Map json) { @@ -5165,7 +5404,7 @@ class _CopyWithImpl$Mutation$MigrateToBinds final TRes Function(Mutation$MigrateToBinds) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? migrateToBinds = _undefined, @@ -5349,7 +5588,7 @@ Mutation$MigrateToBinds _parserFn$Mutation$MigrateToBinds( Map data) => Mutation$MigrateToBinds.fromJson(data); typedef OnMutationCompleted$Mutation$MigrateToBinds = FutureOr Function( - dynamic, + Map?, Mutation$MigrateToBinds?, ); @@ -5362,6 +5601,7 @@ class Options$Mutation$MigrateToBinds graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$MigrateToBinds? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$MigrateToBinds? onCompleted, graphql.OnMutationUpdate? update, @@ -5373,7 +5613,7 @@ class Options$Mutation$MigrateToBinds fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -5409,6 +5649,7 @@ class WatchOptions$Mutation$MigrateToBinds graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$MigrateToBinds? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -5420,7 +5661,7 @@ class WatchOptions$Mutation$MigrateToBinds fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationMigrateToBinds, pollInterval: pollInterval, @@ -5446,7 +5687,7 @@ class Mutation$MigrateToBinds$migrateToBinds required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericJobButationReturn', this.job, }); @@ -5588,7 +5829,7 @@ class _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds final TRes Function(Mutation$MigrateToBinds$migrateToBinds) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -5654,7 +5895,7 @@ class Mutation$MigrateToBinds$migrateToBinds$job { this.statusText, required this.uid, required this.updatedAt, - required this.$__typename, + this.$__typename = 'ApiJob', }); factory Mutation$MigrateToBinds$migrateToBinds$job.fromJson( @@ -5890,7 +6131,7 @@ class _CopyWithImpl$Mutation$MigrateToBinds$migrateToBinds$job final TRes Function(Mutation$MigrateToBinds$migrateToBinds$job) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? createdAt = _undefined, diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart index 8548e4dd..9325f5cb 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart @@ -116,7 +116,7 @@ class _CopyWithImpl$Input$AutoUpgradeSettingsInput final TRes Function(Input$AutoUpgradeSettingsInput) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? enableAutoUpgrade = _undefined, @@ -286,7 +286,7 @@ class _CopyWithImpl$Input$MigrateToBindsInput final TRes Function(Input$MigrateToBindsInput) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? emailBlockDevice = _undefined, @@ -424,7 +424,7 @@ class _CopyWithImpl$Input$MoveServiceInput final TRes Function(Input$MoveServiceInput) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? serviceId = _undefined, @@ -567,7 +567,7 @@ class _CopyWithImpl$Input$RecoveryKeyLimitsInput final TRes Function(Input$RecoveryKeyLimitsInput) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? expirationDate = _undefined, @@ -692,7 +692,7 @@ class _CopyWithImpl$Input$SshMutationInput final TRes Function(Input$SshMutationInput) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? username = _undefined, @@ -818,7 +818,7 @@ class _CopyWithImpl$Input$UseNewDeviceKeyInput final TRes Function(Input$UseNewDeviceKeyInput) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? key = _undefined, @@ -943,7 +943,7 @@ class _CopyWithImpl$Input$UseRecoveryKeyInput final TRes Function(Input$UseRecoveryKeyInput) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? key = _undefined, @@ -1068,7 +1068,7 @@ class _CopyWithImpl$Input$UserMutationInput final TRes Function(Input$UserMutationInput) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? username = _undefined, @@ -1268,7 +1268,7 @@ class Fragment$dnsRecordFields { this.priority, required this.recordType, required this.ttl, - required this.$__typename, + this.$__typename = 'DnsRecord', }); factory Fragment$dnsRecordFields.fromJson(Map json) { @@ -1417,7 +1417,7 @@ class _CopyWithImpl$Fragment$dnsRecordFields final TRes Function(Fragment$dnsRecordFields) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? content = _undefined, @@ -1555,7 +1555,7 @@ extension ClientExtension$Fragment$dnsRecordFields on graphql.GraphQLClient { } } -const possibleTypesMap = { +const possibleTypesMap = >{ 'MutationReturnInterface': { 'ApiKeyMutationReturn', 'AutoUpgradeSettingsMutationReturn', diff --git a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart index 4eda2c92..f41e841f 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_api.graphql.dart @@ -1,9 +1,9 @@ import 'dart:async'; +import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:selfprivacy/utils/scalars.dart'; import 'schema.graphql.dart'; -import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ @@ -142,6 +142,177 @@ extension UtilityExtension$Fragment$basicMutationReturnFields this, (i) => i, ); + _T when<_T>({ + required _T Function( + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + apiKeyMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + autoUpgradeSettingsMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) + deviceApiTokenMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$GenericJobButationReturn) + genericJobButationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$GenericMutationReturn) + genericMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) + serviceJobMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$ServiceMutationReturn) + serviceMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn) + timezoneMutationReturn, + required _T Function(Fragment$basicMutationReturnFields$$UserMutationReturn) + userMutationReturn, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ApiKeyMutationReturn": + return apiKeyMutationReturn( + this as Fragment$basicMutationReturnFields$$ApiKeyMutationReturn); + + case "AutoUpgradeSettingsMutationReturn": + return autoUpgradeSettingsMutationReturn(this + as Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn); + + case "DeviceApiTokenMutationReturn": + return deviceApiTokenMutationReturn(this + as Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn); + + case "GenericJobButationReturn": + return genericJobButationReturn(this + as Fragment$basicMutationReturnFields$$GenericJobButationReturn); + + case "GenericMutationReturn": + return genericMutationReturn( + this as Fragment$basicMutationReturnFields$$GenericMutationReturn); + + case "ServiceJobMutationReturn": + return serviceJobMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceJobMutationReturn); + + case "ServiceMutationReturn": + return serviceMutationReturn( + this as Fragment$basicMutationReturnFields$$ServiceMutationReturn); + + case "TimezoneMutationReturn": + return timezoneMutationReturn( + this as Fragment$basicMutationReturnFields$$TimezoneMutationReturn); + + case "UserMutationReturn": + return userMutationReturn( + this as Fragment$basicMutationReturnFields$$UserMutationReturn); + + default: + return orElse(); + } + } + + _T maybeWhen<_T>({ + _T Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn)? + apiKeyMutationReturn, + _T Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn)? + autoUpgradeSettingsMutationReturn, + _T Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn)? + deviceApiTokenMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$GenericJobButationReturn)? + genericJobButationReturn, + _T Function(Fragment$basicMutationReturnFields$$GenericMutationReturn)? + genericMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn)? + serviceJobMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn)? + serviceMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$TimezoneMutationReturn)? + timezoneMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$UserMutationReturn)? + userMutationReturn, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ApiKeyMutationReturn": + if (apiKeyMutationReturn != null) { + return apiKeyMutationReturn( + this as Fragment$basicMutationReturnFields$$ApiKeyMutationReturn); + } else { + return orElse(); + } + + case "AutoUpgradeSettingsMutationReturn": + if (autoUpgradeSettingsMutationReturn != null) { + return autoUpgradeSettingsMutationReturn(this + as Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn); + } else { + return orElse(); + } + + case "DeviceApiTokenMutationReturn": + if (deviceApiTokenMutationReturn != null) { + return deviceApiTokenMutationReturn(this + as Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn); + } else { + return orElse(); + } + + case "GenericJobButationReturn": + if (genericJobButationReturn != null) { + return genericJobButationReturn(this + as Fragment$basicMutationReturnFields$$GenericJobButationReturn); + } else { + return orElse(); + } + + case "GenericMutationReturn": + if (genericMutationReturn != null) { + return genericMutationReturn(this + as Fragment$basicMutationReturnFields$$GenericMutationReturn); + } else { + return orElse(); + } + + case "ServiceJobMutationReturn": + if (serviceJobMutationReturn != null) { + return serviceJobMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceJobMutationReturn); + } else { + return orElse(); + } + + case "ServiceMutationReturn": + if (serviceMutationReturn != null) { + return serviceMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceMutationReturn); + } else { + return orElse(); + } + + case "TimezoneMutationReturn": + if (timezoneMutationReturn != null) { + return timezoneMutationReturn(this + as Fragment$basicMutationReturnFields$$TimezoneMutationReturn); + } else { + return orElse(); + } + + case "UserMutationReturn": + if (userMutationReturn != null) { + return userMutationReturn( + this as Fragment$basicMutationReturnFields$$UserMutationReturn); + } else { + return orElse(); + } + + default: + return orElse(); + } + } } abstract class CopyWith$Fragment$basicMutationReturnFields { @@ -172,7 +343,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields final TRes Function(Fragment$basicMutationReturnFields) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -298,7 +469,7 @@ class Fragment$basicMutationReturnFields$$ApiKeyMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ApiKeyMutationReturn', }); factory Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.fromJson( @@ -429,7 +600,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -477,7 +648,7 @@ class Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'AutoUpgradeSettingsMutationReturn', }); factory Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.fromJson( @@ -613,7 +784,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutat Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -662,7 +833,7 @@ class Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'DeviceApiTokenMutationReturn', }); factory Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.fromJson( @@ -796,7 +967,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationRe final TRes Function( Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -844,7 +1015,7 @@ class Fragment$basicMutationReturnFields$$GenericJobButationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericJobButationReturn', }); factory Fragment$basicMutationReturnFields$$GenericJobButationReturn.fromJson( @@ -976,7 +1147,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn final TRes Function( Fragment$basicMutationReturnFields$$GenericJobButationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1024,7 +1195,7 @@ class Fragment$basicMutationReturnFields$$GenericMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Fragment$basicMutationReturnFields$$GenericMutationReturn.fromJson( @@ -1155,7 +1326,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1203,7 +1374,7 @@ class Fragment$basicMutationReturnFields$$ServiceJobMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceJobMutationReturn', }); factory Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.fromJson( @@ -1335,7 +1506,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn final TRes Function( Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1383,7 +1554,7 @@ class Fragment$basicMutationReturnFields$$ServiceMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceMutationReturn', }); factory Fragment$basicMutationReturnFields$$ServiceMutationReturn.fromJson( @@ -1514,7 +1685,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1562,7 +1733,7 @@ class Fragment$basicMutationReturnFields$$TimezoneMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'TimezoneMutationReturn', }); factory Fragment$basicMutationReturnFields$$TimezoneMutationReturn.fromJson( @@ -1694,7 +1865,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< final TRes Function( Fragment$basicMutationReturnFields$$TimezoneMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1742,7 +1913,7 @@ class Fragment$basicMutationReturnFields$$UserMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'UserMutationReturn', }); factory Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( @@ -1870,7 +2041,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn final TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1914,7 +2085,7 @@ class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn< class Query$GetApiVersion { Query$GetApiVersion({ required this.api, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$GetApiVersion.fromJson(Map json) { @@ -2006,7 +2177,7 @@ class _CopyWithImpl$Query$GetApiVersion final TRes Function(Query$GetApiVersion) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? api = _undefined, @@ -2082,6 +2253,10 @@ const documentNodeQueryGetApiVersion = DocumentNode(definitions: [ ]); Query$GetApiVersion _parserFn$Query$GetApiVersion(Map data) => Query$GetApiVersion.fromJson(data); +typedef OnQueryComplete$Query$GetApiVersion = FutureOr Function( + Map?, + Query$GetApiVersion?, +); class Options$Query$GetApiVersion extends graphql.QueryOptions { @@ -2091,19 +2266,40 @@ class Options$Query$GetApiVersion graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$GetApiVersion? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$GetApiVersion? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null ? null : _parserFn$Query$GetApiVersion(data), + ), + onError: onError, document: documentNodeQueryGetApiVersion, parserFn: _parserFn$Query$GetApiVersion, ); + + final OnQueryComplete$Query$GetApiVersion? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$GetApiVersion @@ -2114,6 +2310,7 @@ class WatchOptions$Query$GetApiVersion graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$GetApiVersion? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -2124,7 +2321,7 @@ class WatchOptions$Query$GetApiVersion fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQueryGetApiVersion, pollInterval: pollInterval, @@ -2176,7 +2373,7 @@ extension ClientExtension$Query$GetApiVersion on graphql.GraphQLClient { class Query$GetApiVersion$api { Query$GetApiVersion$api({ required this.version, - required this.$__typename, + this.$__typename = 'Api', }); factory Query$GetApiVersion$api.fromJson(Map json) { @@ -2268,7 +2465,7 @@ class _CopyWithImpl$Query$GetApiVersion$api final TRes Function(Query$GetApiVersion$api) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? version = _undefined, @@ -2300,7 +2497,7 @@ class _CopyWithStubImpl$Query$GetApiVersion$api class Query$GetApiJobs { Query$GetApiJobs({ required this.jobs, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$GetApiJobs.fromJson(Map json) { @@ -2392,7 +2589,7 @@ class _CopyWithImpl$Query$GetApiJobs final TRes Function(Query$GetApiJobs) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? jobs = _undefined, @@ -2553,6 +2750,10 @@ const documentNodeQueryGetApiJobs = DocumentNode(definitions: [ ]); Query$GetApiJobs _parserFn$Query$GetApiJobs(Map data) => Query$GetApiJobs.fromJson(data); +typedef OnQueryComplete$Query$GetApiJobs = FutureOr Function( + Map?, + Query$GetApiJobs?, +); class Options$Query$GetApiJobs extends graphql.QueryOptions { Options$Query$GetApiJobs({ @@ -2561,19 +2762,40 @@ class Options$Query$GetApiJobs extends graphql.QueryOptions { graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$GetApiJobs? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$GetApiJobs? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null ? null : _parserFn$Query$GetApiJobs(data), + ), + onError: onError, document: documentNodeQueryGetApiJobs, parserFn: _parserFn$Query$GetApiJobs, ); + + final OnQueryComplete$Query$GetApiJobs? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$GetApiJobs @@ -2584,6 +2806,7 @@ class WatchOptions$Query$GetApiJobs graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$GetApiJobs? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -2594,7 +2817,7 @@ class WatchOptions$Query$GetApiJobs fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQueryGetApiJobs, pollInterval: pollInterval, @@ -2644,7 +2867,7 @@ extension ClientExtension$Query$GetApiJobs on graphql.GraphQLClient { class Query$GetApiJobs$jobs { Query$GetApiJobs$jobs({ required this.getJobs, - required this.$__typename, + this.$__typename = 'Job', }); factory Query$GetApiJobs$jobs.fromJson(Map json) { @@ -2751,7 +2974,7 @@ class _CopyWithImpl$Query$GetApiJobs$jobs final TRes Function(Query$GetApiJobs$jobs) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? getJobs = _undefined, @@ -2806,7 +3029,7 @@ class Query$GetApiJobs$jobs$getJobs { this.statusText, required this.uid, required this.updatedAt, - required this.$__typename, + this.$__typename = 'ApiJob', }); factory Query$GetApiJobs$jobs$getJobs.fromJson(Map json) { @@ -3040,7 +3263,7 @@ class _CopyWithImpl$Query$GetApiJobs$jobs$getJobs final TRes Function(Query$GetApiJobs$jobs$getJobs) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? createdAt = _undefined, @@ -3189,7 +3412,7 @@ class _CopyWithImpl$Variables$Mutation$RemoveJob final TRes Function(Variables$Mutation$RemoveJob) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? jobId = _undefined}) => _then(Variables$Mutation$RemoveJob._({ @@ -3210,7 +3433,7 @@ class _CopyWithStubImpl$Variables$Mutation$RemoveJob class Mutation$RemoveJob { Mutation$RemoveJob({ required this.removeJob, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$RemoveJob.fromJson(Map json) { @@ -3303,7 +3526,7 @@ class _CopyWithImpl$Mutation$RemoveJob final TRes Function(Mutation$RemoveJob) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? removeJob = _undefined, @@ -3394,7 +3617,7 @@ const documentNodeMutationRemoveJob = DocumentNode(definitions: [ Mutation$RemoveJob _parserFn$Mutation$RemoveJob(Map data) => Mutation$RemoveJob.fromJson(data); typedef OnMutationCompleted$Mutation$RemoveJob = FutureOr Function( - dynamic, + Map?, Mutation$RemoveJob?, ); @@ -3407,6 +3630,7 @@ class Options$Mutation$RemoveJob graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RemoveJob? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$RemoveJob? onCompleted, graphql.OnMutationUpdate? update, @@ -3418,7 +3642,7 @@ class Options$Mutation$RemoveJob fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -3452,6 +3676,7 @@ class WatchOptions$Mutation$RemoveJob graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RemoveJob? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -3463,7 +3688,7 @@ class WatchOptions$Mutation$RemoveJob fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationRemoveJob, pollInterval: pollInterval, @@ -3489,7 +3714,7 @@ class Mutation$RemoveJob$removeJob required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$RemoveJob$removeJob.fromJson(Map json) { @@ -3610,7 +3835,7 @@ class _CopyWithImpl$Mutation$RemoveJob$removeJob final TRes Function(Mutation$RemoveJob$removeJob) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -3651,7 +3876,7 @@ class _CopyWithStubImpl$Mutation$RemoveJob$removeJob class Mutation$RunSystemRebuild { Mutation$RunSystemRebuild({ required this.runSystemRebuild, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$RunSystemRebuild.fromJson(Map json) { @@ -3747,7 +3972,7 @@ class _CopyWithImpl$Mutation$RunSystemRebuild final TRes Function(Mutation$RunSystemRebuild) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? runSystemRebuild = _undefined, @@ -3827,7 +4052,7 @@ Mutation$RunSystemRebuild _parserFn$Mutation$RunSystemRebuild( Map data) => Mutation$RunSystemRebuild.fromJson(data); typedef OnMutationCompleted$Mutation$RunSystemRebuild = FutureOr Function( - dynamic, + Map?, Mutation$RunSystemRebuild?, ); @@ -3839,6 +4064,7 @@ class Options$Mutation$RunSystemRebuild graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RunSystemRebuild? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$RunSystemRebuild? onCompleted, graphql.OnMutationUpdate? update, @@ -3849,7 +4075,7 @@ class Options$Mutation$RunSystemRebuild fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -3884,6 +4110,7 @@ class WatchOptions$Mutation$RunSystemRebuild graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RunSystemRebuild? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -3894,7 +4121,7 @@ class WatchOptions$Mutation$RunSystemRebuild fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationRunSystemRebuild, pollInterval: pollInterval, @@ -3922,7 +4149,7 @@ class Mutation$RunSystemRebuild$runSystemRebuild required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$RunSystemRebuild$runSystemRebuild.fromJson( @@ -4045,7 +4272,7 @@ class _CopyWithImpl$Mutation$RunSystemRebuild$runSystemRebuild final TRes Function(Mutation$RunSystemRebuild$runSystemRebuild) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -4086,7 +4313,7 @@ class _CopyWithStubImpl$Mutation$RunSystemRebuild$runSystemRebuild class Mutation$RunSystemRollback { Mutation$RunSystemRollback({ required this.runSystemRollback, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$RunSystemRollback.fromJson(Map json) { @@ -4182,7 +4409,7 @@ class _CopyWithImpl$Mutation$RunSystemRollback final TRes Function(Mutation$RunSystemRollback) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? runSystemRollback = _undefined, @@ -4264,7 +4491,7 @@ Mutation$RunSystemRollback _parserFn$Mutation$RunSystemRollback( Mutation$RunSystemRollback.fromJson(data); typedef OnMutationCompleted$Mutation$RunSystemRollback = FutureOr Function( - dynamic, + Map?, Mutation$RunSystemRollback?, ); @@ -4276,6 +4503,7 @@ class Options$Mutation$RunSystemRollback graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RunSystemRollback? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$RunSystemRollback? onCompleted, graphql.OnMutationUpdate? update, @@ -4286,7 +4514,7 @@ class Options$Mutation$RunSystemRollback fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -4321,6 +4549,7 @@ class WatchOptions$Mutation$RunSystemRollback graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RunSystemRollback? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -4331,7 +4560,7 @@ class WatchOptions$Mutation$RunSystemRollback fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationRunSystemRollback, pollInterval: pollInterval, @@ -4359,7 +4588,7 @@ class Mutation$RunSystemRollback$runSystemRollback required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$RunSystemRollback$runSystemRollback.fromJson( @@ -4482,7 +4711,7 @@ class _CopyWithImpl$Mutation$RunSystemRollback$runSystemRollback final TRes Function(Mutation$RunSystemRollback$runSystemRollback) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -4523,7 +4752,7 @@ class _CopyWithStubImpl$Mutation$RunSystemRollback$runSystemRollback class Mutation$RunSystemUpgrade { Mutation$RunSystemUpgrade({ required this.runSystemUpgrade, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$RunSystemUpgrade.fromJson(Map json) { @@ -4619,7 +4848,7 @@ class _CopyWithImpl$Mutation$RunSystemUpgrade final TRes Function(Mutation$RunSystemUpgrade) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? runSystemUpgrade = _undefined, @@ -4699,7 +4928,7 @@ Mutation$RunSystemUpgrade _parserFn$Mutation$RunSystemUpgrade( Map data) => Mutation$RunSystemUpgrade.fromJson(data); typedef OnMutationCompleted$Mutation$RunSystemUpgrade = FutureOr Function( - dynamic, + Map?, Mutation$RunSystemUpgrade?, ); @@ -4711,6 +4940,7 @@ class Options$Mutation$RunSystemUpgrade graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RunSystemUpgrade? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$RunSystemUpgrade? onCompleted, graphql.OnMutationUpdate? update, @@ -4721,7 +4951,7 @@ class Options$Mutation$RunSystemUpgrade fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -4756,6 +4986,7 @@ class WatchOptions$Mutation$RunSystemUpgrade graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RunSystemUpgrade? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -4766,7 +4997,7 @@ class WatchOptions$Mutation$RunSystemUpgrade fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationRunSystemUpgrade, pollInterval: pollInterval, @@ -4794,7 +5025,7 @@ class Mutation$RunSystemUpgrade$runSystemUpgrade required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$RunSystemUpgrade$runSystemUpgrade.fromJson( @@ -4917,7 +5148,7 @@ class _CopyWithImpl$Mutation$RunSystemUpgrade$runSystemUpgrade final TRes Function(Mutation$RunSystemUpgrade$runSystemUpgrade) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -4958,7 +5189,7 @@ class _CopyWithStubImpl$Mutation$RunSystemUpgrade$runSystemUpgrade class Mutation$PullRepositoryChanges { Mutation$PullRepositoryChanges({ required this.pullRepositoryChanges, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$PullRepositoryChanges.fromJson(Map json) { @@ -5056,7 +5287,7 @@ class _CopyWithImpl$Mutation$PullRepositoryChanges final TRes Function(Mutation$PullRepositoryChanges) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? pullRepositoryChanges = _undefined, @@ -5139,7 +5370,7 @@ Mutation$PullRepositoryChanges _parserFn$Mutation$PullRepositoryChanges( Mutation$PullRepositoryChanges.fromJson(data); typedef OnMutationCompleted$Mutation$PullRepositoryChanges = FutureOr Function( - dynamic, + Map?, Mutation$PullRepositoryChanges?, ); @@ -5151,6 +5382,7 @@ class Options$Mutation$PullRepositoryChanges graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$PullRepositoryChanges? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$PullRepositoryChanges? onCompleted, graphql.OnMutationUpdate? update, @@ -5161,7 +5393,7 @@ class Options$Mutation$PullRepositoryChanges fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -5197,6 +5429,7 @@ class WatchOptions$Mutation$PullRepositoryChanges graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$PullRepositoryChanges? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -5207,7 +5440,7 @@ class WatchOptions$Mutation$PullRepositoryChanges fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationPullRepositoryChanges, pollInterval: pollInterval, @@ -5238,7 +5471,7 @@ class Mutation$PullRepositoryChanges$pullRepositoryChanges required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$PullRepositoryChanges$pullRepositoryChanges.fromJson( @@ -5366,7 +5599,7 @@ class _CopyWithImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges final TRes Function(Mutation$PullRepositoryChanges$pullRepositoryChanges) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -5410,7 +5643,7 @@ class _CopyWithStubImpl$Mutation$PullRepositoryChanges$pullRepositoryChanges< class Mutation$RebootSystem { Mutation$RebootSystem({ required this.rebootSystem, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$RebootSystem.fromJson(Map json) { @@ -5503,7 +5736,7 @@ class _CopyWithImpl$Mutation$RebootSystem final TRes Function(Mutation$RebootSystem) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? rebootSystem = _undefined, @@ -5580,7 +5813,7 @@ Mutation$RebootSystem _parserFn$Mutation$RebootSystem( Map data) => Mutation$RebootSystem.fromJson(data); typedef OnMutationCompleted$Mutation$RebootSystem = FutureOr Function( - dynamic, + Map?, Mutation$RebootSystem?, ); @@ -5592,6 +5825,7 @@ class Options$Mutation$RebootSystem graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RebootSystem? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$RebootSystem? onCompleted, graphql.OnMutationUpdate? update, @@ -5602,7 +5836,7 @@ class Options$Mutation$RebootSystem fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -5635,6 +5869,7 @@ class WatchOptions$Mutation$RebootSystem graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RebootSystem? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -5645,7 +5880,7 @@ class WatchOptions$Mutation$RebootSystem fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationRebootSystem, pollInterval: pollInterval, @@ -5671,7 +5906,7 @@ class Mutation$RebootSystem$rebootSystem required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$RebootSystem$rebootSystem.fromJson( @@ -5794,7 +6029,7 @@ class _CopyWithImpl$Mutation$RebootSystem$rebootSystem final TRes Function(Mutation$RebootSystem$rebootSystem) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -5835,7 +6070,7 @@ class _CopyWithStubImpl$Mutation$RebootSystem$rebootSystem class Query$SystemServerProvider { Query$SystemServerProvider({ required this.system, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$SystemServerProvider.fromJson(Map json) { @@ -5930,7 +6165,7 @@ class _CopyWithImpl$Query$SystemServerProvider final TRes Function(Query$SystemServerProvider) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? system = _undefined, @@ -6023,6 +6258,10 @@ const documentNodeQuerySystemServerProvider = DocumentNode(definitions: [ Query$SystemServerProvider _parserFn$Query$SystemServerProvider( Map data) => Query$SystemServerProvider.fromJson(data); +typedef OnQueryComplete$Query$SystemServerProvider = FutureOr Function( + Map?, + Query$SystemServerProvider?, +); class Options$Query$SystemServerProvider extends graphql.QueryOptions { @@ -6032,19 +6271,42 @@ class Options$Query$SystemServerProvider graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$SystemServerProvider? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$SystemServerProvider? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null + ? null + : _parserFn$Query$SystemServerProvider(data), + ), + onError: onError, document: documentNodeQuerySystemServerProvider, parserFn: _parserFn$Query$SystemServerProvider, ); + + final OnQueryComplete$Query$SystemServerProvider? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$SystemServerProvider @@ -6055,6 +6317,7 @@ class WatchOptions$Query$SystemServerProvider graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$SystemServerProvider? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -6065,7 +6328,7 @@ class WatchOptions$Query$SystemServerProvider fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQuerySystemServerProvider, pollInterval: pollInterval, @@ -6121,7 +6384,7 @@ extension ClientExtension$Query$SystemServerProvider on graphql.GraphQLClient { class Query$SystemServerProvider$system { Query$SystemServerProvider$system({ required this.provider, - required this.$__typename, + this.$__typename = 'System', }); factory Query$SystemServerProvider$system.fromJson( @@ -6217,7 +6480,7 @@ class _CopyWithImpl$Query$SystemServerProvider$system final TRes Function(Query$SystemServerProvider$system) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? provider = _undefined, @@ -6256,7 +6519,7 @@ class _CopyWithStubImpl$Query$SystemServerProvider$system class Query$SystemServerProvider$system$provider { Query$SystemServerProvider$system$provider({ required this.provider, - required this.$__typename, + this.$__typename = 'SystemProviderInfo', }); factory Query$SystemServerProvider$system$provider.fromJson( @@ -6351,7 +6614,7 @@ class _CopyWithImpl$Query$SystemServerProvider$system$provider final TRes Function(Query$SystemServerProvider$system$provider) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? provider = _undefined, @@ -6383,7 +6646,7 @@ class _CopyWithStubImpl$Query$SystemServerProvider$system$provider class Query$SystemDnsProvider { Query$SystemDnsProvider({ required this.system, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$SystemDnsProvider.fromJson(Map json) { @@ -6477,7 +6740,7 @@ class _CopyWithImpl$Query$SystemDnsProvider final TRes Function(Query$SystemDnsProvider) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? system = _undefined, @@ -6570,6 +6833,10 @@ const documentNodeQuerySystemDnsProvider = DocumentNode(definitions: [ Query$SystemDnsProvider _parserFn$Query$SystemDnsProvider( Map data) => Query$SystemDnsProvider.fromJson(data); +typedef OnQueryComplete$Query$SystemDnsProvider = FutureOr Function( + Map?, + Query$SystemDnsProvider?, +); class Options$Query$SystemDnsProvider extends graphql.QueryOptions { @@ -6579,19 +6846,42 @@ class Options$Query$SystemDnsProvider graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$SystemDnsProvider? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$SystemDnsProvider? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null + ? null + : _parserFn$Query$SystemDnsProvider(data), + ), + onError: onError, document: documentNodeQuerySystemDnsProvider, parserFn: _parserFn$Query$SystemDnsProvider, ); + + final OnQueryComplete$Query$SystemDnsProvider? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$SystemDnsProvider @@ -6602,6 +6892,7 @@ class WatchOptions$Query$SystemDnsProvider graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$SystemDnsProvider? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -6612,7 +6903,7 @@ class WatchOptions$Query$SystemDnsProvider fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQuerySystemDnsProvider, pollInterval: pollInterval, @@ -6666,7 +6957,7 @@ extension ClientExtension$Query$SystemDnsProvider on graphql.GraphQLClient { class Query$SystemDnsProvider$system { Query$SystemDnsProvider$system({ required this.domainInfo, - required this.$__typename, + this.$__typename = 'System', }); factory Query$SystemDnsProvider$system.fromJson(Map json) { @@ -6761,7 +7052,7 @@ class _CopyWithImpl$Query$SystemDnsProvider$system final TRes Function(Query$SystemDnsProvider$system) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? domainInfo = _undefined, @@ -6800,7 +7091,7 @@ class _CopyWithStubImpl$Query$SystemDnsProvider$system class Query$SystemDnsProvider$system$domainInfo { Query$SystemDnsProvider$system$domainInfo({ required this.provider, - required this.$__typename, + this.$__typename = 'SystemDomainInfo', }); factory Query$SystemDnsProvider$system$domainInfo.fromJson( @@ -6895,7 +7186,7 @@ class _CopyWithImpl$Query$SystemDnsProvider$system$domainInfo final TRes Function(Query$SystemDnsProvider$system$domainInfo) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? provider = _undefined, @@ -6927,7 +7218,7 @@ class _CopyWithStubImpl$Query$SystemDnsProvider$system$domainInfo class Query$GetApiTokens { Query$GetApiTokens({ required this.api, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$GetApiTokens.fromJson(Map json) { @@ -7019,7 +7310,7 @@ class _CopyWithImpl$Query$GetApiTokens final TRes Function(Query$GetApiTokens) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? api = _undefined, @@ -7124,6 +7415,10 @@ const documentNodeQueryGetApiTokens = DocumentNode(definitions: [ ]); Query$GetApiTokens _parserFn$Query$GetApiTokens(Map data) => Query$GetApiTokens.fromJson(data); +typedef OnQueryComplete$Query$GetApiTokens = FutureOr Function( + Map?, + Query$GetApiTokens?, +); class Options$Query$GetApiTokens extends graphql.QueryOptions { @@ -7133,19 +7428,40 @@ class Options$Query$GetApiTokens graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$GetApiTokens? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$GetApiTokens? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null ? null : _parserFn$Query$GetApiTokens(data), + ), + onError: onError, document: documentNodeQueryGetApiTokens, parserFn: _parserFn$Query$GetApiTokens, ); + + final OnQueryComplete$Query$GetApiTokens? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$GetApiTokens @@ -7156,6 +7472,7 @@ class WatchOptions$Query$GetApiTokens graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$GetApiTokens? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -7166,7 +7483,7 @@ class WatchOptions$Query$GetApiTokens fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQueryGetApiTokens, pollInterval: pollInterval, @@ -7218,7 +7535,7 @@ extension ClientExtension$Query$GetApiTokens on graphql.GraphQLClient { class Query$GetApiTokens$api { Query$GetApiTokens$api({ required this.devices, - required this.$__typename, + this.$__typename = 'Api', }); factory Query$GetApiTokens$api.fromJson(Map json) { @@ -7326,7 +7643,7 @@ class _CopyWithImpl$Query$GetApiTokens$api final TRes Function(Query$GetApiTokens$api) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? devices = _undefined, @@ -7373,7 +7690,7 @@ class Query$GetApiTokens$api$devices { required this.creationDate, required this.isCaller, required this.name, - required this.$__typename, + this.$__typename = 'ApiDevice', }); factory Query$GetApiTokens$api$devices.fromJson(Map json) { @@ -7494,7 +7811,7 @@ class _CopyWithImpl$Query$GetApiTokens$api$devices final TRes Function(Query$GetApiTokens$api$devices) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? creationDate = _undefined, @@ -7536,7 +7853,7 @@ class _CopyWithStubImpl$Query$GetApiTokens$api$devices class Query$RecoveryKey { Query$RecoveryKey({ required this.api, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$RecoveryKey.fromJson(Map json) { @@ -7628,7 +7945,7 @@ class _CopyWithImpl$Query$RecoveryKey final TRes Function(Query$RecoveryKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? api = _undefined, @@ -7747,6 +8064,10 @@ const documentNodeQueryRecoveryKey = DocumentNode(definitions: [ ]); Query$RecoveryKey _parserFn$Query$RecoveryKey(Map data) => Query$RecoveryKey.fromJson(data); +typedef OnQueryComplete$Query$RecoveryKey = FutureOr Function( + Map?, + Query$RecoveryKey?, +); class Options$Query$RecoveryKey extends graphql.QueryOptions { @@ -7756,19 +8077,40 @@ class Options$Query$RecoveryKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$RecoveryKey? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$RecoveryKey? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null ? null : _parserFn$Query$RecoveryKey(data), + ), + onError: onError, document: documentNodeQueryRecoveryKey, parserFn: _parserFn$Query$RecoveryKey, ); + + final OnQueryComplete$Query$RecoveryKey? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$RecoveryKey @@ -7779,6 +8121,7 @@ class WatchOptions$Query$RecoveryKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$RecoveryKey? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -7789,7 +8132,7 @@ class WatchOptions$Query$RecoveryKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQueryRecoveryKey, pollInterval: pollInterval, @@ -7839,7 +8182,7 @@ extension ClientExtension$Query$RecoveryKey on graphql.GraphQLClient { class Query$RecoveryKey$api { Query$RecoveryKey$api({ required this.recoveryKey, - required this.$__typename, + this.$__typename = 'Api', }); factory Query$RecoveryKey$api.fromJson(Map json) { @@ -7932,7 +8275,7 @@ class _CopyWithImpl$Query$RecoveryKey$api final TRes Function(Query$RecoveryKey$api) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? recoveryKey = _undefined, @@ -7975,7 +8318,7 @@ class Query$RecoveryKey$api$recoveryKey { this.expirationDate, this.usesLeft, required this.valid, - required this.$__typename, + this.$__typename = 'ApiRecoveryKeyStatus', }); factory Query$RecoveryKey$api$recoveryKey.fromJson( @@ -8129,7 +8472,7 @@ class _CopyWithImpl$Query$RecoveryKey$api$recoveryKey final TRes Function(Query$RecoveryKey$api$recoveryKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? creationDate = _undefined, @@ -8268,7 +8611,7 @@ class _CopyWithImpl$Variables$Mutation$GetNewRecoveryApiKey final TRes Function(Variables$Mutation$GetNewRecoveryApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? limits = _undefined}) => _then(Variables$Mutation$GetNewRecoveryApiKey._({ @@ -8290,7 +8633,7 @@ class _CopyWithStubImpl$Variables$Mutation$GetNewRecoveryApiKey class Mutation$GetNewRecoveryApiKey { Mutation$GetNewRecoveryApiKey({ required this.getNewRecoveryApiKey, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$GetNewRecoveryApiKey.fromJson(Map json) { @@ -8387,7 +8730,7 @@ class _CopyWithImpl$Mutation$GetNewRecoveryApiKey final TRes Function(Mutation$GetNewRecoveryApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? getNewRecoveryApiKey = _undefined, @@ -8492,7 +8835,7 @@ Mutation$GetNewRecoveryApiKey _parserFn$Mutation$GetNewRecoveryApiKey( Mutation$GetNewRecoveryApiKey.fromJson(data); typedef OnMutationCompleted$Mutation$GetNewRecoveryApiKey = FutureOr Function( - dynamic, + Map?, Mutation$GetNewRecoveryApiKey?, ); @@ -8505,6 +8848,7 @@ class Options$Mutation$GetNewRecoveryApiKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$GetNewRecoveryApiKey? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$GetNewRecoveryApiKey? onCompleted, graphql.OnMutationUpdate? update, @@ -8516,7 +8860,7 @@ class Options$Mutation$GetNewRecoveryApiKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -8553,6 +8897,7 @@ class WatchOptions$Mutation$GetNewRecoveryApiKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$GetNewRecoveryApiKey? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -8564,7 +8909,7 @@ class WatchOptions$Mutation$GetNewRecoveryApiKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationGetNewRecoveryApiKey, pollInterval: pollInterval, @@ -8594,7 +8939,7 @@ class Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ApiKeyMutationReturn', this.key, }); @@ -8736,7 +9081,7 @@ class _CopyWithImpl$Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey final TRes Function(Mutation$GetNewRecoveryApiKey$getNewRecoveryApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -8861,7 +9206,7 @@ class _CopyWithImpl$Variables$Mutation$UseRecoveryApiKey final TRes Function(Variables$Mutation$UseRecoveryApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? input = _undefined}) => _then(Variables$Mutation$UseRecoveryApiKey._({ @@ -8883,7 +9228,7 @@ class _CopyWithStubImpl$Variables$Mutation$UseRecoveryApiKey class Mutation$UseRecoveryApiKey { Mutation$UseRecoveryApiKey({ required this.useRecoveryApiKey, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$UseRecoveryApiKey.fromJson(Map json) { @@ -8979,7 +9324,7 @@ class _CopyWithImpl$Mutation$UseRecoveryApiKey final TRes Function(Mutation$UseRecoveryApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? useRecoveryApiKey = _undefined, @@ -9083,7 +9428,7 @@ Mutation$UseRecoveryApiKey _parserFn$Mutation$UseRecoveryApiKey( Mutation$UseRecoveryApiKey.fromJson(data); typedef OnMutationCompleted$Mutation$UseRecoveryApiKey = FutureOr Function( - dynamic, + Map?, Mutation$UseRecoveryApiKey?, ); @@ -9096,6 +9441,7 @@ class Options$Mutation$UseRecoveryApiKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$UseRecoveryApiKey? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$UseRecoveryApiKey? onCompleted, graphql.OnMutationUpdate? update, @@ -9107,7 +9453,7 @@ class Options$Mutation$UseRecoveryApiKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -9143,6 +9489,7 @@ class WatchOptions$Mutation$UseRecoveryApiKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$UseRecoveryApiKey? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -9154,7 +9501,7 @@ class WatchOptions$Mutation$UseRecoveryApiKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationUseRecoveryApiKey, pollInterval: pollInterval, @@ -9183,7 +9530,7 @@ class Mutation$UseRecoveryApiKey$useRecoveryApiKey required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'DeviceApiTokenMutationReturn', this.token, }); @@ -9321,7 +9668,7 @@ class _CopyWithImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey final TRes Function(Mutation$UseRecoveryApiKey$useRecoveryApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -9365,7 +9712,7 @@ class _CopyWithStubImpl$Mutation$UseRecoveryApiKey$useRecoveryApiKey class Mutation$RefreshDeviceApiToken { Mutation$RefreshDeviceApiToken({ required this.refreshDeviceApiToken, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$RefreshDeviceApiToken.fromJson(Map json) { @@ -9463,7 +9810,7 @@ class _CopyWithImpl$Mutation$RefreshDeviceApiToken final TRes Function(Mutation$RefreshDeviceApiToken) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? refreshDeviceApiToken = _undefined, @@ -9553,7 +9900,7 @@ Mutation$RefreshDeviceApiToken _parserFn$Mutation$RefreshDeviceApiToken( Mutation$RefreshDeviceApiToken.fromJson(data); typedef OnMutationCompleted$Mutation$RefreshDeviceApiToken = FutureOr Function( - dynamic, + Map?, Mutation$RefreshDeviceApiToken?, ); @@ -9565,6 +9912,7 @@ class Options$Mutation$RefreshDeviceApiToken graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RefreshDeviceApiToken? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$RefreshDeviceApiToken? onCompleted, graphql.OnMutationUpdate? update, @@ -9575,7 +9923,7 @@ class Options$Mutation$RefreshDeviceApiToken fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -9611,6 +9959,7 @@ class WatchOptions$Mutation$RefreshDeviceApiToken graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RefreshDeviceApiToken? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -9621,7 +9970,7 @@ class WatchOptions$Mutation$RefreshDeviceApiToken fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationRefreshDeviceApiToken, pollInterval: pollInterval, @@ -9653,7 +10002,7 @@ class Mutation$RefreshDeviceApiToken$refreshDeviceApiToken required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'DeviceApiTokenMutationReturn', this.token, }); @@ -9796,7 +10145,7 @@ class _CopyWithImpl$Mutation$RefreshDeviceApiToken$refreshDeviceApiToken final TRes Function(Mutation$RefreshDeviceApiToken$refreshDeviceApiToken) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -9919,7 +10268,7 @@ class _CopyWithImpl$Variables$Mutation$DeleteDeviceApiToken final TRes Function(Variables$Mutation$DeleteDeviceApiToken) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? device = _undefined}) => _then(Variables$Mutation$DeleteDeviceApiToken._({ @@ -9941,7 +10290,7 @@ class _CopyWithStubImpl$Variables$Mutation$DeleteDeviceApiToken class Mutation$DeleteDeviceApiToken { Mutation$DeleteDeviceApiToken({ required this.deleteDeviceApiToken, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$DeleteDeviceApiToken.fromJson(Map json) { @@ -10038,7 +10387,7 @@ class _CopyWithImpl$Mutation$DeleteDeviceApiToken final TRes Function(Mutation$DeleteDeviceApiToken) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? deleteDeviceApiToken = _undefined, @@ -10136,7 +10485,7 @@ Mutation$DeleteDeviceApiToken _parserFn$Mutation$DeleteDeviceApiToken( Mutation$DeleteDeviceApiToken.fromJson(data); typedef OnMutationCompleted$Mutation$DeleteDeviceApiToken = FutureOr Function( - dynamic, + Map?, Mutation$DeleteDeviceApiToken?, ); @@ -10149,6 +10498,7 @@ class Options$Mutation$DeleteDeviceApiToken graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$DeleteDeviceApiToken? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$DeleteDeviceApiToken? onCompleted, graphql.OnMutationUpdate? update, @@ -10160,7 +10510,7 @@ class Options$Mutation$DeleteDeviceApiToken fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -10197,6 +10547,7 @@ class WatchOptions$Mutation$DeleteDeviceApiToken graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$DeleteDeviceApiToken? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -10208,7 +10559,7 @@ class WatchOptions$Mutation$DeleteDeviceApiToken fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationDeleteDeviceApiToken, pollInterval: pollInterval, @@ -10237,7 +10588,7 @@ class Mutation$DeleteDeviceApiToken$deleteDeviceApiToken required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$DeleteDeviceApiToken$deleteDeviceApiToken.fromJson( @@ -10364,7 +10715,7 @@ class _CopyWithImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken final TRes Function(Mutation$DeleteDeviceApiToken$deleteDeviceApiToken) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -10407,7 +10758,7 @@ class _CopyWithStubImpl$Mutation$DeleteDeviceApiToken$deleteDeviceApiToken class Mutation$GetNewDeviceApiKey { Mutation$GetNewDeviceApiKey({ required this.getNewDeviceApiKey, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$GetNewDeviceApiKey.fromJson(Map json) { @@ -10504,7 +10855,7 @@ class _CopyWithImpl$Mutation$GetNewDeviceApiKey final TRes Function(Mutation$GetNewDeviceApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? getNewDeviceApiKey = _undefined, @@ -10593,7 +10944,7 @@ Mutation$GetNewDeviceApiKey _parserFn$Mutation$GetNewDeviceApiKey( Mutation$GetNewDeviceApiKey.fromJson(data); typedef OnMutationCompleted$Mutation$GetNewDeviceApiKey = FutureOr Function( - dynamic, + Map?, Mutation$GetNewDeviceApiKey?, ); @@ -10605,6 +10956,7 @@ class Options$Mutation$GetNewDeviceApiKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$GetNewDeviceApiKey? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$GetNewDeviceApiKey? onCompleted, graphql.OnMutationUpdate? update, @@ -10615,7 +10967,7 @@ class Options$Mutation$GetNewDeviceApiKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -10650,6 +11002,7 @@ class WatchOptions$Mutation$GetNewDeviceApiKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$GetNewDeviceApiKey? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -10660,7 +11013,7 @@ class WatchOptions$Mutation$GetNewDeviceApiKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationGetNewDeviceApiKey, pollInterval: pollInterval, @@ -10688,7 +11041,7 @@ class Mutation$GetNewDeviceApiKey$getNewDeviceApiKey required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ApiKeyMutationReturn', this.key, }); @@ -10827,7 +11180,7 @@ class _CopyWithImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey final TRes Function(Mutation$GetNewDeviceApiKey$getNewDeviceApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -10871,7 +11224,7 @@ class _CopyWithStubImpl$Mutation$GetNewDeviceApiKey$getNewDeviceApiKey class Mutation$InvalidateNewDeviceApiKey { Mutation$InvalidateNewDeviceApiKey({ required this.invalidateNewDeviceApiKey, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$InvalidateNewDeviceApiKey.fromJson( @@ -10973,7 +11326,7 @@ class _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey final TRes Function(Mutation$InvalidateNewDeviceApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? invalidateNewDeviceApiKey = _undefined, @@ -11059,7 +11412,7 @@ Mutation$InvalidateNewDeviceApiKey _parserFn$Mutation$InvalidateNewDeviceApiKey( Mutation$InvalidateNewDeviceApiKey.fromJson(data); typedef OnMutationCompleted$Mutation$InvalidateNewDeviceApiKey = FutureOr Function( - dynamic, + Map?, Mutation$InvalidateNewDeviceApiKey?, ); @@ -11071,6 +11424,7 @@ class Options$Mutation$InvalidateNewDeviceApiKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$InvalidateNewDeviceApiKey? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$InvalidateNewDeviceApiKey? onCompleted, graphql.OnMutationUpdate? update, @@ -11081,7 +11435,7 @@ class Options$Mutation$InvalidateNewDeviceApiKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -11117,6 +11471,7 @@ class WatchOptions$Mutation$InvalidateNewDeviceApiKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$InvalidateNewDeviceApiKey? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -11127,7 +11482,7 @@ class WatchOptions$Mutation$InvalidateNewDeviceApiKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationInvalidateNewDeviceApiKey, pollInterval: pollInterval, @@ -11158,7 +11513,7 @@ class Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey.fromJson( @@ -11290,7 +11645,7 @@ class _CopyWithImpl$Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey final TRes Function( Mutation$InvalidateNewDeviceApiKey$invalidateNewDeviceApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -11415,7 +11770,7 @@ class _CopyWithImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey final TRes Function(Variables$Mutation$AuthorizeWithNewDeviceApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? input = _undefined}) => _then(Variables$Mutation$AuthorizeWithNewDeviceApiKey._({ @@ -11437,7 +11792,7 @@ class _CopyWithStubImpl$Variables$Mutation$AuthorizeWithNewDeviceApiKey class Mutation$AuthorizeWithNewDeviceApiKey { Mutation$AuthorizeWithNewDeviceApiKey({ required this.authorizeWithNewDeviceApiKey, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$AuthorizeWithNewDeviceApiKey.fromJson( @@ -11541,7 +11896,7 @@ class _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey final TRes Function(Mutation$AuthorizeWithNewDeviceApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? authorizeWithNewDeviceApiKey = _undefined, @@ -11653,7 +12008,7 @@ Mutation$AuthorizeWithNewDeviceApiKey Mutation$AuthorizeWithNewDeviceApiKey.fromJson(data); typedef OnMutationCompleted$Mutation$AuthorizeWithNewDeviceApiKey = FutureOr Function( - dynamic, + Map?, Mutation$AuthorizeWithNewDeviceApiKey?, ); @@ -11666,6 +12021,7 @@ class Options$Mutation$AuthorizeWithNewDeviceApiKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$AuthorizeWithNewDeviceApiKey? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$AuthorizeWithNewDeviceApiKey? onCompleted, graphql.OnMutationUpdate? update, @@ -11677,7 +12033,7 @@ class Options$Mutation$AuthorizeWithNewDeviceApiKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -11714,6 +12070,7 @@ class WatchOptions$Mutation$AuthorizeWithNewDeviceApiKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$AuthorizeWithNewDeviceApiKey? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -11725,7 +12082,7 @@ class WatchOptions$Mutation$AuthorizeWithNewDeviceApiKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationAuthorizeWithNewDeviceApiKey, pollInterval: pollInterval, @@ -11755,7 +12112,7 @@ class Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'DeviceApiTokenMutationReturn', this.token, }); @@ -11904,7 +12261,7 @@ class _CopyWithImpl$Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDevice final TRes Function( Mutation$AuthorizeWithNewDeviceApiKey$authorizeWithNewDeviceApiKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, diff --git a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart index 8da4e347..64738ad8 100644 --- a/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/server_settings.graphql.dart @@ -1,8 +1,8 @@ import 'dart:async'; +import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'schema.graphql.dart'; -import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ @@ -141,6 +141,177 @@ extension UtilityExtension$Fragment$basicMutationReturnFields this, (i) => i, ); + _T when<_T>({ + required _T Function( + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + apiKeyMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + autoUpgradeSettingsMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) + deviceApiTokenMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$GenericJobButationReturn) + genericJobButationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$GenericMutationReturn) + genericMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) + serviceJobMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$ServiceMutationReturn) + serviceMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn) + timezoneMutationReturn, + required _T Function(Fragment$basicMutationReturnFields$$UserMutationReturn) + userMutationReturn, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ApiKeyMutationReturn": + return apiKeyMutationReturn( + this as Fragment$basicMutationReturnFields$$ApiKeyMutationReturn); + + case "AutoUpgradeSettingsMutationReturn": + return autoUpgradeSettingsMutationReturn(this + as Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn); + + case "DeviceApiTokenMutationReturn": + return deviceApiTokenMutationReturn(this + as Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn); + + case "GenericJobButationReturn": + return genericJobButationReturn(this + as Fragment$basicMutationReturnFields$$GenericJobButationReturn); + + case "GenericMutationReturn": + return genericMutationReturn( + this as Fragment$basicMutationReturnFields$$GenericMutationReturn); + + case "ServiceJobMutationReturn": + return serviceJobMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceJobMutationReturn); + + case "ServiceMutationReturn": + return serviceMutationReturn( + this as Fragment$basicMutationReturnFields$$ServiceMutationReturn); + + case "TimezoneMutationReturn": + return timezoneMutationReturn( + this as Fragment$basicMutationReturnFields$$TimezoneMutationReturn); + + case "UserMutationReturn": + return userMutationReturn( + this as Fragment$basicMutationReturnFields$$UserMutationReturn); + + default: + return orElse(); + } + } + + _T maybeWhen<_T>({ + _T Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn)? + apiKeyMutationReturn, + _T Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn)? + autoUpgradeSettingsMutationReturn, + _T Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn)? + deviceApiTokenMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$GenericJobButationReturn)? + genericJobButationReturn, + _T Function(Fragment$basicMutationReturnFields$$GenericMutationReturn)? + genericMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn)? + serviceJobMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn)? + serviceMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$TimezoneMutationReturn)? + timezoneMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$UserMutationReturn)? + userMutationReturn, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ApiKeyMutationReturn": + if (apiKeyMutationReturn != null) { + return apiKeyMutationReturn( + this as Fragment$basicMutationReturnFields$$ApiKeyMutationReturn); + } else { + return orElse(); + } + + case "AutoUpgradeSettingsMutationReturn": + if (autoUpgradeSettingsMutationReturn != null) { + return autoUpgradeSettingsMutationReturn(this + as Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn); + } else { + return orElse(); + } + + case "DeviceApiTokenMutationReturn": + if (deviceApiTokenMutationReturn != null) { + return deviceApiTokenMutationReturn(this + as Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn); + } else { + return orElse(); + } + + case "GenericJobButationReturn": + if (genericJobButationReturn != null) { + return genericJobButationReturn(this + as Fragment$basicMutationReturnFields$$GenericJobButationReturn); + } else { + return orElse(); + } + + case "GenericMutationReturn": + if (genericMutationReturn != null) { + return genericMutationReturn(this + as Fragment$basicMutationReturnFields$$GenericMutationReturn); + } else { + return orElse(); + } + + case "ServiceJobMutationReturn": + if (serviceJobMutationReturn != null) { + return serviceJobMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceJobMutationReturn); + } else { + return orElse(); + } + + case "ServiceMutationReturn": + if (serviceMutationReturn != null) { + return serviceMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceMutationReturn); + } else { + return orElse(); + } + + case "TimezoneMutationReturn": + if (timezoneMutationReturn != null) { + return timezoneMutationReturn(this + as Fragment$basicMutationReturnFields$$TimezoneMutationReturn); + } else { + return orElse(); + } + + case "UserMutationReturn": + if (userMutationReturn != null) { + return userMutationReturn( + this as Fragment$basicMutationReturnFields$$UserMutationReturn); + } else { + return orElse(); + } + + default: + return orElse(); + } + } } abstract class CopyWith$Fragment$basicMutationReturnFields { @@ -171,7 +342,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields final TRes Function(Fragment$basicMutationReturnFields) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -297,7 +468,7 @@ class Fragment$basicMutationReturnFields$$ApiKeyMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ApiKeyMutationReturn', }); factory Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.fromJson( @@ -428,7 +599,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -476,7 +647,7 @@ class Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'AutoUpgradeSettingsMutationReturn', }); factory Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.fromJson( @@ -612,7 +783,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutat Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -661,7 +832,7 @@ class Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'DeviceApiTokenMutationReturn', }); factory Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.fromJson( @@ -795,7 +966,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationRe final TRes Function( Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -843,7 +1014,7 @@ class Fragment$basicMutationReturnFields$$GenericJobButationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericJobButationReturn', }); factory Fragment$basicMutationReturnFields$$GenericJobButationReturn.fromJson( @@ -975,7 +1146,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn final TRes Function( Fragment$basicMutationReturnFields$$GenericJobButationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1023,7 +1194,7 @@ class Fragment$basicMutationReturnFields$$GenericMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Fragment$basicMutationReturnFields$$GenericMutationReturn.fromJson( @@ -1154,7 +1325,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1202,7 +1373,7 @@ class Fragment$basicMutationReturnFields$$ServiceJobMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceJobMutationReturn', }); factory Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.fromJson( @@ -1334,7 +1505,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn final TRes Function( Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1382,7 +1553,7 @@ class Fragment$basicMutationReturnFields$$ServiceMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceMutationReturn', }); factory Fragment$basicMutationReturnFields$$ServiceMutationReturn.fromJson( @@ -1513,7 +1684,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1561,7 +1732,7 @@ class Fragment$basicMutationReturnFields$$TimezoneMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'TimezoneMutationReturn', }); factory Fragment$basicMutationReturnFields$$TimezoneMutationReturn.fromJson( @@ -1693,7 +1864,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< final TRes Function( Fragment$basicMutationReturnFields$$TimezoneMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1741,7 +1912,7 @@ class Fragment$basicMutationReturnFields$$UserMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'UserMutationReturn', }); factory Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( @@ -1869,7 +2040,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn final TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1913,7 +2084,7 @@ class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn< class Query$SystemSettings { Query$SystemSettings({ required this.system, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$SystemSettings.fromJson(Map json) { @@ -2006,7 +2177,7 @@ class _CopyWithImpl$Query$SystemSettings final TRes Function(Query$SystemSettings) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? system = _undefined, @@ -2157,6 +2328,10 @@ const documentNodeQuerySystemSettings = DocumentNode(definitions: [ Query$SystemSettings _parserFn$Query$SystemSettings( Map data) => Query$SystemSettings.fromJson(data); +typedef OnQueryComplete$Query$SystemSettings = FutureOr Function( + Map?, + Query$SystemSettings?, +); class Options$Query$SystemSettings extends graphql.QueryOptions { @@ -2166,19 +2341,40 @@ class Options$Query$SystemSettings graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$SystemSettings? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$SystemSettings? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null ? null : _parserFn$Query$SystemSettings(data), + ), + onError: onError, document: documentNodeQuerySystemSettings, parserFn: _parserFn$Query$SystemSettings, ); + + final OnQueryComplete$Query$SystemSettings? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$SystemSettings @@ -2189,6 +2385,7 @@ class WatchOptions$Query$SystemSettings graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$SystemSettings? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -2199,7 +2396,7 @@ class WatchOptions$Query$SystemSettings fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQuerySystemSettings, pollInterval: pollInterval, @@ -2251,7 +2448,7 @@ extension ClientExtension$Query$SystemSettings on graphql.GraphQLClient { class Query$SystemSettings$system { Query$SystemSettings$system({ required this.settings, - required this.$__typename, + this.$__typename = 'System', }); factory Query$SystemSettings$system.fromJson(Map json) { @@ -2346,7 +2543,7 @@ class _CopyWithImpl$Query$SystemSettings$system final TRes Function(Query$SystemSettings$system) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? settings = _undefined, @@ -2387,7 +2584,7 @@ class Query$SystemSettings$system$settings { required this.autoUpgrade, required this.ssh, required this.timezone, - required this.$__typename, + this.$__typename = 'SystemSettings', }); factory Query$SystemSettings$system$settings.fromJson( @@ -2515,7 +2712,7 @@ class _CopyWithImpl$Query$SystemSettings$system$settings final TRes Function(Query$SystemSettings$system$settings) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? autoUpgrade = _undefined, @@ -2575,7 +2772,7 @@ class Query$SystemSettings$system$settings$autoUpgrade { Query$SystemSettings$system$settings$autoUpgrade({ required this.allowReboot, required this.enable, - required this.$__typename, + this.$__typename = 'AutoUpgradeOptions', }); factory Query$SystemSettings$system$settings$autoUpgrade.fromJson( @@ -2685,7 +2882,7 @@ class _CopyWithImpl$Query$SystemSettings$system$settings$autoUpgrade final TRes Function(Query$SystemSettings$system$settings$autoUpgrade) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? allowReboot = _undefined, @@ -2723,7 +2920,7 @@ class Query$SystemSettings$system$settings$ssh { Query$SystemSettings$system$settings$ssh({ required this.enable, required this.passwordAuthentication, - required this.$__typename, + this.$__typename = 'SshSettings', }); factory Query$SystemSettings$system$settings$ssh.fromJson( @@ -2832,7 +3029,7 @@ class _CopyWithImpl$Query$SystemSettings$system$settings$ssh final TRes Function(Query$SystemSettings$system$settings$ssh) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? enable = _undefined, @@ -2870,7 +3067,7 @@ class _CopyWithStubImpl$Query$SystemSettings$system$settings$ssh class Query$SystemIsUsingBinds { Query$SystemIsUsingBinds({ required this.system, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$SystemIsUsingBinds.fromJson(Map json) { @@ -2965,7 +3162,7 @@ class _CopyWithImpl$Query$SystemIsUsingBinds final TRes Function(Query$SystemIsUsingBinds) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? system = _undefined, @@ -3058,6 +3255,10 @@ const documentNodeQuerySystemIsUsingBinds = DocumentNode(definitions: [ Query$SystemIsUsingBinds _parserFn$Query$SystemIsUsingBinds( Map data) => Query$SystemIsUsingBinds.fromJson(data); +typedef OnQueryComplete$Query$SystemIsUsingBinds = FutureOr Function( + Map?, + Query$SystemIsUsingBinds?, +); class Options$Query$SystemIsUsingBinds extends graphql.QueryOptions { @@ -3067,19 +3268,42 @@ class Options$Query$SystemIsUsingBinds graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$SystemIsUsingBinds? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$SystemIsUsingBinds? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null + ? null + : _parserFn$Query$SystemIsUsingBinds(data), + ), + onError: onError, document: documentNodeQuerySystemIsUsingBinds, parserFn: _parserFn$Query$SystemIsUsingBinds, ); + + final OnQueryComplete$Query$SystemIsUsingBinds? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$SystemIsUsingBinds @@ -3090,6 +3314,7 @@ class WatchOptions$Query$SystemIsUsingBinds graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$SystemIsUsingBinds? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -3100,7 +3325,7 @@ class WatchOptions$Query$SystemIsUsingBinds fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQuerySystemIsUsingBinds, pollInterval: pollInterval, @@ -3156,7 +3381,7 @@ extension ClientExtension$Query$SystemIsUsingBinds on graphql.GraphQLClient { class Query$SystemIsUsingBinds$system { Query$SystemIsUsingBinds$system({ required this.info, - required this.$__typename, + this.$__typename = 'System', }); factory Query$SystemIsUsingBinds$system.fromJson(Map json) { @@ -3251,7 +3476,7 @@ class _CopyWithImpl$Query$SystemIsUsingBinds$system final TRes Function(Query$SystemIsUsingBinds$system) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? info = _undefined, @@ -3290,7 +3515,7 @@ class _CopyWithStubImpl$Query$SystemIsUsingBinds$system class Query$SystemIsUsingBinds$system$info { Query$SystemIsUsingBinds$system$info({ required this.usingBinds, - required this.$__typename, + this.$__typename = 'SystemInfo', }); factory Query$SystemIsUsingBinds$system$info.fromJson( @@ -3385,7 +3610,7 @@ class _CopyWithImpl$Query$SystemIsUsingBinds$system$info final TRes Function(Query$SystemIsUsingBinds$system$info) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? usingBinds = _undefined, @@ -3417,7 +3642,7 @@ class _CopyWithStubImpl$Query$SystemIsUsingBinds$system$info class Query$DomainInfo { Query$DomainInfo({ required this.system, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$DomainInfo.fromJson(Map json) { @@ -3510,7 +3735,7 @@ class _CopyWithImpl$Query$DomainInfo final TRes Function(Query$DomainInfo) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? system = _undefined, @@ -3636,6 +3861,10 @@ const documentNodeQueryDomainInfo = DocumentNode(definitions: [ ]); Query$DomainInfo _parserFn$Query$DomainInfo(Map data) => Query$DomainInfo.fromJson(data); +typedef OnQueryComplete$Query$DomainInfo = FutureOr Function( + Map?, + Query$DomainInfo?, +); class Options$Query$DomainInfo extends graphql.QueryOptions { Options$Query$DomainInfo({ @@ -3644,19 +3873,40 @@ class Options$Query$DomainInfo extends graphql.QueryOptions { graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$DomainInfo? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$DomainInfo? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null ? null : _parserFn$Query$DomainInfo(data), + ), + onError: onError, document: documentNodeQueryDomainInfo, parserFn: _parserFn$Query$DomainInfo, ); + + final OnQueryComplete$Query$DomainInfo? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$DomainInfo @@ -3667,6 +3917,7 @@ class WatchOptions$Query$DomainInfo graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$DomainInfo? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -3677,7 +3928,7 @@ class WatchOptions$Query$DomainInfo fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQueryDomainInfo, pollInterval: pollInterval, @@ -3727,7 +3978,7 @@ extension ClientExtension$Query$DomainInfo on graphql.GraphQLClient { class Query$DomainInfo$system { Query$DomainInfo$system({ required this.domainInfo, - required this.$__typename, + this.$__typename = 'System', }); factory Query$DomainInfo$system.fromJson(Map json) { @@ -3821,7 +4072,7 @@ class _CopyWithImpl$Query$DomainInfo$system final TRes Function(Query$DomainInfo$system) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? domainInfo = _undefined, @@ -3863,7 +4114,7 @@ class Query$DomainInfo$system$domainInfo { required this.hostname, required this.provider, required this.requiredDnsRecords, - required this.$__typename, + this.$__typename = 'SystemDomainInfo', }); factory Query$DomainInfo$system$domainInfo.fromJson( @@ -4016,7 +4267,7 @@ class _CopyWithImpl$Query$DomainInfo$system$domainInfo final TRes Function(Query$DomainInfo$system$domainInfo) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? domain = _undefined, @@ -4152,7 +4403,7 @@ class _CopyWithImpl$Variables$Mutation$ChangeTimezone final TRes Function(Variables$Mutation$ChangeTimezone) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? timezone = _undefined}) => _then(Variables$Mutation$ChangeTimezone._({ @@ -4174,7 +4425,7 @@ class _CopyWithStubImpl$Variables$Mutation$ChangeTimezone class Mutation$ChangeTimezone { Mutation$ChangeTimezone({ required this.changeTimezone, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$ChangeTimezone.fromJson(Map json) { @@ -4268,7 +4519,7 @@ class _CopyWithImpl$Mutation$ChangeTimezone final TRes Function(Mutation$ChangeTimezone) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? changeTimezone = _undefined, @@ -4367,7 +4618,7 @@ Mutation$ChangeTimezone _parserFn$Mutation$ChangeTimezone( Map data) => Mutation$ChangeTimezone.fromJson(data); typedef OnMutationCompleted$Mutation$ChangeTimezone = FutureOr Function( - dynamic, + Map?, Mutation$ChangeTimezone?, ); @@ -4380,6 +4631,7 @@ class Options$Mutation$ChangeTimezone graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$ChangeTimezone? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$ChangeTimezone? onCompleted, graphql.OnMutationUpdate? update, @@ -4391,7 +4643,7 @@ class Options$Mutation$ChangeTimezone fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -4427,6 +4679,7 @@ class WatchOptions$Mutation$ChangeTimezone graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$ChangeTimezone? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -4438,7 +4691,7 @@ class WatchOptions$Mutation$ChangeTimezone fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationChangeTimezone, pollInterval: pollInterval, @@ -4464,7 +4717,7 @@ class Mutation$ChangeTimezone$changeTimezone required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'TimezoneMutationReturn', this.timezone, }); @@ -4602,7 +4855,7 @@ class _CopyWithImpl$Mutation$ChangeTimezone$changeTimezone final TRes Function(Mutation$ChangeTimezone$changeTimezone) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -4726,7 +4979,7 @@ class _CopyWithImpl$Variables$Mutation$ChangeAutoUpgradeSettings final TRes Function(Variables$Mutation$ChangeAutoUpgradeSettings) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? settings = _undefined}) => _then(Variables$Mutation$ChangeAutoUpgradeSettings._({ @@ -4748,7 +5001,7 @@ class _CopyWithStubImpl$Variables$Mutation$ChangeAutoUpgradeSettings class Mutation$ChangeAutoUpgradeSettings { Mutation$ChangeAutoUpgradeSettings({ required this.changeAutoUpgradeSettings, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$ChangeAutoUpgradeSettings.fromJson( @@ -4850,7 +5103,7 @@ class _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings final TRes Function(Mutation$ChangeAutoUpgradeSettings) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? changeAutoUpgradeSettings = _undefined, @@ -4965,7 +5218,7 @@ Mutation$ChangeAutoUpgradeSettings _parserFn$Mutation$ChangeAutoUpgradeSettings( Mutation$ChangeAutoUpgradeSettings.fromJson(data); typedef OnMutationCompleted$Mutation$ChangeAutoUpgradeSettings = FutureOr Function( - dynamic, + Map?, Mutation$ChangeAutoUpgradeSettings?, ); @@ -4978,6 +5231,7 @@ class Options$Mutation$ChangeAutoUpgradeSettings graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$ChangeAutoUpgradeSettings? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$ChangeAutoUpgradeSettings? onCompleted, graphql.OnMutationUpdate? update, @@ -4989,7 +5243,7 @@ class Options$Mutation$ChangeAutoUpgradeSettings fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -5026,6 +5280,7 @@ class WatchOptions$Mutation$ChangeAutoUpgradeSettings graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$ChangeAutoUpgradeSettings? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -5037,7 +5292,7 @@ class WatchOptions$Mutation$ChangeAutoUpgradeSettings fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationChangeAutoUpgradeSettings, pollInterval: pollInterval, @@ -5067,7 +5322,7 @@ class Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'AutoUpgradeSettingsMutationReturn', required this.allowReboot, required this.enableAutoUpgrade, }); @@ -5229,7 +5484,7 @@ class _CopyWithImpl$Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings final TRes Function( Mutation$ChangeAutoUpgradeSettings$changeAutoUpgradeSettings) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, diff --git a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart index 1501d709..616788d8 100644 --- a/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/services.graphql.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'package:selfprivacy/utils/scalars.dart'; @@ -141,6 +142,177 @@ extension UtilityExtension$Fragment$basicMutationReturnFields this, (i) => i, ); + _T when<_T>({ + required _T Function( + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + apiKeyMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + autoUpgradeSettingsMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) + deviceApiTokenMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$GenericJobButationReturn) + genericJobButationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$GenericMutationReturn) + genericMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) + serviceJobMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$ServiceMutationReturn) + serviceMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn) + timezoneMutationReturn, + required _T Function(Fragment$basicMutationReturnFields$$UserMutationReturn) + userMutationReturn, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ApiKeyMutationReturn": + return apiKeyMutationReturn( + this as Fragment$basicMutationReturnFields$$ApiKeyMutationReturn); + + case "AutoUpgradeSettingsMutationReturn": + return autoUpgradeSettingsMutationReturn(this + as Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn); + + case "DeviceApiTokenMutationReturn": + return deviceApiTokenMutationReturn(this + as Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn); + + case "GenericJobButationReturn": + return genericJobButationReturn(this + as Fragment$basicMutationReturnFields$$GenericJobButationReturn); + + case "GenericMutationReturn": + return genericMutationReturn( + this as Fragment$basicMutationReturnFields$$GenericMutationReturn); + + case "ServiceJobMutationReturn": + return serviceJobMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceJobMutationReturn); + + case "ServiceMutationReturn": + return serviceMutationReturn( + this as Fragment$basicMutationReturnFields$$ServiceMutationReturn); + + case "TimezoneMutationReturn": + return timezoneMutationReturn( + this as Fragment$basicMutationReturnFields$$TimezoneMutationReturn); + + case "UserMutationReturn": + return userMutationReturn( + this as Fragment$basicMutationReturnFields$$UserMutationReturn); + + default: + return orElse(); + } + } + + _T maybeWhen<_T>({ + _T Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn)? + apiKeyMutationReturn, + _T Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn)? + autoUpgradeSettingsMutationReturn, + _T Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn)? + deviceApiTokenMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$GenericJobButationReturn)? + genericJobButationReturn, + _T Function(Fragment$basicMutationReturnFields$$GenericMutationReturn)? + genericMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn)? + serviceJobMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn)? + serviceMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$TimezoneMutationReturn)? + timezoneMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$UserMutationReturn)? + userMutationReturn, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ApiKeyMutationReturn": + if (apiKeyMutationReturn != null) { + return apiKeyMutationReturn( + this as Fragment$basicMutationReturnFields$$ApiKeyMutationReturn); + } else { + return orElse(); + } + + case "AutoUpgradeSettingsMutationReturn": + if (autoUpgradeSettingsMutationReturn != null) { + return autoUpgradeSettingsMutationReturn(this + as Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn); + } else { + return orElse(); + } + + case "DeviceApiTokenMutationReturn": + if (deviceApiTokenMutationReturn != null) { + return deviceApiTokenMutationReturn(this + as Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn); + } else { + return orElse(); + } + + case "GenericJobButationReturn": + if (genericJobButationReturn != null) { + return genericJobButationReturn(this + as Fragment$basicMutationReturnFields$$GenericJobButationReturn); + } else { + return orElse(); + } + + case "GenericMutationReturn": + if (genericMutationReturn != null) { + return genericMutationReturn(this + as Fragment$basicMutationReturnFields$$GenericMutationReturn); + } else { + return orElse(); + } + + case "ServiceJobMutationReturn": + if (serviceJobMutationReturn != null) { + return serviceJobMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceJobMutationReturn); + } else { + return orElse(); + } + + case "ServiceMutationReturn": + if (serviceMutationReturn != null) { + return serviceMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceMutationReturn); + } else { + return orElse(); + } + + case "TimezoneMutationReturn": + if (timezoneMutationReturn != null) { + return timezoneMutationReturn(this + as Fragment$basicMutationReturnFields$$TimezoneMutationReturn); + } else { + return orElse(); + } + + case "UserMutationReturn": + if (userMutationReturn != null) { + return userMutationReturn( + this as Fragment$basicMutationReturnFields$$UserMutationReturn); + } else { + return orElse(); + } + + default: + return orElse(); + } + } } abstract class CopyWith$Fragment$basicMutationReturnFields { @@ -171,7 +343,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields final TRes Function(Fragment$basicMutationReturnFields) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -297,7 +469,7 @@ class Fragment$basicMutationReturnFields$$ApiKeyMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ApiKeyMutationReturn', }); factory Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.fromJson( @@ -428,7 +600,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -476,7 +648,7 @@ class Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'AutoUpgradeSettingsMutationReturn', }); factory Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.fromJson( @@ -612,7 +784,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutat Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -661,7 +833,7 @@ class Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'DeviceApiTokenMutationReturn', }); factory Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.fromJson( @@ -795,7 +967,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationRe final TRes Function( Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -843,7 +1015,7 @@ class Fragment$basicMutationReturnFields$$GenericJobButationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericJobButationReturn', }); factory Fragment$basicMutationReturnFields$$GenericJobButationReturn.fromJson( @@ -975,7 +1147,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn final TRes Function( Fragment$basicMutationReturnFields$$GenericJobButationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1023,7 +1195,7 @@ class Fragment$basicMutationReturnFields$$GenericMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Fragment$basicMutationReturnFields$$GenericMutationReturn.fromJson( @@ -1154,7 +1326,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1202,7 +1374,7 @@ class Fragment$basicMutationReturnFields$$ServiceJobMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceJobMutationReturn', }); factory Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.fromJson( @@ -1334,7 +1506,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn final TRes Function( Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1382,7 +1554,7 @@ class Fragment$basicMutationReturnFields$$ServiceMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceMutationReturn', }); factory Fragment$basicMutationReturnFields$$ServiceMutationReturn.fromJson( @@ -1513,7 +1685,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1561,7 +1733,7 @@ class Fragment$basicMutationReturnFields$$TimezoneMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'TimezoneMutationReturn', }); factory Fragment$basicMutationReturnFields$$TimezoneMutationReturn.fromJson( @@ -1693,7 +1865,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< final TRes Function( Fragment$basicMutationReturnFields$$TimezoneMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1741,7 +1913,7 @@ class Fragment$basicMutationReturnFields$$UserMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'UserMutationReturn', }); factory Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( @@ -1869,7 +2041,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn final TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1913,7 +2085,7 @@ class _CopyWithStubImpl$Fragment$basicMutationReturnFields$$UserMutationReturn< class Query$AllServices { Query$AllServices({ required this.services, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$AllServices.fromJson(Map json) { @@ -2006,7 +2178,7 @@ class _CopyWithImpl$Query$AllServices final TRes Function(Query$AllServices) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? services = _undefined, @@ -2225,6 +2397,10 @@ const documentNodeQueryAllServices = DocumentNode(definitions: [ ]); Query$AllServices _parserFn$Query$AllServices(Map data) => Query$AllServices.fromJson(data); +typedef OnQueryComplete$Query$AllServices = FutureOr Function( + Map?, + Query$AllServices?, +); class Options$Query$AllServices extends graphql.QueryOptions { @@ -2234,19 +2410,40 @@ class Options$Query$AllServices graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$AllServices? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$AllServices? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null ? null : _parserFn$Query$AllServices(data), + ), + onError: onError, document: documentNodeQueryAllServices, parserFn: _parserFn$Query$AllServices, ); + + final OnQueryComplete$Query$AllServices? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$AllServices @@ -2257,6 +2454,7 @@ class WatchOptions$Query$AllServices graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$AllServices? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -2267,7 +2465,7 @@ class WatchOptions$Query$AllServices fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQueryAllServices, pollInterval: pollInterval, @@ -2317,7 +2515,7 @@ extension ClientExtension$Query$AllServices on graphql.GraphQLClient { class Query$AllServices$services { Query$AllServices$services({ required this.allServices, - required this.$__typename, + this.$__typename = 'Services', }); factory Query$AllServices$services.fromJson(Map json) { @@ -2426,7 +2624,7 @@ class _CopyWithImpl$Query$AllServices$services final TRes Function(Query$AllServices$services) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? allServices = _undefined, @@ -2481,7 +2679,7 @@ class Query$AllServices$services$allServices { required this.storageUsage, required this.svgIcon, this.url, - required this.$__typename, + this.$__typename = 'Service', }); factory Query$AllServices$services$allServices.fromJson( @@ -2739,7 +2937,7 @@ class _CopyWithImpl$Query$AllServices$services$allServices final TRes Function(Query$AllServices$services$allServices) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? description = _undefined, @@ -2843,7 +3041,7 @@ class Query$AllServices$services$allServices$storageUsage { required this.title, required this.usedSpace, this.volume, - required this.$__typename, + this.$__typename = 'ServiceStorageUsage', }); factory Query$AllServices$services$allServices$storageUsage.fromJson( @@ -2976,7 +3174,7 @@ class _CopyWithImpl$Query$AllServices$services$allServices$storageUsage final TRes Function(Query$AllServices$services$allServices$storageUsage) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? title = _undefined, @@ -3035,7 +3233,7 @@ class _CopyWithStubImpl$Query$AllServices$services$allServices$storageUsage< class Query$AllServices$services$allServices$storageUsage$volume { Query$AllServices$services$allServices$storageUsage$volume({ required this.name, - required this.$__typename, + this.$__typename = 'StorageVolume', }); factory Query$AllServices$services$allServices$storageUsage$volume.fromJson( @@ -3139,7 +3337,7 @@ class _CopyWithImpl$Query$AllServices$services$allServices$storageUsage$volume< final TRes Function( Query$AllServices$services$allServices$storageUsage$volume) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? name = _undefined, @@ -3249,7 +3447,7 @@ class _CopyWithImpl$Variables$Mutation$EnableService final TRes Function(Variables$Mutation$EnableService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? serviceId = _undefined}) => _then(Variables$Mutation$EnableService._({ @@ -3271,7 +3469,7 @@ class _CopyWithStubImpl$Variables$Mutation$EnableService class Mutation$EnableService { Mutation$EnableService({ required this.enableService, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$EnableService.fromJson(Map json) { @@ -3365,7 +3563,7 @@ class _CopyWithImpl$Mutation$EnableService final TRes Function(Mutation$EnableService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? enableService = _undefined, @@ -3457,7 +3655,7 @@ Mutation$EnableService _parserFn$Mutation$EnableService( Map data) => Mutation$EnableService.fromJson(data); typedef OnMutationCompleted$Mutation$EnableService = FutureOr Function( - dynamic, + Map?, Mutation$EnableService?, ); @@ -3470,6 +3668,7 @@ class Options$Mutation$EnableService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$EnableService? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$EnableService? onCompleted, graphql.OnMutationUpdate? update, @@ -3481,7 +3680,7 @@ class Options$Mutation$EnableService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -3517,6 +3716,7 @@ class WatchOptions$Mutation$EnableService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$EnableService? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -3528,7 +3728,7 @@ class WatchOptions$Mutation$EnableService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationEnableService, pollInterval: pollInterval, @@ -3554,7 +3754,7 @@ class Mutation$EnableService$enableService required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceMutationReturn', }); factory Mutation$EnableService$enableService.fromJson( @@ -3677,7 +3877,7 @@ class _CopyWithImpl$Mutation$EnableService$enableService final TRes Function(Mutation$EnableService$enableService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -3793,7 +3993,7 @@ class _CopyWithImpl$Variables$Mutation$DisableService final TRes Function(Variables$Mutation$DisableService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? serviceId = _undefined}) => _then(Variables$Mutation$DisableService._({ @@ -3815,7 +4015,7 @@ class _CopyWithStubImpl$Variables$Mutation$DisableService class Mutation$DisableService { Mutation$DisableService({ required this.disableService, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$DisableService.fromJson(Map json) { @@ -3909,7 +4109,7 @@ class _CopyWithImpl$Mutation$DisableService final TRes Function(Mutation$DisableService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? disableService = _undefined, @@ -4001,7 +4201,7 @@ Mutation$DisableService _parserFn$Mutation$DisableService( Map data) => Mutation$DisableService.fromJson(data); typedef OnMutationCompleted$Mutation$DisableService = FutureOr Function( - dynamic, + Map?, Mutation$DisableService?, ); @@ -4014,6 +4214,7 @@ class Options$Mutation$DisableService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$DisableService? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$DisableService? onCompleted, graphql.OnMutationUpdate? update, @@ -4025,7 +4226,7 @@ class Options$Mutation$DisableService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -4061,6 +4262,7 @@ class WatchOptions$Mutation$DisableService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$DisableService? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -4072,7 +4274,7 @@ class WatchOptions$Mutation$DisableService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationDisableService, pollInterval: pollInterval, @@ -4098,7 +4300,7 @@ class Mutation$DisableService$disableService required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceMutationReturn', }); factory Mutation$DisableService$disableService.fromJson( @@ -4221,7 +4423,7 @@ class _CopyWithImpl$Mutation$DisableService$disableService final TRes Function(Mutation$DisableService$disableService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -4336,7 +4538,7 @@ class _CopyWithImpl$Variables$Mutation$StopService final TRes Function(Variables$Mutation$StopService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? serviceId = _undefined}) => _then(Variables$Mutation$StopService._({ @@ -4358,7 +4560,7 @@ class _CopyWithStubImpl$Variables$Mutation$StopService class Mutation$StopService { Mutation$StopService({ required this.stopService, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$StopService.fromJson(Map json) { @@ -4451,7 +4653,7 @@ class _CopyWithImpl$Mutation$StopService final TRes Function(Mutation$StopService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? stopService = _undefined, @@ -4543,7 +4745,7 @@ Mutation$StopService _parserFn$Mutation$StopService( Map data) => Mutation$StopService.fromJson(data); typedef OnMutationCompleted$Mutation$StopService = FutureOr Function( - dynamic, + Map?, Mutation$StopService?, ); @@ -4556,6 +4758,7 @@ class Options$Mutation$StopService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$StopService? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$StopService? onCompleted, graphql.OnMutationUpdate? update, @@ -4567,7 +4770,7 @@ class Options$Mutation$StopService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -4601,6 +4804,7 @@ class WatchOptions$Mutation$StopService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$StopService? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -4612,7 +4816,7 @@ class WatchOptions$Mutation$StopService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationStopService, pollInterval: pollInterval, @@ -4638,7 +4842,7 @@ class Mutation$StopService$stopService required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceMutationReturn', }); factory Mutation$StopService$stopService.fromJson(Map json) { @@ -4759,7 +4963,7 @@ class _CopyWithImpl$Mutation$StopService$stopService final TRes Function(Mutation$StopService$stopService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -4874,7 +5078,7 @@ class _CopyWithImpl$Variables$Mutation$StartService final TRes Function(Variables$Mutation$StartService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? serviceId = _undefined}) => _then(Variables$Mutation$StartService._({ @@ -4896,7 +5100,7 @@ class _CopyWithStubImpl$Variables$Mutation$StartService class Mutation$StartService { Mutation$StartService({ required this.startService, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$StartService.fromJson(Map json) { @@ -4989,7 +5193,7 @@ class _CopyWithImpl$Mutation$StartService final TRes Function(Mutation$StartService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? startService = _undefined, @@ -5081,7 +5285,7 @@ Mutation$StartService _parserFn$Mutation$StartService( Map data) => Mutation$StartService.fromJson(data); typedef OnMutationCompleted$Mutation$StartService = FutureOr Function( - dynamic, + Map?, Mutation$StartService?, ); @@ -5094,6 +5298,7 @@ class Options$Mutation$StartService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$StartService? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$StartService? onCompleted, graphql.OnMutationUpdate? update, @@ -5105,7 +5310,7 @@ class Options$Mutation$StartService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -5139,6 +5344,7 @@ class WatchOptions$Mutation$StartService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$StartService? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -5150,7 +5356,7 @@ class WatchOptions$Mutation$StartService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationStartService, pollInterval: pollInterval, @@ -5176,7 +5382,7 @@ class Mutation$StartService$startService required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceMutationReturn', }); factory Mutation$StartService$startService.fromJson( @@ -5299,7 +5505,7 @@ class _CopyWithImpl$Mutation$StartService$startService final TRes Function(Mutation$StartService$startService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -5415,7 +5621,7 @@ class _CopyWithImpl$Variables$Mutation$RestartService final TRes Function(Variables$Mutation$RestartService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? serviceId = _undefined}) => _then(Variables$Mutation$RestartService._({ @@ -5437,7 +5643,7 @@ class _CopyWithStubImpl$Variables$Mutation$RestartService class Mutation$RestartService { Mutation$RestartService({ required this.restartService, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$RestartService.fromJson(Map json) { @@ -5531,7 +5737,7 @@ class _CopyWithImpl$Mutation$RestartService final TRes Function(Mutation$RestartService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? restartService = _undefined, @@ -5623,7 +5829,7 @@ Mutation$RestartService _parserFn$Mutation$RestartService( Map data) => Mutation$RestartService.fromJson(data); typedef OnMutationCompleted$Mutation$RestartService = FutureOr Function( - dynamic, + Map?, Mutation$RestartService?, ); @@ -5636,6 +5842,7 @@ class Options$Mutation$RestartService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RestartService? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$RestartService? onCompleted, graphql.OnMutationUpdate? update, @@ -5647,7 +5854,7 @@ class Options$Mutation$RestartService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -5683,6 +5890,7 @@ class WatchOptions$Mutation$RestartService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RestartService? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -5694,7 +5902,7 @@ class WatchOptions$Mutation$RestartService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationRestartService, pollInterval: pollInterval, @@ -5720,7 +5928,7 @@ class Mutation$RestartService$restartService required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceMutationReturn', }); factory Mutation$RestartService$restartService.fromJson( @@ -5843,7 +6051,7 @@ class _CopyWithImpl$Mutation$RestartService$restartService final TRes Function(Mutation$RestartService$restartService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -5961,7 +6169,7 @@ class _CopyWithImpl$Variables$Mutation$MoveService final TRes Function(Variables$Mutation$MoveService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? input = _undefined}) => _then(Variables$Mutation$MoveService._({ @@ -5983,7 +6191,7 @@ class _CopyWithStubImpl$Variables$Mutation$MoveService class Mutation$MoveService { Mutation$MoveService({ required this.moveService, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$MoveService.fromJson(Map json) { @@ -6076,7 +6284,7 @@ class _CopyWithImpl$Mutation$MoveService final TRes Function(Mutation$MoveService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? moveService = _undefined, @@ -6260,7 +6468,7 @@ Mutation$MoveService _parserFn$Mutation$MoveService( Map data) => Mutation$MoveService.fromJson(data); typedef OnMutationCompleted$Mutation$MoveService = FutureOr Function( - dynamic, + Map?, Mutation$MoveService?, ); @@ -6273,6 +6481,7 @@ class Options$Mutation$MoveService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$MoveService? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$MoveService? onCompleted, graphql.OnMutationUpdate? update, @@ -6284,7 +6493,7 @@ class Options$Mutation$MoveService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -6318,6 +6527,7 @@ class WatchOptions$Mutation$MoveService graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$MoveService? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -6329,7 +6539,7 @@ class WatchOptions$Mutation$MoveService fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationMoveService, pollInterval: pollInterval, @@ -6355,7 +6565,7 @@ class Mutation$MoveService$moveService required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceJobMutationReturn', this.job, }); @@ -6495,7 +6705,7 @@ class _CopyWithImpl$Mutation$MoveService$moveService final TRes Function(Mutation$MoveService$moveService) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -6560,7 +6770,7 @@ class Mutation$MoveService$moveService$job { this.statusText, required this.uid, required this.updatedAt, - required this.$__typename, + this.$__typename = 'ApiJob', }); factory Mutation$MoveService$moveService$job.fromJson( @@ -6796,7 +7006,7 @@ class _CopyWithImpl$Mutation$MoveService$moveService$job final TRes Function(Mutation$MoveService$moveService$job) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? createdAt = _undefined, diff --git a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart index dbc8eccc..02cde074 100644 --- a/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/users.graphql.dart @@ -1,8 +1,8 @@ import 'dart:async'; +import 'disk_volumes.graphql.dart'; import 'package:gql/ast.dart'; import 'package:graphql/client.dart' as graphql; import 'schema.graphql.dart'; -import 'services.graphql.dart'; class Fragment$basicMutationReturnFields { Fragment$basicMutationReturnFields({ @@ -141,6 +141,177 @@ extension UtilityExtension$Fragment$basicMutationReturnFields this, (i) => i, ); + _T when<_T>({ + required _T Function( + Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) + apiKeyMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) + autoUpgradeSettingsMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) + deviceApiTokenMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$GenericJobButationReturn) + genericJobButationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$GenericMutationReturn) + genericMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) + serviceJobMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$ServiceMutationReturn) + serviceMutationReturn, + required _T Function( + Fragment$basicMutationReturnFields$$TimezoneMutationReturn) + timezoneMutationReturn, + required _T Function(Fragment$basicMutationReturnFields$$UserMutationReturn) + userMutationReturn, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ApiKeyMutationReturn": + return apiKeyMutationReturn( + this as Fragment$basicMutationReturnFields$$ApiKeyMutationReturn); + + case "AutoUpgradeSettingsMutationReturn": + return autoUpgradeSettingsMutationReturn(this + as Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn); + + case "DeviceApiTokenMutationReturn": + return deviceApiTokenMutationReturn(this + as Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn); + + case "GenericJobButationReturn": + return genericJobButationReturn(this + as Fragment$basicMutationReturnFields$$GenericJobButationReturn); + + case "GenericMutationReturn": + return genericMutationReturn( + this as Fragment$basicMutationReturnFields$$GenericMutationReturn); + + case "ServiceJobMutationReturn": + return serviceJobMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceJobMutationReturn); + + case "ServiceMutationReturn": + return serviceMutationReturn( + this as Fragment$basicMutationReturnFields$$ServiceMutationReturn); + + case "TimezoneMutationReturn": + return timezoneMutationReturn( + this as Fragment$basicMutationReturnFields$$TimezoneMutationReturn); + + case "UserMutationReturn": + return userMutationReturn( + this as Fragment$basicMutationReturnFields$$UserMutationReturn); + + default: + return orElse(); + } + } + + _T maybeWhen<_T>({ + _T Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn)? + apiKeyMutationReturn, + _T Function( + Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn)? + autoUpgradeSettingsMutationReturn, + _T Function( + Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn)? + deviceApiTokenMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$GenericJobButationReturn)? + genericJobButationReturn, + _T Function(Fragment$basicMutationReturnFields$$GenericMutationReturn)? + genericMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$ServiceJobMutationReturn)? + serviceJobMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn)? + serviceMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$TimezoneMutationReturn)? + timezoneMutationReturn, + _T Function(Fragment$basicMutationReturnFields$$UserMutationReturn)? + userMutationReturn, + required _T Function() orElse, + }) { + switch ($__typename) { + case "ApiKeyMutationReturn": + if (apiKeyMutationReturn != null) { + return apiKeyMutationReturn( + this as Fragment$basicMutationReturnFields$$ApiKeyMutationReturn); + } else { + return orElse(); + } + + case "AutoUpgradeSettingsMutationReturn": + if (autoUpgradeSettingsMutationReturn != null) { + return autoUpgradeSettingsMutationReturn(this + as Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn); + } else { + return orElse(); + } + + case "DeviceApiTokenMutationReturn": + if (deviceApiTokenMutationReturn != null) { + return deviceApiTokenMutationReturn(this + as Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn); + } else { + return orElse(); + } + + case "GenericJobButationReturn": + if (genericJobButationReturn != null) { + return genericJobButationReturn(this + as Fragment$basicMutationReturnFields$$GenericJobButationReturn); + } else { + return orElse(); + } + + case "GenericMutationReturn": + if (genericMutationReturn != null) { + return genericMutationReturn(this + as Fragment$basicMutationReturnFields$$GenericMutationReturn); + } else { + return orElse(); + } + + case "ServiceJobMutationReturn": + if (serviceJobMutationReturn != null) { + return serviceJobMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceJobMutationReturn); + } else { + return orElse(); + } + + case "ServiceMutationReturn": + if (serviceMutationReturn != null) { + return serviceMutationReturn(this + as Fragment$basicMutationReturnFields$$ServiceMutationReturn); + } else { + return orElse(); + } + + case "TimezoneMutationReturn": + if (timezoneMutationReturn != null) { + return timezoneMutationReturn(this + as Fragment$basicMutationReturnFields$$TimezoneMutationReturn); + } else { + return orElse(); + } + + case "UserMutationReturn": + if (userMutationReturn != null) { + return userMutationReturn( + this as Fragment$basicMutationReturnFields$$UserMutationReturn); + } else { + return orElse(); + } + + default: + return orElse(); + } + } } abstract class CopyWith$Fragment$basicMutationReturnFields { @@ -171,7 +342,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields final TRes Function(Fragment$basicMutationReturnFields) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -297,7 +468,7 @@ class Fragment$basicMutationReturnFields$$ApiKeyMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ApiKeyMutationReturn', }); factory Fragment$basicMutationReturnFields$$ApiKeyMutationReturn.fromJson( @@ -428,7 +599,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ApiKeyMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$ApiKeyMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -476,7 +647,7 @@ class Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'AutoUpgradeSettingsMutationReturn', }); factory Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn.fromJson( @@ -612,7 +783,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutat Fragment$basicMutationReturnFields$$AutoUpgradeSettingsMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -661,7 +832,7 @@ class Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'DeviceApiTokenMutationReturn', }); factory Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn.fromJson( @@ -795,7 +966,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$DeviceApiTokenMutationRe final TRes Function( Fragment$basicMutationReturnFields$$DeviceApiTokenMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -843,7 +1014,7 @@ class Fragment$basicMutationReturnFields$$GenericJobButationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericJobButationReturn', }); factory Fragment$basicMutationReturnFields$$GenericJobButationReturn.fromJson( @@ -975,7 +1146,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericJobButationReturn final TRes Function( Fragment$basicMutationReturnFields$$GenericJobButationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1023,7 +1194,7 @@ class Fragment$basicMutationReturnFields$$GenericMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Fragment$basicMutationReturnFields$$GenericMutationReturn.fromJson( @@ -1154,7 +1325,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$GenericMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$GenericMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1202,7 +1373,7 @@ class Fragment$basicMutationReturnFields$$ServiceJobMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceJobMutationReturn', }); factory Fragment$basicMutationReturnFields$$ServiceJobMutationReturn.fromJson( @@ -1334,7 +1505,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceJobMutationReturn final TRes Function( Fragment$basicMutationReturnFields$$ServiceJobMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1382,7 +1553,7 @@ class Fragment$basicMutationReturnFields$$ServiceMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'ServiceMutationReturn', }); factory Fragment$basicMutationReturnFields$$ServiceMutationReturn.fromJson( @@ -1513,7 +1684,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$ServiceMutationReturn< final TRes Function(Fragment$basicMutationReturnFields$$ServiceMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1561,7 +1732,7 @@ class Fragment$basicMutationReturnFields$$TimezoneMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'TimezoneMutationReturn', }); factory Fragment$basicMutationReturnFields$$TimezoneMutationReturn.fromJson( @@ -1693,7 +1864,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$TimezoneMutationReturn< final TRes Function( Fragment$basicMutationReturnFields$$TimezoneMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1741,7 +1912,7 @@ class Fragment$basicMutationReturnFields$$UserMutationReturn required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'UserMutationReturn', }); factory Fragment$basicMutationReturnFields$$UserMutationReturn.fromJson( @@ -1869,7 +2040,7 @@ class _CopyWithImpl$Fragment$basicMutationReturnFields$$UserMutationReturn final TRes Function(Fragment$basicMutationReturnFields$$UserMutationReturn) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -1915,7 +2086,7 @@ class Fragment$userFields { required this.username, required this.userType, required this.sshKeys, - required this.$__typename, + this.$__typename = 'User', }); factory Fragment$userFields.fromJson(Map json) { @@ -2041,7 +2212,7 @@ class _CopyWithImpl$Fragment$userFields final TRes Function(Fragment$userFields) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? username = _undefined, @@ -2161,7 +2332,7 @@ extension ClientExtension$Fragment$userFields on graphql.GraphQLClient { class Query$AllUsers { Query$AllUsers({ required this.users, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$AllUsers.fromJson(Map json) { @@ -2253,7 +2424,7 @@ class _CopyWithImpl$Query$AllUsers final TRes Function(Query$AllUsers) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? users = _undefined, @@ -2369,6 +2540,10 @@ const documentNodeQueryAllUsers = DocumentNode(definitions: [ ]); Query$AllUsers _parserFn$Query$AllUsers(Map data) => Query$AllUsers.fromJson(data); +typedef OnQueryComplete$Query$AllUsers = FutureOr Function( + Map?, + Query$AllUsers?, +); class Options$Query$AllUsers extends graphql.QueryOptions { Options$Query$AllUsers({ @@ -2377,19 +2552,40 @@ class Options$Query$AllUsers extends graphql.QueryOptions { graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$AllUsers? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$AllUsers? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null ? null : _parserFn$Query$AllUsers(data), + ), + onError: onError, document: documentNodeQueryAllUsers, parserFn: _parserFn$Query$AllUsers, ); + + final OnQueryComplete$Query$AllUsers? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$AllUsers @@ -2400,6 +2596,7 @@ class WatchOptions$Query$AllUsers graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$AllUsers? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -2410,7 +2607,7 @@ class WatchOptions$Query$AllUsers fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQueryAllUsers, pollInterval: pollInterval, @@ -2460,7 +2657,7 @@ class Query$AllUsers$users { Query$AllUsers$users({ required this.allUsers, this.rootUser, - required this.$__typename, + this.$__typename = 'Users', }); factory Query$AllUsers$users.fromJson(Map json) { @@ -2581,7 +2778,7 @@ class _CopyWithImpl$Query$AllUsers$users final TRes Function(Query$AllUsers$users) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? allUsers = _undefined, @@ -2712,7 +2909,7 @@ class _CopyWithImpl$Variables$Query$GetUser final TRes Function(Variables$Query$GetUser) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? username = _undefined}) => _then(Variables$Query$GetUser._({ @@ -2734,7 +2931,7 @@ class _CopyWithStubImpl$Variables$Query$GetUser class Query$GetUser { Query$GetUser({ required this.users, - required this.$__typename, + this.$__typename = 'Query', }); factory Query$GetUser.fromJson(Map json) { @@ -2825,7 +3022,7 @@ class _CopyWithImpl$Query$GetUser final TRes Function(Query$GetUser) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? users = _undefined, @@ -2929,6 +3126,10 @@ const documentNodeQueryGetUser = DocumentNode(definitions: [ ]); Query$GetUser _parserFn$Query$GetUser(Map data) => Query$GetUser.fromJson(data); +typedef OnQueryComplete$Query$GetUser = FutureOr Function( + Map?, + Query$GetUser?, +); class Options$Query$GetUser extends graphql.QueryOptions { Options$Query$GetUser({ @@ -2938,20 +3139,41 @@ class Options$Query$GetUser extends graphql.QueryOptions { graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$GetUser? typedOptimisticResult, Duration? pollInterval, graphql.Context? context, - }) : super( + OnQueryComplete$Query$GetUser? onComplete, + graphql.OnQueryError? onError, + }) : onCompleteWithParsed = onComplete, + super( variables: variables.toJson(), operationName: operationName, fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), pollInterval: pollInterval, context: context, + onComplete: onComplete == null + ? null + : (data) => onComplete( + data, + data == null ? null : _parserFn$Query$GetUser(data), + ), + onError: onError, document: documentNodeQueryGetUser, parserFn: _parserFn$Query$GetUser, ); + + final OnQueryComplete$Query$GetUser? onCompleteWithParsed; + + @override + List get properties => [ + ...super.onComplete == null + ? super.properties + : super.properties.where((property) => property != onComplete), + onCompleteWithParsed, + ]; } class WatchOptions$Query$GetUser @@ -2963,6 +3185,7 @@ class WatchOptions$Query$GetUser graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Query$GetUser? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -2974,7 +3197,7 @@ class WatchOptions$Query$GetUser fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeQueryGetUser, pollInterval: pollInterval, @@ -3034,7 +3257,7 @@ extension ClientExtension$Query$GetUser on graphql.GraphQLClient { class Query$GetUser$users { Query$GetUser$users({ this.getUser, - required this.$__typename, + this.$__typename = 'Users', }); factory Query$GetUser$users.fromJson(Map json) { @@ -3128,7 +3351,7 @@ class _CopyWithImpl$Query$GetUser$users final TRes Function(Query$GetUser$users) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? getUser = _undefined, @@ -3245,7 +3468,7 @@ class _CopyWithImpl$Variables$Mutation$CreateUser final TRes Function(Variables$Mutation$CreateUser) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? user = _undefined}) => _then(Variables$Mutation$CreateUser._({ @@ -3267,7 +3490,7 @@ class _CopyWithStubImpl$Variables$Mutation$CreateUser class Mutation$CreateUser { Mutation$CreateUser({ required this.createUser, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$CreateUser.fromJson(Map json) { @@ -3360,7 +3583,7 @@ class _CopyWithImpl$Mutation$CreateUser final TRes Function(Mutation$CreateUser) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? createUser = _undefined, @@ -3471,7 +3694,7 @@ const documentNodeMutationCreateUser = DocumentNode(definitions: [ Mutation$CreateUser _parserFn$Mutation$CreateUser(Map data) => Mutation$CreateUser.fromJson(data); typedef OnMutationCompleted$Mutation$CreateUser = FutureOr Function( - dynamic, + Map?, Mutation$CreateUser?, ); @@ -3484,6 +3707,7 @@ class Options$Mutation$CreateUser graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$CreateUser? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$CreateUser? onCompleted, graphql.OnMutationUpdate? update, @@ -3495,7 +3719,7 @@ class Options$Mutation$CreateUser fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -3529,6 +3753,7 @@ class WatchOptions$Mutation$CreateUser graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$CreateUser? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -3540,7 +3765,7 @@ class WatchOptions$Mutation$CreateUser fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationCreateUser, pollInterval: pollInterval, @@ -3566,7 +3791,7 @@ class Mutation$CreateUser$createUser required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'UserMutationReturn', this.user, }); @@ -3705,7 +3930,7 @@ class _CopyWithImpl$Mutation$CreateUser$createUser final TRes Function(Mutation$CreateUser$createUser) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -3833,7 +4058,7 @@ class _CopyWithImpl$Variables$Mutation$DeleteUser final TRes Function(Variables$Mutation$DeleteUser) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? username = _undefined}) => _then(Variables$Mutation$DeleteUser._({ @@ -3855,7 +4080,7 @@ class _CopyWithStubImpl$Variables$Mutation$DeleteUser class Mutation$DeleteUser { Mutation$DeleteUser({ required this.deleteUser, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$DeleteUser.fromJson(Map json) { @@ -3948,7 +4173,7 @@ class _CopyWithImpl$Mutation$DeleteUser final TRes Function(Mutation$DeleteUser) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? deleteUser = _undefined, @@ -4039,7 +4264,7 @@ const documentNodeMutationDeleteUser = DocumentNode(definitions: [ Mutation$DeleteUser _parserFn$Mutation$DeleteUser(Map data) => Mutation$DeleteUser.fromJson(data); typedef OnMutationCompleted$Mutation$DeleteUser = FutureOr Function( - dynamic, + Map?, Mutation$DeleteUser?, ); @@ -4052,6 +4277,7 @@ class Options$Mutation$DeleteUser graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$DeleteUser? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$DeleteUser? onCompleted, graphql.OnMutationUpdate? update, @@ -4063,7 +4289,7 @@ class Options$Mutation$DeleteUser fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -4097,6 +4323,7 @@ class WatchOptions$Mutation$DeleteUser graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$DeleteUser? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -4108,7 +4335,7 @@ class WatchOptions$Mutation$DeleteUser fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationDeleteUser, pollInterval: pollInterval, @@ -4134,7 +4361,7 @@ class Mutation$DeleteUser$deleteUser required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'GenericMutationReturn', }); factory Mutation$DeleteUser$deleteUser.fromJson(Map json) { @@ -4255,7 +4482,7 @@ class _CopyWithImpl$Mutation$DeleteUser$deleteUser final TRes Function(Mutation$DeleteUser$deleteUser) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -4373,7 +4600,7 @@ class _CopyWithImpl$Variables$Mutation$UpdateUser final TRes Function(Variables$Mutation$UpdateUser) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? user = _undefined}) => _then(Variables$Mutation$UpdateUser._({ @@ -4395,7 +4622,7 @@ class _CopyWithStubImpl$Variables$Mutation$UpdateUser class Mutation$UpdateUser { Mutation$UpdateUser({ required this.updateUser, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$UpdateUser.fromJson(Map json) { @@ -4488,7 +4715,7 @@ class _CopyWithImpl$Mutation$UpdateUser final TRes Function(Mutation$UpdateUser) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? updateUser = _undefined, @@ -4599,7 +4826,7 @@ const documentNodeMutationUpdateUser = DocumentNode(definitions: [ Mutation$UpdateUser _parserFn$Mutation$UpdateUser(Map data) => Mutation$UpdateUser.fromJson(data); typedef OnMutationCompleted$Mutation$UpdateUser = FutureOr Function( - dynamic, + Map?, Mutation$UpdateUser?, ); @@ -4612,6 +4839,7 @@ class Options$Mutation$UpdateUser graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$UpdateUser? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$UpdateUser? onCompleted, graphql.OnMutationUpdate? update, @@ -4623,7 +4851,7 @@ class Options$Mutation$UpdateUser fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -4657,6 +4885,7 @@ class WatchOptions$Mutation$UpdateUser graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$UpdateUser? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -4668,7 +4897,7 @@ class WatchOptions$Mutation$UpdateUser fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationUpdateUser, pollInterval: pollInterval, @@ -4694,7 +4923,7 @@ class Mutation$UpdateUser$updateUser required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'UserMutationReturn', this.user, }); @@ -4833,7 +5062,7 @@ class _CopyWithImpl$Mutation$UpdateUser$updateUser final TRes Function(Mutation$UpdateUser$updateUser) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -4964,7 +5193,7 @@ class _CopyWithImpl$Variables$Mutation$AddSshKey final TRes Function(Variables$Mutation$AddSshKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? sshInput = _undefined}) => _then(Variables$Mutation$AddSshKey._({ @@ -4986,7 +5215,7 @@ class _CopyWithStubImpl$Variables$Mutation$AddSshKey class Mutation$AddSshKey { Mutation$AddSshKey({ required this.addSshKey, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$AddSshKey.fromJson(Map json) { @@ -5079,7 +5308,7 @@ class _CopyWithImpl$Mutation$AddSshKey final TRes Function(Mutation$AddSshKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? addSshKey = _undefined, @@ -5190,7 +5419,7 @@ const documentNodeMutationAddSshKey = DocumentNode(definitions: [ Mutation$AddSshKey _parserFn$Mutation$AddSshKey(Map data) => Mutation$AddSshKey.fromJson(data); typedef OnMutationCompleted$Mutation$AddSshKey = FutureOr Function( - dynamic, + Map?, Mutation$AddSshKey?, ); @@ -5203,6 +5432,7 @@ class Options$Mutation$AddSshKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$AddSshKey? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$AddSshKey? onCompleted, graphql.OnMutationUpdate? update, @@ -5214,7 +5444,7 @@ class Options$Mutation$AddSshKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -5248,6 +5478,7 @@ class WatchOptions$Mutation$AddSshKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$AddSshKey? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -5259,7 +5490,7 @@ class WatchOptions$Mutation$AddSshKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationAddSshKey, pollInterval: pollInterval, @@ -5285,7 +5516,7 @@ class Mutation$AddSshKey$addSshKey required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'UserMutationReturn', this.user, }); @@ -5424,7 +5655,7 @@ class _CopyWithImpl$Mutation$AddSshKey$addSshKey final TRes Function(Mutation$AddSshKey$addSshKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, @@ -5555,7 +5786,7 @@ class _CopyWithImpl$Variables$Mutation$RemoveSshKey final TRes Function(Variables$Mutation$RemoveSshKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({Object? sshInput = _undefined}) => _then(Variables$Mutation$RemoveSshKey._({ @@ -5577,7 +5808,7 @@ class _CopyWithStubImpl$Variables$Mutation$RemoveSshKey class Mutation$RemoveSshKey { Mutation$RemoveSshKey({ required this.removeSshKey, - required this.$__typename, + this.$__typename = 'Mutation', }); factory Mutation$RemoveSshKey.fromJson(Map json) { @@ -5670,7 +5901,7 @@ class _CopyWithImpl$Mutation$RemoveSshKey final TRes Function(Mutation$RemoveSshKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? removeSshKey = _undefined, @@ -5782,7 +6013,7 @@ Mutation$RemoveSshKey _parserFn$Mutation$RemoveSshKey( Map data) => Mutation$RemoveSshKey.fromJson(data); typedef OnMutationCompleted$Mutation$RemoveSshKey = FutureOr Function( - dynamic, + Map?, Mutation$RemoveSshKey?, ); @@ -5795,6 +6026,7 @@ class Options$Mutation$RemoveSshKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RemoveSshKey? typedOptimisticResult, graphql.Context? context, OnMutationCompleted$Mutation$RemoveSshKey? onCompleted, graphql.OnMutationUpdate? update, @@ -5806,7 +6038,7 @@ class Options$Mutation$RemoveSshKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, onCompleted: onCompleted == null ? null @@ -5840,6 +6072,7 @@ class WatchOptions$Mutation$RemoveSshKey graphql.ErrorPolicy? errorPolicy, graphql.CacheRereadPolicy? cacheRereadPolicy, Object? optimisticResult, + Mutation$RemoveSshKey? typedOptimisticResult, graphql.Context? context, Duration? pollInterval, bool? eagerlyFetchResults, @@ -5851,7 +6084,7 @@ class WatchOptions$Mutation$RemoveSshKey fetchPolicy: fetchPolicy, errorPolicy: errorPolicy, cacheRereadPolicy: cacheRereadPolicy, - optimisticResult: optimisticResult, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), context: context, document: documentNodeMutationRemoveSshKey, pollInterval: pollInterval, @@ -5877,7 +6110,7 @@ class Mutation$RemoveSshKey$removeSshKey required this.code, required this.message, required this.success, - required this.$__typename, + this.$__typename = 'UserMutationReturn', this.user, }); @@ -6018,7 +6251,7 @@ class _CopyWithImpl$Mutation$RemoveSshKey$removeSshKey final TRes Function(Mutation$RemoveSshKey$removeSshKey) _then; - static const _undefined = {}; + static const _undefined = {}; TRes call({ Object? code = _undefined, diff --git a/lib/logic/api_maps/rest_maps/api_map.dart b/lib/logic/api_maps/rest_maps/api_map.dart index 299837fa..86f53e25 100644 --- a/lib/logic/api_maps/rest_maps/api_map.dart +++ b/lib/logic/api_maps/rest_maps/api_map.dart @@ -2,8 +2,8 @@ import 'dart:async'; import 'dart:developer'; import 'dart:io'; -import 'package:dio/adapter.dart'; import 'package:dio/dio.dart'; +import 'package:dio/io.dart'; import 'package:pretty_dio_logger/pretty_dio_logger.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/models/message.dart'; @@ -15,7 +15,7 @@ abstract class ApiMap { dio.interceptors.add(PrettyDioLogger()); } dio.interceptors.add(ConsoleInterceptor()); - (dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = + (dio.httpClientAdapter as IOHttpClientAdapter).onHttpClientCreate = (final HttpClient client) { client.badCertificateCallback = (final X509Certificate cert, final String host, final int port) => diff --git a/lib/main.dart b/lib/main.dart index b6e1dc31..e6358ba7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,12 +1,11 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:selfprivacy/config/brand_colors.dart'; import 'package:selfprivacy/config/hive_config.dart'; import 'package:selfprivacy/theming/factory/app_theme_factory.dart'; import 'package:selfprivacy/ui/router/router.dart'; -import 'package:wakelock/wakelock.dart'; +// import 'package:wakelock/wakelock.dart'; import 'package:timezone/data/latest.dart' as tz; import 'package:selfprivacy/config/bloc_config.dart'; @@ -20,13 +19,13 @@ void main() async { await HiveConfig.init(); // await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); - try { - /// Wakelock support for Linux - /// desktop is not yet implemented - await Wakelock.enable(); - } on PlatformException catch (e) { - print(e); - } + // try { + // /// Wakelock support for Linux + // /// desktop is not yet implemented + // await Wakelock.enable(); + // } on PlatformException catch (e) { + // print(e); + // } await getItSetup(); await EasyLocalization.ensureInitialized(); diff --git a/lib/ui/components/list_tiles/log_list_tile.dart b/lib/ui/components/list_tiles/log_list_tile.dart index 88505d8f..76bc6150 100644 --- a/lib/ui/components/list_tiles/log_list_tile.dart +++ b/lib/ui/components/list_tiles/log_list_tile.dart @@ -68,12 +68,13 @@ class _RestApiRequestMessageItem extends StatelessWidget { ), actions: [ // A button to copy the request to the clipboard - TextButton( - onPressed: () { - Clipboard.setData(ClipboardData(text: message.text)); - }, - child: Text('console_page.copy'.tr()), - ), + if (message.text != null) + TextButton( + onPressed: () { + Clipboard.setData(ClipboardData(text: message.text ?? '')); + }, + child: Text('console_page.copy'.tr()), + ), TextButton( onPressed: () => Navigator.of(context).pop(), child: Text('basis.close'.tr()), @@ -117,12 +118,13 @@ class _RestApiResponseMessageItem extends StatelessWidget { ), actions: [ // A button to copy the request to the clipboard - TextButton( - onPressed: () { - Clipboard.setData(ClipboardData(text: message.text)); - }, - child: Text('console_page.copy'.tr()), - ), + if (message.text != null) + TextButton( + onPressed: () { + Clipboard.setData(ClipboardData(text: message.text ?? '')); + }, + child: Text('console_page.copy'.tr()), + ), TextButton( onPressed: () => Navigator.of(context).pop(), child: Text('basis.close'.tr()), @@ -190,12 +192,13 @@ class _GraphQlResponseMessageItem extends StatelessWidget { ), actions: [ // A button to copy the request to the clipboard - TextButton( - onPressed: () { - Clipboard.setData(ClipboardData(text: message.text)); - }, - child: Text('console_page.copy'.tr()), - ), + if (message.text != null) + TextButton( + onPressed: () { + Clipboard.setData(ClipboardData(text: message.text ?? '')); + }, + child: Text('console_page.copy'.tr()), + ), TextButton( onPressed: () => Navigator.of(context).pop(), child: Text('basis.close'.tr()), @@ -258,12 +261,13 @@ class _GraphQlRequestMessageItem extends StatelessWidget { ), actions: [ // A button to copy the request to the clipboard - TextButton( - onPressed: () { - Clipboard.setData(ClipboardData(text: message.text)); - }, - child: Text('console_page.copy'.tr()), - ), + if (message.text != null) + TextButton( + onPressed: () { + Clipboard.setData(ClipboardData(text: message.text ?? '')); + }, + child: Text('console_page.copy'.tr()), + ), TextButton( onPressed: () => Navigator.of(context).pop(), child: Text('basis.close'.tr()), diff --git a/lib/ui/pages/setup/initializing/initializing.dart b/lib/ui/pages/setup/initializing/initializing.dart index 749fbdc9..54ca532c 100644 --- a/lib/ui/pages/setup/initializing/initializing.dart +++ b/lib/ui/pages/setup/initializing/initializing.dart @@ -11,7 +11,6 @@ import 'package:selfprivacy/logic/cubit/forms/setup/initializing/domain_setup_cu import 'package:selfprivacy/logic/cubit/forms/setup/initializing/root_user_form_cubit.dart'; import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; -import 'package:selfprivacy/ui/components/buttons/outlined_button.dart'; import 'package:selfprivacy/ui/components/brand_timer/brand_timer.dart'; import 'package:selfprivacy/ui/components/drawers/progress_drawer.dart'; import 'package:selfprivacy/ui/components/progress_bar/progress_bar.dart'; diff --git a/lib/ui/router/router.dart b/lib/ui/router/router.dart index 23a4ec0e..af0743ca 100644 --- a/lib/ui/router/router.dart +++ b/lib/ui/router/router.dart @@ -46,7 +46,8 @@ Widget fadeThroughTransition( replaceInRouteName: 'Page|Screen|Routing,Route', ) class RootRouter extends _$RootRouter { - RootRouter(GlobalKey super.navigatorKey); + RootRouter(final GlobalKey navigatorKey) + : super(navigatorKey: navigatorKey); @override RouteType get defaultRouteType => const RouteType.material(); diff --git a/lib/ui/router/router.gr.dart b/lib/ui/router/router.gr.dart index 675056f3..a4e919b6 100644 --- a/lib/ui/router/router.gr.dart +++ b/lib/ui/router/router.gr.dart @@ -10,20 +10,57 @@ part of 'router.dart'; abstract class _$RootRouter extends RootStackRouter { - _$RootRouter([GlobalKey? navigatorKey]) : super(navigatorKey); + // ignore: unused_element + _$RootRouter({super.navigatorKey}); @override final Map pagesMap = { - BackupDetailsRoute.name: (routeData) { + AppSettingsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const BackupDetailsPage(), + child: const AppSettingsPage(), ); }, - RootRoute.name: (routeData) { + DeveloperSettingsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: WrappedRoute(child: const RootPage()), + child: const DeveloperSettingsPage(), + ); + }, + ConsoleRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ConsolePage(), + ); + }, + MoreRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const MorePage(), + ); + }, + AboutApplicationRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const AboutApplicationPage(), + ); + }, + OnboardingRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const OnboardingPage(), + ); + }, + ProvidersRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ProvidersPage(), + ); + }, + ServerDetailsRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ServerDetailsScreen(), ); }, ServiceRoute.name: (routeData) { @@ -42,12 +79,6 @@ abstract class _$RootRouter extends RootStackRouter { child: const ServicesPage(), ); }, - ServerDetailsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ServerDetailsScreen(), - ); - }, UsersRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, @@ -70,46 +101,10 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, - AppSettingsRoute.name: (routeData) { + BackupDetailsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const AppSettingsPage(), - ); - }, - DeveloperSettingsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const DeveloperSettingsPage(), - ); - }, - MoreRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const MorePage(), - ); - }, - AboutApplicationRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const AboutApplicationPage(), - ); - }, - ConsoleRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ConsolePage(), - ); - }, - ProvidersRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ProvidersPage(), - ); - }, - RecoveryKeyRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const RecoveryKeyPage(), + child: const BackupDetailsPage(), ); }, DnsDetailsRoute.name: (routeData) { @@ -130,12 +125,26 @@ abstract class _$RootRouter extends RootStackRouter { child: const InitializingPage(), ); }, - ServerStorageRoute.name: (routeData) { - final args = routeData.argsAs(); + RecoveryKeyRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: ServerStoragePage( + child: const RecoveryKeyPage(), + ); + }, + DevicesRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const DevicesScreen(), + ); + }, + ServicesMigrationRoute.name: (routeData) { + final args = routeData.argsAs(); + return AutoRoutePage( + routeData: routeData, + child: ServicesMigrationPage( + services: args.services, diskStatus: args.diskStatus, + isMigration: args.isMigration, key: args.key, ), ); @@ -151,57 +160,133 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, - ServicesMigrationRoute.name: (routeData) { - final args = routeData.argsAs(); + ServerStorageRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: ServicesMigrationPage( - services: args.services, + child: ServerStoragePage( diskStatus: args.diskStatus, - isMigration: args.isMigration, key: args.key, ), ); }, - DevicesRoute.name: (routeData) { + RootRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const DevicesScreen(), - ); - }, - OnboardingRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const OnboardingPage(), + child: WrappedRoute(child: const RootPage()), ); }, }; } /// generated route for -/// [BackupDetailsPage] -class BackupDetailsRoute extends PageRouteInfo { - const BackupDetailsRoute({List? children}) +/// [AppSettingsPage] +class AppSettingsRoute extends PageRouteInfo { + const AppSettingsRoute({List? children}) : super( - BackupDetailsRoute.name, + AppSettingsRoute.name, initialChildren: children, ); - static const String name = 'BackupDetailsRoute'; + static const String name = 'AppSettingsRoute'; static const PageInfo page = PageInfo(name); } /// generated route for -/// [RootPage] -class RootRoute extends PageRouteInfo { - const RootRoute({List? children}) +/// [DeveloperSettingsPage] +class DeveloperSettingsRoute extends PageRouteInfo { + const DeveloperSettingsRoute({List? children}) : super( - RootRoute.name, + DeveloperSettingsRoute.name, initialChildren: children, ); - static const String name = 'RootRoute'; + static const String name = 'DeveloperSettingsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [ConsolePage] +class ConsoleRoute extends PageRouteInfo { + const ConsoleRoute({List? children}) + : super( + ConsoleRoute.name, + initialChildren: children, + ); + + static const String name = 'ConsoleRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [MorePage] +class MoreRoute extends PageRouteInfo { + const MoreRoute({List? children}) + : super( + MoreRoute.name, + initialChildren: children, + ); + + static const String name = 'MoreRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [AboutApplicationPage] +class AboutApplicationRoute extends PageRouteInfo { + const AboutApplicationRoute({List? children}) + : super( + AboutApplicationRoute.name, + initialChildren: children, + ); + + static const String name = 'AboutApplicationRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [OnboardingPage] +class OnboardingRoute extends PageRouteInfo { + const OnboardingRoute({List? children}) + : super( + OnboardingRoute.name, + initialChildren: children, + ); + + static const String name = 'OnboardingRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [ProvidersPage] +class ProvidersRoute extends PageRouteInfo { + const ProvidersRoute({List? children}) + : super( + ProvidersRoute.name, + initialChildren: children, + ); + + static const String name = 'ProvidersRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [ServerDetailsScreen] +class ServerDetailsRoute extends PageRouteInfo { + const ServerDetailsRoute({List? children}) + : super( + ServerDetailsRoute.name, + initialChildren: children, + ); + + static const String name = 'ServerDetailsRoute'; static const PageInfo page = PageInfo(name); } @@ -258,20 +343,6 @@ class ServicesRoute extends PageRouteInfo { static const PageInfo page = PageInfo(name); } -/// generated route for -/// [ServerDetailsScreen] -class ServerDetailsRoute extends PageRouteInfo { - const ServerDetailsRoute({List? children}) - : super( - ServerDetailsRoute.name, - initialChildren: children, - ); - - static const String name = 'ServerDetailsRoute'; - - static const PageInfo page = PageInfo(name); -} - /// generated route for /// [UsersPage] class UsersRoute extends PageRouteInfo { @@ -339,99 +410,15 @@ class UserDetailsRouteArgs { } /// generated route for -/// [AppSettingsPage] -class AppSettingsRoute extends PageRouteInfo { - const AppSettingsRoute({List? children}) +/// [BackupDetailsPage] +class BackupDetailsRoute extends PageRouteInfo { + const BackupDetailsRoute({List? children}) : super( - AppSettingsRoute.name, + BackupDetailsRoute.name, initialChildren: children, ); - static const String name = 'AppSettingsRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [DeveloperSettingsPage] -class DeveloperSettingsRoute extends PageRouteInfo { - const DeveloperSettingsRoute({List? children}) - : super( - DeveloperSettingsRoute.name, - initialChildren: children, - ); - - static const String name = 'DeveloperSettingsRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [MorePage] -class MoreRoute extends PageRouteInfo { - const MoreRoute({List? children}) - : super( - MoreRoute.name, - initialChildren: children, - ); - - static const String name = 'MoreRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [AboutApplicationPage] -class AboutApplicationRoute extends PageRouteInfo { - const AboutApplicationRoute({List? children}) - : super( - AboutApplicationRoute.name, - initialChildren: children, - ); - - static const String name = 'AboutApplicationRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [ConsolePage] -class ConsoleRoute extends PageRouteInfo { - const ConsoleRoute({List? children}) - : super( - ConsoleRoute.name, - initialChildren: children, - ); - - static const String name = 'ConsoleRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [ProvidersPage] -class ProvidersRoute extends PageRouteInfo { - const ProvidersRoute({List? children}) - : super( - ProvidersRoute.name, - initialChildren: children, - ); - - static const String name = 'ProvidersRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [RecoveryKeyPage] -class RecoveryKeyRoute extends PageRouteInfo { - const RecoveryKeyRoute({List? children}) - : super( - RecoveryKeyRoute.name, - initialChildren: children, - ); - - static const String name = 'RecoveryKeyRoute'; + static const String name = 'BackupDetailsRoute'; static const PageInfo page = PageInfo(name); } @@ -479,84 +466,31 @@ class InitializingRoute extends PageRouteInfo { } /// generated route for -/// [ServerStoragePage] -class ServerStorageRoute extends PageRouteInfo { - ServerStorageRoute({ - required DiskStatus diskStatus, - Key? key, - List? children, - }) : super( - ServerStorageRoute.name, - args: ServerStorageRouteArgs( - diskStatus: diskStatus, - key: key, - ), +/// [RecoveryKeyPage] +class RecoveryKeyRoute extends PageRouteInfo { + const RecoveryKeyRoute({List? children}) + : super( + RecoveryKeyRoute.name, initialChildren: children, ); - static const String name = 'ServerStorageRoute'; + static const String name = 'RecoveryKeyRoute'; - static const PageInfo page = - PageInfo(name); -} - -class ServerStorageRouteArgs { - const ServerStorageRouteArgs({ - required this.diskStatus, - this.key, - }); - - final DiskStatus diskStatus; - - final Key? key; - - @override - String toString() { - return 'ServerStorageRouteArgs{diskStatus: $diskStatus, key: $key}'; - } + static const PageInfo page = PageInfo(name); } /// generated route for -/// [ExtendingVolumePage] -class ExtendingVolumeRoute extends PageRouteInfo { - ExtendingVolumeRoute({ - required DiskVolume diskVolumeToResize, - required DiskStatus diskStatus, - Key? key, - List? children, - }) : super( - ExtendingVolumeRoute.name, - args: ExtendingVolumeRouteArgs( - diskVolumeToResize: diskVolumeToResize, - diskStatus: diskStatus, - key: key, - ), +/// [DevicesScreen] +class DevicesRoute extends PageRouteInfo { + const DevicesRoute({List? children}) + : super( + DevicesRoute.name, initialChildren: children, ); - static const String name = 'ExtendingVolumeRoute'; + static const String name = 'DevicesRoute'; - static const PageInfo page = - PageInfo(name); -} - -class ExtendingVolumeRouteArgs { - const ExtendingVolumeRouteArgs({ - required this.diskVolumeToResize, - required this.diskStatus, - this.key, - }); - - final DiskVolume diskVolumeToResize; - - final DiskStatus diskStatus; - - final Key? key; - - @override - String toString() { - return 'ExtendingVolumeRouteArgs{diskVolumeToResize: $diskVolumeToResize, diskStatus: $diskStatus, key: $key}'; - } + static const PageInfo page = PageInfo(name); } /// generated route for @@ -608,29 +542,96 @@ class ServicesMigrationRouteArgs { } /// generated route for -/// [DevicesScreen] -class DevicesRoute extends PageRouteInfo { - const DevicesRoute({List? children}) - : super( - DevicesRoute.name, +/// [ExtendingVolumePage] +class ExtendingVolumeRoute extends PageRouteInfo { + ExtendingVolumeRoute({ + required DiskVolume diskVolumeToResize, + required DiskStatus diskStatus, + Key? key, + List? children, + }) : super( + ExtendingVolumeRoute.name, + args: ExtendingVolumeRouteArgs( + diskVolumeToResize: diskVolumeToResize, + diskStatus: diskStatus, + key: key, + ), initialChildren: children, ); - static const String name = 'DevicesRoute'; + static const String name = 'ExtendingVolumeRoute'; - static const PageInfo page = PageInfo(name); + static const PageInfo page = + PageInfo(name); +} + +class ExtendingVolumeRouteArgs { + const ExtendingVolumeRouteArgs({ + required this.diskVolumeToResize, + required this.diskStatus, + this.key, + }); + + final DiskVolume diskVolumeToResize; + + final DiskStatus diskStatus; + + final Key? key; + + @override + String toString() { + return 'ExtendingVolumeRouteArgs{diskVolumeToResize: $diskVolumeToResize, diskStatus: $diskStatus, key: $key}'; + } } /// generated route for -/// [OnboardingPage] -class OnboardingRoute extends PageRouteInfo { - const OnboardingRoute({List? children}) - : super( - OnboardingRoute.name, +/// [ServerStoragePage] +class ServerStorageRoute extends PageRouteInfo { + ServerStorageRoute({ + required DiskStatus diskStatus, + Key? key, + List? children, + }) : super( + ServerStorageRoute.name, + args: ServerStorageRouteArgs( + diskStatus: diskStatus, + key: key, + ), initialChildren: children, ); - static const String name = 'OnboardingRoute'; + static const String name = 'ServerStorageRoute'; + + static const PageInfo page = + PageInfo(name); +} + +class ServerStorageRouteArgs { + const ServerStorageRouteArgs({ + required this.diskStatus, + this.key, + }); + + final DiskStatus diskStatus; + + final Key? key; + + @override + String toString() { + return 'ServerStorageRouteArgs{diskStatus: $diskStatus, key: $key}'; + } +} + +/// generated route for +/// [RootPage] +class RootRoute extends PageRouteInfo { + const RootRoute({List? children}) + : super( + RootRoute.name, + initialChildren: children, + ); + + static const String name = 'RootRoute'; static const PageInfo page = PageInfo(name); } diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 6140a508..13f6db44 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -13,7 +13,6 @@ import package_info import path_provider_foundation import shared_preferences_foundation import url_launcher_macos -import wakelock_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) @@ -24,5 +23,4 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) - WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 61417bab..bd81200b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "0c80aeab9bc807ab10022cd3b2f4cf2ecdf231949dc1ddd9442406a003f19201" + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a url: "https://pub.dev" source: hosted - version: "52.0.0" + version: "61.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: cd8ee83568a77f3ae6b913a36093a1c9b1264e7cb7f834d9ddd2311dade9c1f4 + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "5.13.0" animations: dependency: "direct main" description: @@ -45,26 +45,26 @@ packages: dependency: transitive description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" auto_route: dependency: "direct main" description: name: auto_route - sha256: "70b2461cc58d6a46c20859f23148b370165da183d21a82b783156f9a91d9c38b" + sha256: cf6cda303fd98608426fa429692a04f643146f981b1c0ac1033e3f0e11a1ed9c url: "https://pub.dev" source: hosted - version: "6.0.1" + version: "7.3.2" auto_route_generator: dependency: "direct dev" description: name: auto_route_generator - sha256: a3f11c3b1e6e884d1592924f3b7212855f1c7c8791c12d3b41b87ab81fb9d3b8 + sha256: d0555913cc54153c38b1dd4f69e0d6a623818ca7195e7c1437901d52b2596eec url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "7.1.1" auto_size_text: dependency: "direct main" description: @@ -77,18 +77,18 @@ packages: dependency: "direct main" description: name: basic_utils - sha256: "3e86a17d2aafbd52ef69c0dc8936b1bc7bd91bcd8fa1c0d222d13ca2f6d000bb" + sha256: "8815477fcf58499e42326bd858e391442425fa57db9a45e48e15224c62049262" url: "https://pub.dev" source: hosted - version: "5.4.2" + version: "5.5.4" bloc: dependency: transitive description: name: bloc - sha256: bd4f8027bfa60d96c8046dec5ce74c463b2c918dce1b0d36593575995344534a + sha256: "3820f15f502372d979121de1f6b97bfcf1630ebff8fe1d52fb2b0bfa49be5b49" url: "https://pub.dev" source: hosted - version: "8.1.0" + version: "8.1.2" boolean_selector: dependency: transitive description: @@ -117,10 +117,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "6bc5544ea6ce4428266e7ea680e945c68806c4aae2da0eb5e9ccf38df8d6acbf" + sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "4.0.0" build_resolvers: dependency: transitive description: @@ -133,10 +133,10 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: b0a8a7b8a76c493e85f1b84bffa0588859a06197863dba8c9036b15581fd9727 + sha256: "220ae4553e50d7c21a17c051afc7b183d28a24a420502e842f303f8e4e6edced" url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "2.4.4" build_runner_core: dependency: transitive description: @@ -165,10 +165,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" checked_yaml: dependency: transitive description: @@ -177,6 +177,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 + url: "https://pub.dev" + source: hosted + version: "0.4.0" clock: dependency: transitive description: @@ -197,10 +205,10 @@ packages: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.1" connectivity_plus: dependency: transitive description: @@ -237,10 +245,10 @@ packages: dependency: "direct main" description: name: crypt - sha256: c12682393cc6aae221e278692d8a433e188db2064b7de5daa253fd62ccfa096f + sha256: fef2b24f8fb73b626224b207b2e57ac139d38b63dc7428257f820a2fd9e4688b url: "https://pub.dev" source: hosted - version: "4.2.1" + version: "4.3.0" crypto: dependency: transitive description: @@ -277,10 +285,10 @@ packages: dependency: "direct main" description: name: device_info_plus - sha256: "7ff671ed0a6356fa8f2e1ae7d3558d3fb7b6a41e24455e4f8df75b811fb8e4ab" + sha256: "2c35b6d1682b028e42d07b3aee4b98fa62996c10bc12cb651ec856a80d6a761b" url: "https://pub.dev" source: hosted - version: "8.0.0" + version: "9.0.2" device_info_plus_platform_interface: dependency: transitive description: @@ -293,26 +301,26 @@ packages: dependency: "direct main" description: name: dio - sha256: "7d328c4d898a61efc3cd93655a0955858e29a0aa647f0f9e02d59b3bb275e2e8" + sha256: "347d56c26d63519552ef9a569f2a593dda99a81fdbdff13c584b7197cfe05059" url: "https://pub.dev" source: hosted - version: "4.0.6" + version: "5.1.2" dynamic_color: dependency: "direct main" description: name: dynamic_color - sha256: c4a508284b14ec4dda5adba2c28b2cdd34fbae1afead7e8c52cad87d51c5405b + sha256: "74dff1435a695887ca64899b8990004f8d1232b0e84bfc4faa1fdda7c6f57cc1" url: "https://pub.dev" source: hosted - version: "1.6.2" + version: "1.6.5" easy_localization: dependency: "direct main" description: name: easy_localization - sha256: "6a2e99fa0bfe5765bf4c6ca9b137d5de2c75593007178c5e4cd2ae985f870080" + sha256: "30ebf25448ffe169e0bd9bc4b5da94faa8398967a2ad2ca09f438be8b6953645" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" easy_logger: dependency: transitive description: @@ -381,10 +389,10 @@ packages: dependency: "direct main" description: name: fl_chart - sha256: "29da130cdef13f47e1798a66e99fd119e557c293b98be8ebaf6fed2cbc43bf29" + sha256: "48a1b69be9544e2b03d9a8e843affd89e43f3194c9248776222efcb4206bb1ec" url: "https://pub.dev" source: hosted - version: "0.50.6" + version: "0.62.0" flutter: dependency: "direct main" description: flutter @@ -394,10 +402,10 @@ packages: dependency: "direct main" description: name: flutter_bloc - sha256: "890c51c8007f0182360e523518a0c732efb89876cb4669307af7efada5b55557" + sha256: e74efb89ee6945bcbce74a5b3a5a3376b088e5f21f55c263fc38cbdc6237faae url: "https://pub.dev" source: hosted - version: "8.1.1" + version: "8.1.3" flutter_hooks: dependency: transitive description: @@ -410,10 +418,10 @@ packages: dependency: "direct dev" description: name: flutter_launcher_icons - sha256: "559c600f056e7c704bd843723c21e01b5fba47e8824bd02422165bcc02a5de1d" + sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea" url: "https://pub.dev" source: hosted - version: "0.9.3" + version: "0.13.1" flutter_lints: dependency: "direct dev" description: @@ -431,10 +439,10 @@ packages: dependency: "direct main" description: name: flutter_markdown - sha256: "818cf6c28377ba2c91ed283c96fd712e9c175dd2d2488eb7fc93b6afb9ad2e08" + sha256: "7b25c10de1fea883f3c4f9b8389506b54053cd00807beab69fd65c8653a2711f" url: "https://pub.dev" source: hosted - version: "0.6.13+1" + version: "0.6.14" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -447,26 +455,26 @@ packages: dependency: "direct main" description: name: flutter_secure_storage - sha256: f2afec1f1762c040a349ea2a588e32f442da5d0db3494a52a929a97c9e550bc5 + sha256: "98352186ee7ad3639ccc77ad7924b773ff6883076ab952437d20f18a61f0a7c5" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "8.0.0" flutter_secure_storage_linux: dependency: transitive description: name: flutter_secure_storage_linux - sha256: "736436adaf91552433823f51ce22e098c2f0551db06b6596f58597a25b8ea797" + sha256: "0912ae29a572230ad52d8a4697e5518d7f0f429052fd51df7e5a7952c7efe2a3" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.1.3" flutter_secure_storage_macos: dependency: transitive description: name: flutter_secure_storage_macos - sha256: ff0768a6700ea1d9620e03518e2e25eac86a8bd07ca3556e9617bfa5ace4bd00 + sha256: "083add01847fc1c80a07a08e1ed6927e9acd9618a35e330239d4422cd2a58c50" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.0" flutter_secure_storage_platform_interface: dependency: transitive description: @@ -487,18 +495,18 @@ packages: dependency: transitive description: name: flutter_secure_storage_windows - sha256: ca89c8059cf439985aa83c59619b3674c7ef6cc2e86943d169a7369d6a69cab5 + sha256: fc2910ec9b28d60598216c29ea763b3a96c401f0ce1d13cdf69ccb0e5c93c3ee url: "https://pub.dev" source: hosted - version: "1.1.3" + version: "2.0.0" flutter_svg: dependency: "direct main" description: name: flutter_svg - sha256: f999d84ad2efda1c4c3956e7968b713b3a24b06f0a0e4798e844e16bbb9bb70b + sha256: "6ff8c902c8056af9736de2689f63f81c42e2d642b9f4c79dbf8790ae48b63012" url: "https://pub.dev" source: hosted - version: "2.0.0+1" + version: "2.0.6" flutter_test: dependency: "direct dev" description: flutter @@ -521,10 +529,10 @@ packages: dependency: "direct main" description: name: get_it - sha256: "290fde3a86072e4b37dbb03c07bec6126f0ecc28dad403c12ffe2e5a2d751ab7" + sha256: "529de303c739fca98cd7ece5fca500d8ff89649f1bb4b4e94fb20954abcd7468" url: "https://pub.dev" source: hosted - version: "7.2.0" + version: "7.6.0" glob: dependency: transitive description: @@ -537,90 +545,90 @@ packages: dependency: "direct main" description: name: gql - sha256: "0db9fcebe50d919ff7d872b70f035722771b0789cdee17c8aa27e850445592a9" + sha256: "7dd48a2632103154186bf77adb850489efdabe65c05313eab784657df800794a" url: "https://pub.dev" source: hosted - version: "0.14.1-alpha+1672756470474" + version: "1.0.1-alpha+1682715291314" gql_code_builder: dependency: transitive description: name: gql_code_builder - sha256: "654fc5f455938d721f88631ce2e0d9350058bc6e965a22df6dd5668c72cd19c0" + sha256: "6e386a85f5d91daae82915337f566a43dfeb0a0df38caa372387fbc07d31b8c1" url: "https://pub.dev" source: hosted - version: "0.6.1-alpha+1667318637890" + version: "0.7.2" gql_dedupe_link: dependency: transitive description: name: gql_dedupe_link - sha256: "89681048cf956348e865da872a40081499b8c087fc84dd4d4b9c134bd70d27b3" + sha256: "2c76b1006cd7445e026d3bc46c6336f28cbcf3711326f128839cfc746f9e2ec9" url: "https://pub.dev" source: hosted - version: "2.0.3+1" + version: "2.0.4-alpha+1682715291398" gql_error_link: dependency: transitive description: name: gql_error_link - sha256: e7bfdd2b6232f3e15861cd96c2ad6b7c9c94693843b3dea18295136a5fb5b534 + sha256: bfdb543137da89448cc5d003fd029c2e8718931d39d4a7dedb16f9169862fbb9 url: "https://pub.dev" source: hosted - version: "0.2.3+1" + version: "1.0.0" gql_exec: dependency: transitive description: name: gql_exec - sha256: "0d1fdb2e4154efbfc1dcf3f35ec36d19c8428ff0d560eb4c45b354f8f871dc50" + sha256: "07f73f4edc00698f67c3fb5bda0d95ab7e6ea844572a670ef270154244fae6d4" url: "https://pub.dev" source: hosted - version: "0.4.3" + version: "1.0.1-alpha+1682715291324" gql_http_link: dependency: transitive description: name: gql_http_link - sha256: "89ef87b32947acf4189f564c095f1148b0ab9bb9996fe518716dbad66708b834" + sha256: "365c0e72da7e29e007c4a0ed7a470f6c03af1ef00acd2af3c22157c8bb47f314" url: "https://pub.dev" source: hosted - version: "0.4.5" + version: "1.0.0" gql_link: dependency: transitive description: name: gql_link - sha256: f7973279126bc922d465c4f4da6ed93d187085e597b3480f5e14e74d28fe14bd + sha256: ee781e59527240adf69e044389a7d0a19b890a6e76b6dfff969ef56ba8d4fea7 url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "1.0.1-alpha+1682715291332" gql_transform_link: dependency: transitive description: name: gql_transform_link - sha256: b1735a9a92d25a92960002a8b40dfaede95ec1e5ed848906125d69efd878661f + sha256: "0645fdd874ca1be695fd327271fdfb24c0cd6fa40774a64b946062f321a59709" url: "https://pub.dev" source: hosted - version: "0.2.2+1" + version: "1.0.0" graphql: dependency: "direct main" description: name: graphql - sha256: b061201579040e9548cec2bae17bbdea0ab30666cb4e7ba48b9675f14d982199 + sha256: f2529e2f606f445bbb38b92c6eb18dd4c11196ca638421fe5aaab62140ac3106 url: "https://pub.dev" source: hosted - version: "5.1.3" + version: "5.2.0-beta.3" graphql_codegen: dependency: "direct main" description: name: graphql_codegen - sha256: d8b5b70f3d0c6db6eec6e610185604a128fb275943543036cbce3f606d49cd77 + sha256: "773dce58e9bce208a8694badc1af9fe39870bb2cb18078474ba5c2b6a535f87c" url: "https://pub.dev" source: hosted - version: "0.12.0-beta.7" + version: "0.13.0" graphql_flutter: dependency: "direct main" description: name: graphql_flutter - sha256: "06059ac9e8417c71582f05e28a59b1416d43959d34a6a0d9565341e3a362e117" + sha256: "9de0365b58c8733130a706e9fddb33f6791d9bbbee45e1cd1bc2ca0920941a19" url: "https://pub.dev" source: hosted - version: "5.1.2" + version: "5.2.0-beta.3" graphs: dependency: transitive description: @@ -681,18 +689,18 @@ packages: dependency: transitive description: name: image - sha256: "8e9d133755c3e84c73288363e6343157c383a0c6c56fc51afcc5d4d7180306d6" + sha256: a72242c9a0ffb65d03de1b7113bc4e189686fc07c7147b8b41811d0dd0e0d9bf url: "https://pub.dev" source: hosted - version: "3.3.0" + version: "4.0.17" intl: dependency: "direct main" description: name: intl - sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" + sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6 url: "https://pub.dev" source: hosted - version: "0.17.0" + version: "0.18.0" io: dependency: transitive description: @@ -713,26 +721,26 @@ packages: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" json_annotation: dependency: "direct main" description: name: json_annotation - sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317 + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 url: "https://pub.dev" source: hosted - version: "4.8.0" + version: "4.8.1" json_serializable: dependency: "direct dev" description: name: json_serializable - sha256: dadc08bd61f72559f938dd08ec20dbfec6c709bba83515085ea943d2078d187a + sha256: "61a60716544392a82726dd0fa1dd6f5f1fd32aec66422b6e229e7b90d52325c4" url: "https://pub.dev" source: hosted - version: "6.6.1" + version: "6.7.0" lints: dependency: transitive description: @@ -745,10 +753,10 @@ packages: dependency: "direct main" description: name: local_auth - sha256: "8cea55dca20d1e0efa5480df2d47ae30851e7a24cb8e7d225be7e67ae8485aa4" + sha256: "0cf238be2bfa51a6c9e7e9cfc11c05ea39f2a3a4d3e5bb255d0ebc917da24401" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.6" local_auth_android: dependency: transitive description: @@ -793,10 +801,10 @@ packages: dependency: transitive description: name: markdown - sha256: c2b81e184067b41d0264d514f7cdaa2c02d38511e39d6521a1ccc238f6d7b3f2 + sha256: "8e332924094383133cee218b676871f42db2514f1f6ac617b6cf6152a7faab8e" url: "https://pub.dev" source: hosted - version: "6.0.1" + version: "7.1.0" mask_text_input_formatter: dependency: transitive description: @@ -809,10 +817,10 @@ packages: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.15" material_color_utilities: dependency: "direct main" description: @@ -825,10 +833,10 @@ packages: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" mime: dependency: transitive description: @@ -881,10 +889,10 @@ packages: dependency: transitive description: name: normalize - sha256: baf8caf2d8b745af5737cca6c24f7fe3cf3158897fdbcde9a909b9c8d3e2e5af + sha256: "8a60e37de5b608eeaf9b839273370c71ebba445e9f73b08eee7725e0d92dbc43" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.8.2+1" package_config: dependency: transitive description: @@ -905,10 +913,10 @@ packages: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" path_parsing: dependency: transitive description: @@ -961,18 +969,18 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c + sha256: d3f80b32e83ec208ac95253e0cd4d298e104fbc63cb29c5c69edaed43b0c69d6 url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.6" petitparser: dependency: transitive description: name: petitparser - sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4" + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.4.0" platform: dependency: transitive description: @@ -993,10 +1001,10 @@ packages: dependency: transitive description: name: pointycastle - sha256: db7306cf0249f838d1a24af52b5a5887c5bf7f31d8bb4e827d071dc0939ad346 + sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" url: "https://pub.dev" source: hosted - version: "3.6.2" + version: "3.7.3" pool: dependency: transitive description: @@ -1009,10 +1017,10 @@ packages: dependency: "direct main" description: name: pretty_dio_logger - sha256: "948f7eeb36e7aa0760b51c1a8e3331d4b21e36fabd39efca81f585ed93893544" + sha256: "00b80053063935cf9a6190da344c5373b9d0e92da4c944c878ff2fbef0ef6dc2" url: "https://pub.dev" source: hosted - version: "1.2.0-beta-1" + version: "1.3.1" process: dependency: transitive description: @@ -1033,10 +1041,10 @@ packages: dependency: "direct main" description: name: pub_semver - sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" pubspec_parse: dependency: transitive description: @@ -1158,10 +1166,10 @@ packages: dependency: transitive description: name: source_gen - sha256: c2bea18c95cfa0276a366270afaa2850b09b4a76db95d546f3d003dcc7011298 + sha256: "373f96cf5a8744bc9816c1ff41cf5391bbdbe3d7a96fe98c622b6738a8a7bd33" url: "https://pub.dev" source: hosted - version: "1.2.7" + version: "1.3.2" source_helper: dependency: transitive description: @@ -1238,34 +1246,34 @@ packages: dependency: transitive description: name: test - sha256: a5fcd2d25eeadbb6589e80198a47d6a464ba3e2049da473943b8af9797900c2d + sha256: "3dac9aecf2c3991d09b9cdde4f98ded7b30804a88a0d7e4e7e1678e78d6b97f4" url: "https://pub.dev" source: hosted - version: "1.22.0" + version: "1.24.1" test_api: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.5.1" test_core: dependency: transitive description: name: test_core - sha256: "0ef9755ec6d746951ba0aabe62f874b707690b5ede0fecc818b138fcc9b14888" + sha256: "5138dbffb77b2289ecb12b81c11ba46036590b72a64a7a90d6ffb880f1a29e93" url: "https://pub.dev" source: hosted - version: "0.4.20" + version: "0.5.1" timezone: dependency: "direct main" description: name: timezone - sha256: "24c8fcdd49a805d95777a39064862133ff816ebfffe0ceff110fb5960e557964" + sha256: "1cfd8ddc2d1cfd836bc93e67b9be88c3adaeca6f40a00ca999104c30693cdca0" url: "https://pub.dev" source: hosted - version: "0.9.1" + version: "0.9.2" timing: dependency: transitive description: @@ -1286,10 +1294,10 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: "698fa0b4392effdc73e9e184403b627362eb5fbf904483ac9defbb1c2191d809" + sha256: eb1e00ab44303d50dd487aab67ebc575456c146c6af44422f9c13889984c00f3 url: "https://pub.dev" source: hosted - version: "6.1.8" + version: "6.1.11" url_launcher_android: dependency: transitive description: @@ -1358,26 +1366,26 @@ packages: dependency: transitive description: name: vector_graphics - sha256: "09562ef5f47aa84f6567495adb6b9cb2a3192b82c352623b8bd00b300d62603b" + sha256: b96f10cbdfcbd03a65758633a43e7d04574438f059b1043104b5d61b23d38a4f url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.6" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: "886e57742644ebed024dc3ade29712e37eea1b03d294fb314c0a3386243fe5a6" + sha256: "57a8e6e24662a3bdfe3b3d61257db91768700c0b8f844e235877b56480f31c69" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.6" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: "5d9010c4a292766c55395b2288532579a85673f8148460d1e233d98ffe10d24e" + sha256: "7430f5d834d0db4560d7b19863362cd892f1e52b43838553a3c5cdfc9ab28e5b" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.6" vector_math: dependency: transitive description: @@ -1394,46 +1402,6 @@ packages: url: "https://pub.dev" source: hosted version: "9.4.0" - wakelock: - dependency: "direct main" - description: - name: wakelock - sha256: "769ecf42eb2d07128407b50cb93d7c10bd2ee48f0276ef0119db1d25cc2f87db" - url: "https://pub.dev" - source: hosted - version: "0.6.2" - wakelock_macos: - dependency: transitive - description: - name: wakelock_macos - sha256: "047c6be2f88cb6b76d02553bca5a3a3b95323b15d30867eca53a19a0a319d4cd" - url: "https://pub.dev" - source: hosted - version: "0.4.0" - wakelock_platform_interface: - dependency: transitive - description: - name: wakelock_platform_interface - sha256: "1f4aeb81fb592b863da83d2d0f7b8196067451e4df91046c26b54a403f9de621" - url: "https://pub.dev" - source: hosted - version: "0.3.0" - wakelock_web: - dependency: transitive - description: - name: wakelock_web - sha256: "1b256b811ee3f0834888efddfe03da8d18d0819317f20f6193e2922b41a501b5" - url: "https://pub.dev" - source: hosted - version: "0.4.0" - wakelock_windows: - dependency: transitive - description: - name: wakelock_windows - sha256: "857f77b3fe6ae82dd045455baa626bc4b93cb9bb6c86bf3f27c182167c3a5567" - url: "https://pub.dev" - source: hosted - version: "0.2.1" watcher: dependency: transitive description: @@ -1446,10 +1414,10 @@ packages: dependency: transitive description: name: web_socket_channel - sha256: "3a969ddcc204a3e34e863d204b29c0752716f78b6f9cc8235083208d268a4ccd" + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.4.0" webkit_inspection_protocol: dependency: transitive description: @@ -1462,10 +1430,18 @@ packages: dependency: transitive description: name: win32 - sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 + sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "4.1.4" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "1c52f994bdccb77103a6231ad4ea331a244dbcef5d1f37d8462f713143b0bfae" + url: "https://pub.dev" + source: hosted + version: "1.1.0" xdg_directories: dependency: transitive description: @@ -1478,10 +1454,10 @@ packages: dependency: transitive description: name: xml - sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5" + sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.3.0" yaml: dependency: transitive description: @@ -1491,5 +1467,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.19.0 <3.0.0" - flutter: ">=3.7.0" + dart: ">=3.0.2 <4.0.0" + flutter: ">=3.10.2" diff --git a/pubspec.yaml b/pubspec.yaml index 2055494c..b0554aba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,60 +4,61 @@ publish_to: 'none' version: 0.8.0+17 environment: - sdk: '>=2.19.0 <3.0.0' - flutter: ">=3.7.0" + sdk: '>=3.0.2 <4.0.0' + flutter: ">=3.10.2" dependencies: animations: ^2.0.7 - auto_route: ^6.0.1 + auto_route: ^7.3.2 auto_size_text: ^3.0.0 - basic_utils: ^5.4.2 - crypt: ^4.2.1 + basic_utils: ^5.5.4 + crypt: ^4.3.0 cubit_form: ^2.0.1 - device_info_plus: ^8.0.0 - dio: ^4.0.4 - dynamic_color: ^1.6.2 - easy_localization: ^3.0.1 + device_info_plus: ^9.0.2 + dio: ^5.1.2 + dynamic_color: ^1.6.5 + easy_localization: ^3.0.2 either_option: ^2.0.1-dev.1 equatable: ^2.0.5 - fl_chart: ^0.50.1 + fl_chart: ^0.62.0 flutter: sdk: flutter - flutter_bloc: ^8.1.1 - flutter_markdown: ^0.6.13+1 - flutter_secure_storage: ^7.0.1 - flutter_svg: ^2.0.0+1 - get_it: ^7.2.0 - gql: ^0.14.0 + flutter_bloc: ^8.1.3 + flutter_markdown: ^0.6.14 + flutter_secure_storage: ^8.0.0 + flutter_svg: ^2.0.6 + get_it: ^7.6.0 + gql: ^1.0.0 graphql: ^5.1.2 - graphql_codegen: ^0.12.0-beta.7 + graphql_codegen: ^0.13.0 graphql_flutter: ^5.1.2 hive: ^2.2.3 hive_flutter: ^1.1.0 http: ^0.13.5 - intl: ^0.17.0 + intl: ^0.18.0 ionicons: ^0.2.2 - json_annotation: ^4.8.0 - local_auth: ^2.1.3 + json_annotation: ^4.8.1 + local_auth: ^2.1.6 material_color_utilities: ^0.2.0 modal_bottom_sheet: ^3.0.0-pre nanoid: ^1.0.0 package_info: ^2.0.2 - pretty_dio_logger: ^1.2.0-beta-1 + pretty_dio_logger: ^1.3.1 provider: ^6.0.5 - pub_semver: ^2.1.3 - timezone: ^0.9.1 - url_launcher: ^6.1.8 - wakelock: ^0.6.2 + pub_semver: ^2.1.4 + timezone: ^0.9.2 + url_launcher: ^6.1.11 + # TODO: Developer is not available, update later. +# wakelock: ^0.6.2 dev_dependencies: - auto_route_generator: ^6.0.0 + auto_route_generator: ^7.1.1 flutter_test: sdk: flutter - build_runner: ^2.3.3 - flutter_launcher_icons: ^0.9.2 + build_runner: ^2.4.4 + flutter_launcher_icons: ^0.13.1 hive_generator: ^2.0.0 - json_serializable: ^6.6.1 + json_serializable: ^6.7.0 flutter_lints: ^2.0.1 flutter_icons: From 370cbf105269d3f838bff573f19058c5d808049f Mon Sep 17 00:00:00 2001 From: Inex Code Date: Tue, 30 May 2023 20:52:42 +0300 Subject: [PATCH 14/15] fix(ui): Button margins --- lib/ui/components/buttons/brand_button.dart | 4 +++- .../components/buttons/outlined_button.dart | 4 +++- .../setup/initializing/initializing.dart | 23 ++++++++----------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/ui/components/buttons/brand_button.dart b/lib/ui/components/buttons/brand_button.dart index 12c7c132..a07a1de0 100644 --- a/lib/ui/components/buttons/brand_button.dart +++ b/lib/ui/components/buttons/brand_button.dart @@ -32,12 +32,14 @@ class BrandButton { assert(text != null || child != null, 'required title or child'); return ConstrainedBox( constraints: const BoxConstraints( - minHeight: 40, minWidth: double.infinity, ), child: FilledButton( key: key, onPressed: onPressed, + style: ElevatedButton.styleFrom( + tapTargetSize: MaterialTapTargetSize.padded, + ), child: child ?? Text(text ?? ''), ), ); diff --git a/lib/ui/components/buttons/outlined_button.dart b/lib/ui/components/buttons/outlined_button.dart index 22a954e1..306d1085 100644 --- a/lib/ui/components/buttons/outlined_button.dart +++ b/lib/ui/components/buttons/outlined_button.dart @@ -17,11 +17,13 @@ class BrandOutlinedButton extends StatelessWidget { @override Widget build(final BuildContext context) => ConstrainedBox( constraints: const BoxConstraints( - minHeight: 40, minWidth: double.infinity, ), child: OutlinedButton( onPressed: onPressed, + style: OutlinedButton.styleFrom( + tapTargetSize: MaterialTapTargetSize.padded, + ), child: child ?? Text( title ?? '', diff --git a/lib/ui/pages/setup/initializing/initializing.dart b/lib/ui/pages/setup/initializing/initializing.dart index 54ca532c..a9f9f337 100644 --- a/lib/ui/pages/setup/initializing/initializing.dart +++ b/lib/ui/pages/setup/initializing/initializing.dart @@ -12,6 +12,7 @@ import 'package:selfprivacy/logic/cubit/forms/setup/initializing/root_user_form_ import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; import 'package:selfprivacy/ui/components/brand_timer/brand_timer.dart'; +import 'package:selfprivacy/ui/components/buttons/outlined_button.dart'; import 'package:selfprivacy/ui/components/drawers/progress_drawer.dart'; import 'package:selfprivacy/ui/components/progress_bar/progress_bar.dart'; import 'package:selfprivacy/ui/components/drawers/support_drawer.dart'; @@ -133,20 +134,16 @@ class InitializingPage extends StatelessWidget { }, ), ), - ConstrainedBox( - constraints: const BoxConstraints( - minWidth: double.infinity, - ), - child: OutlinedButton( - child: Text( - cubit.state is ServerInstallationFinished - ? 'basis.close'.tr() - : 'basis.later'.tr(), - ), - onPressed: () { - context.router.popUntilRoot(); - }, + // const SizedBox(height: 8), + BrandOutlinedButton( + child: Text( + cubit.state is ServerInstallationFinished + ? 'basis.close'.tr() + : 'basis.later'.tr(), ), + onPressed: () { + context.router.popUntilRoot(); + }, ), ], ), From f55800cd729cb55e5d3b890de92142ce2398fa57 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Wed, 31 May 2023 23:12:45 -0300 Subject: [PATCH 15/15] fix: Implement better domain id check on DNS restoration --- .../server_installation_repository.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index bc92f645..bee112f9 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -190,7 +190,16 @@ class ServerInstallationRepository { ), ); - final String? domainId = await dnsProviderApi.getZoneId(domain); + /// TODO: nvm it's because only Cloudflare uses Zone + /// for other providers we need to implement a different kind of + /// functionality here... but it's on refactoring, let it be here for now. + final APIGenericResult apiResponse = + await dnsProviderApi.isApiTokenValid(token); + + String? domainId; + if (apiResponse.success && apiResponse.data) { + domainId = await dnsProviderApi.getZoneId(domain); + } return domainId; }