Implement fallback recovery method page

Co-authored-by: Inex Code <inex.code@selfprivacy.org>
pull/90/head
NaiJi ✨ 2022-05-17 16:29:04 +03:00
parent 7a719f15ce
commit 93215d90fb
7 changed files with 94 additions and 5 deletions

View File

@ -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.",

View File

@ -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.",

View File

@ -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<AppConfigCubit>();
var appConfig = context.watch<ServerInstallationCubit>();
return BlocProvider(
create: (context) =>

View File

@ -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())),
),
),
],
);
}
}

View File

@ -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

View File

@ -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())),
)
],
);
}
}

View File

@ -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())),
)
],
);