diff --git a/assets/translations/en.json b/assets/translations/en.json index 79d7231d..22a6b0ee 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -293,6 +293,9 @@ "method_select_nothing": "I don't have any of that", "method_device_description": "Open the application on another device, then go to the device page. Press \"Add device\" to receive your token.", "method_device_button": "I have received my token", + "method_device_input_description": "Enter your authorization token", + "method_device_input_placeholder": "Token", + "method_recovery_input_description": "Enter your recovery token", "fallback_select_description": "What exactly do you have? Pick the first available option:", "fallback_select_token_copy": "Copy of auth token from other version of the application.", "fallback_select_root_ssh": "Root SSH access to the server.", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 10f51f11..8c1a8397 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -294,6 +294,9 @@ "method_select_nothing": "У меня ничего из этого нет", "method_device_description": "Откройте приложение на другом устройстве и откройте экран управления устройствами. Нажмите \"Добавить устройство\" чтобы получить токен для авторизации.", "method_device_button": "Я получил токен", + "method_device_input_description": "Введите ваш токен авторизации", + "method_device_input_placeholder": "Токен", + "method_recovery_input_description": "Введите ваш токен восстановления", "fallback_select_description": "Что у вас из этого есть? Выберите первое, что подходит:", "fallback_select_token_copy": "Копия токена авторизации из другой версии приложения.", "fallback_select_root_ssh": "Root доступ к серверу по SSH.", diff --git a/lib/ui/pages/setup/recovering/recovery_domain.dart b/lib/ui/pages/setup/recovering/recovery_domain.dart index b68d423c..5ea30da8 100644 --- a/lib/ui/pages/setup/recovering/recovery_domain.dart +++ b/lib/ui/pages/setup/recovering/recovery_domain.dart @@ -1,7 +1,7 @@ import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:selfprivacy/logic/cubit/app_config/app_config_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/factories/field_cubit_factory.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/recovering/recovery_domain_form_cubit.dart'; import 'package:selfprivacy/ui/components/brand_button/FilledButton.dart'; @@ -10,7 +10,7 @@ import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.da class RecoveryDomain extends StatelessWidget { @override Widget build(BuildContext context) { - var appConfig = context.watch(); + var appConfig = context.watch(); return BlocProvider( create: (context) => diff --git a/lib/ui/pages/setup/recovering/recovery_fallback_select.dart b/lib/ui/pages/setup/recovering/recovery_fallback_select.dart new file mode 100644 index 00000000..2a1d7b21 --- /dev/null +++ b/lib/ui/pages/setup/recovering/recovery_fallback_select.dart @@ -0,0 +1,57 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; +import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; +import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; +import 'package:selfprivacy/ui/pages/rootRoute.dart'; + +class RecoveryFallbackSelect extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BrandHeroScreen( + heroTitle: "recovering.recovery_main_header".tr(), + heroSubtitle: "recovering.fallback_select_description".tr(), + hasBackButton: true, + hasFlashButton: false, + children: [ + BrandCards.outlined( + child: ListTile( + title: Text( + "recovering.fallback_select_token_copy".tr(), + style: Theme.of(context).textTheme.titleMedium, + ), + leading: Icon(Icons.vpn_key), + onTap: () => Navigator.of(context).push(materialRoute(RootPage())), + ), + ), + SizedBox(height: 16), + BrandCards.outlined( + child: ListTile( + title: Text( + "recovering.fallback_select_root_ssh".tr(), + style: Theme.of(context).textTheme.titleMedium, + ), + leading: Icon(Icons.terminal), + onTap: () => Navigator.of(context).push(materialRoute(RootPage())), + ), + ), + SizedBox(height: 16), + BrandCards.outlined( + child: ListTile( + title: Text( + "recovering.fallback_select_provider_console".tr(), + style: Theme.of(context).textTheme.titleMedium, + ), + subtitle: Text( + "recovering.fallback_select_provider_console_hint".tr(), + style: Theme.of(context).textTheme.bodyMedium, + ), + leading: Icon(Icons.web), + onTap: () => Navigator.of(context).push(materialRoute(RootPage())), + ), + ), + ], + ); + } +} diff --git a/lib/ui/pages/setup/recovering/recovery_method_device_1.dart b/lib/ui/pages/setup/recovering/recovery_method_device_1.dart index dd2566ec..73b32354 100644 --- a/lib/ui/pages/setup/recovering/recovery_method_device_1.dart +++ b/lib/ui/pages/setup/recovering/recovery_method_device_1.dart @@ -2,8 +2,8 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/ui/components/brand_button/FilledButton.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; -import 'package:selfprivacy/utils/route_transitions/basic.dart'; import 'package:selfprivacy/ui/pages/rootRoute.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; class RecoveryMethodDevice1 extends StatelessWidget { @override diff --git a/lib/ui/pages/setup/recovering/recovery_method_device_2.dart b/lib/ui/pages/setup/recovering/recovery_method_device_2.dart new file mode 100644 index 00000000..c5eac006 --- /dev/null +++ b/lib/ui/pages/setup/recovering/recovery_method_device_2.dart @@ -0,0 +1,25 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/ui/components/brand_button/FilledButton.dart'; +import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; +import 'package:selfprivacy/utils/route_transitions/basic.dart'; +import 'package:selfprivacy/ui/pages/rootRoute.dart'; + +class RecoveryMethodDevice2 extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BrandHeroScreen( + heroTitle: "recovering.recovery_main_header".tr(), + heroSubtitle: "recovering.method_device_input_description".tr(), + hasBackButton: true, + hasFlashButton: false, + children: [ + FilledButton( + title: "recovering.method_device_button".tr(), + onPressed: () => + Navigator.of(context).push(materialRoute(RootPage())), + ) + ], + ); + } +} diff --git a/lib/ui/pages/setup/recovering/recovery_method_select.dart b/lib/ui/pages/setup/recovering/recovery_method_select.dart index f94abc91..136ec36c 100644 --- a/lib/ui/pages/setup/recovering/recovery_method_select.dart +++ b/lib/ui/pages/setup/recovering/recovery_method_select.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/ui/components/brand_button/brand_button.dart'; import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart'; import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart'; +import 'package:selfprivacy/ui/pages/setup/recovering/recovery_fallback_select.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_method_device_1.dart'; import 'package:selfprivacy/utils/route_transitions/basic.dart'; import 'package:selfprivacy/ui/pages/rootRoute.dart'; @@ -41,8 +42,8 @@ class RecoveryMethodSelect extends StatelessWidget { SizedBox(height: 16), BrandButton.text( title: "recovering.method_select_nothing".tr(), - onPressed: () => - Navigator.of(context).push(materialRoute(RootPage())), + onPressed: () => Navigator.of(context) + .push(materialRoute(RecoveryFallbackSelect())), ) ], );