diff --git a/assets/translations/en.json b/assets/translations/en.json index dfd5e7f7..e7f9036b 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -167,5 +167,10 @@ "18": "How to obtain Hetzner API Token", "19": "1 Go via this link ", "20": "\n" + }, + "modals": { + "_comment": "messages in modals", + "1": "Сервер с таким именем уже существует", + "2": "Уничтожить сервер и создать новый?" } } \ No newline at end of file diff --git a/assets/translations/ru.json b/assets/translations/ru.json index d3b19c1b..1783dd73 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -167,5 +167,10 @@ "18": "Как получить Hetzner API Token'", "19": "1 Переходим по ссылке ", "20": "\n2 Заходим в созданный нами проект. Если такового - нет, значит создаём.\n3 Наводим мышкой на боковую панель. Она должна раскрыться, показав нам пункты меню. Нас интересует последний — Security (с иконкой ключика).\n4 Далее, в верхней части интерфейса видим примерно такой список: SSH Keys, API Tokens, Certificates, Members. Нам нужен API Tokens. Переходим по нему.\n5 В правой части интерфейса, нас будет ожидать кнопка Generate API token. Если же вы используете мобильную версию сайта, в нижнем правом углу вы увидите красный плюсик. Нажимаем на эту кнопку.\n6 В поле Description, даём нашему токену название (это может быть любое название, которые вам нравиться. Сути оно не меняет." + }, + "modals": { + "_comment": "messages in modals", + "1": "Сервер с таким именем уже существует", + "2": "Уничтожить сервер и создать новый?" } } \ No newline at end of file diff --git a/lib/logic/api_maps/cloudflare.dart b/lib/logic/api_maps/cloudflare.dart index b78b8ee6..c72c7bad 100644 --- a/lib/logic/api_maps/cloudflare.dart +++ b/lib/logic/api_maps/cloudflare.dart @@ -161,7 +161,7 @@ class CloudflareApi extends ApiMap { ]; } - Future?> domainList() async { + Future> domainList() async { var url = '$rootAddress/zones?per_page=50'; var response = await loggedClient.get( url, @@ -169,7 +169,7 @@ class CloudflareApi extends ApiMap { ); return response.data['result'] - .map((el) => el['name'] as String?) + .map((el) => el['name'] as String) .toList(); } } diff --git a/lib/logic/cubit/app_config/app_config_repository.dart b/lib/logic/cubit/app_config/app_config_repository.dart index 1a9f9d2b..9c3ee1c1 100644 --- a/lib/logic/cubit/app_config/app_config_repository.dart +++ b/lib/logic/cubit/app_config/app_config_repository.dart @@ -15,6 +15,7 @@ import 'package:basic_utils/basic_utils.dart'; import 'package:selfprivacy/ui/components/action_button/action_button.dart'; import 'package:selfprivacy/ui/components/brand_alert/brand_alert.dart'; import 'app_config_cubit.dart'; +import 'package:easy_localization/easy_localization.dart'; class AppConfigRepository { Box box = Hive.box(BNames.appConfig); @@ -121,7 +122,8 @@ class AppConfigRepository { String? domainName, String? cloudFlareKey, { void Function()? onCancel, - required Future Function(HetznerServerDetails serverDetails) onSuccess, + required Future Function(HetznerServerDetails serverDetails) + onSuccess, }) async { var hetznerApi = HetznerApi(hetznerKey); @@ -139,8 +141,8 @@ class AppConfigRepository { var nav = getIt.get(); nav.showPopUpDialog( BrandAlert( - title: 'Сервер с таким именем уже существует', - contentText: 'Уничтожить сервер и создать новый?', + title: 'modals.1'.tr(), + contentText: 'modals.2'.tr(), acitons: [ ActionButton( text: 'Удалить', diff --git a/lib/logic/cubit/forms/initializing/backblaze_form_cubit.dart b/lib/logic/cubit/forms/initializing/backblaze_form_cubit.dart index 386882a9..9ecf3eaa 100644 --- a/lib/logic/cubit/forms/initializing/backblaze_form_cubit.dart +++ b/lib/logic/cubit/forms/initializing/backblaze_form_cubit.dart @@ -29,7 +29,7 @@ class BackblazeFormCubit extends FormCubit { ], ); - super.setFields([keyId, applicationKey]); + super.addFields([keyId, applicationKey]); } @override diff --git a/lib/logic/cubit/forms/initializing/cloudflare_form_cubit.dart b/lib/logic/cubit/forms/initializing/cloudflare_form_cubit.dart index 2f885436..cd33feea 100644 --- a/lib/logic/cubit/forms/initializing/cloudflare_form_cubit.dart +++ b/lib/logic/cubit/forms/initializing/cloudflare_form_cubit.dart @@ -20,7 +20,7 @@ class CloudFlareFormCubit extends FormCubit { ], ); - super.setFields([apiKey]); + super.addFields([apiKey]); } @override diff --git a/lib/logic/cubit/forms/initializing/domain_cloudflare.dart b/lib/logic/cubit/forms/initializing/domain_cloudflare.dart index 07616b0a..4b1aad91 100644 --- a/lib/logic/cubit/forms/initializing/domain_cloudflare.dart +++ b/lib/logic/cubit/forms/initializing/domain_cloudflare.dart @@ -17,7 +17,7 @@ class DomainSetupCubit extends Cubit { Future load() async { emit(Loading(LoadingTypes.loadingDomain)); - var list = await (api.domainList() as Future>); + var list = await api.domainList(); if (list.isEmpty) { emit(Empty()); } else if (list.length == 1) { diff --git a/lib/logic/cubit/forms/initializing/hetzner_form_cubit.dart b/lib/logic/cubit/forms/initializing/hetzner_form_cubit.dart index 2383a986..78674e31 100644 --- a/lib/logic/cubit/forms/initializing/hetzner_form_cubit.dart +++ b/lib/logic/cubit/forms/initializing/hetzner_form_cubit.dart @@ -20,7 +20,7 @@ class HetznerFormCubit extends FormCubit { ], ); - super.setFields([apiKey]); + super.addFields([apiKey]); } @override diff --git a/lib/logic/cubit/forms/initializing/root_user_form_cubit.dart b/lib/logic/cubit/forms/initializing/root_user_form_cubit.dart index f651c251..85be05c7 100644 --- a/lib/logic/cubit/forms/initializing/root_user_form_cubit.dart +++ b/lib/logic/cubit/forms/initializing/root_user_form_cubit.dart @@ -32,7 +32,7 @@ class RootUserFormCubit extends FormCubit { isVisible = FieldCubit(initalValue: false); - super.setFields([userName, password, isVisible]); + super.addFields([userName, password, isVisible]); } @override diff --git a/lib/logic/cubit/forms/user/user_form_cubit.dart b/lib/logic/cubit/forms/user/user_form_cubit.dart index 59bd50d3..2c874eb4 100644 --- a/lib/logic/cubit/forms/user/user_form_cubit.dart +++ b/lib/logic/cubit/forms/user/user_form_cubit.dart @@ -33,7 +33,7 @@ class UserFormCubit extends FormCubit { ], ); - super.setFields([login, password]); + super.addFields([login, password]); } @override diff --git a/pubspec.lock b/pubspec.lock index 088143aa..b7ef8724 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -189,7 +189,7 @@ packages: name: cubit_form url: "https://pub.dartlang.org" source: hosted - version: "1.0.0-nullsafety.0" + version: "1.0.2-nullsafety.0" cupertino_icons: dependency: "direct main" description: @@ -210,7 +210,7 @@ packages: name: dio url: "https://pub.dartlang.org" source: hosted - version: "4.0.0-prev1" + version: "4.0.0-prev3" easy_localization: dependency: "direct main" description: @@ -304,7 +304,7 @@ packages: name: flutter_markdown url: "https://pub.dartlang.org" source: hosted - version: "0.6.0" + version: "0.6.1" flutter_secure_storage: dependency: "direct main" description: @@ -363,7 +363,7 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.13.0" + version: "0.13.1" http_multi_server: dependency: transitive description: @@ -384,7 +384,7 @@ packages: name: image url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" intl: dependency: transitive description: @@ -412,7 +412,7 @@ packages: name: json_annotation url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.0.1" json_serializable: dependency: "direct dev" description: @@ -580,7 +580,7 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.1.0" + version: "4.1.1" provider: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index b891badd..03565a4e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: easy_localization: ^3.0.0 either_option: ^2.0.1-dev.1 equatable: ^2.0.0 - flutter_bloc: ^7.0.0-nullsafety.5 + flutter_bloc: ^7.0.0 flutter_markdown: ^0.6.0 flutter_secure_storage: ^4.1.0 get_it: ^6.0.0