2023-03-22 11:38:18 +00:00
|
|
|
import 'package:auto_route/auto_route.dart';
|
2024-01-31 05:14:23 +00:00
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2023-02-23 14:49:14 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2024-01-26 14:46:09 +00:00
|
|
|
import 'package:selfprivacy/config/get_it_config.dart';
|
2023-06-16 02:59:48 +00:00
|
|
|
import 'package:selfprivacy/logic/api_maps/tls_options.dart';
|
2024-02-23 16:50:28 +00:00
|
|
|
import 'package:selfprivacy/logic/bloc/services/services_bloc.dart';
|
|
|
|
import 'package:selfprivacy/logic/bloc/volumes/volumes_bloc.dart';
|
2023-02-23 14:49:14 +00:00
|
|
|
import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart';
|
2024-02-23 16:50:28 +00:00
|
|
|
import 'package:selfprivacy/ui/components/list_tiles/section_title.dart';
|
2023-02-23 14:49:14 +00:00
|
|
|
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
2024-02-23 16:50:28 +00:00
|
|
|
import 'package:selfprivacy/ui/router/router.dart';
|
2023-02-23 14:49:14 +00:00
|
|
|
|
2023-03-22 11:38:18 +00:00
|
|
|
@RoutePage()
|
2023-02-23 14:49:14 +00:00
|
|
|
class DeveloperSettingsPage extends StatefulWidget {
|
|
|
|
const DeveloperSettingsPage({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<DeveloperSettingsPage> createState() => _DeveloperSettingsPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _DeveloperSettingsPageState extends State<DeveloperSettingsPage> {
|
|
|
|
@override
|
|
|
|
Widget build(final BuildContext context) => BrandHeroScreen(
|
|
|
|
hasBackButton: true,
|
|
|
|
hasFlashButton: false,
|
|
|
|
bodyPadding: const EdgeInsets.symmetric(vertical: 16),
|
|
|
|
heroTitle: 'developer_settings.title'.tr(),
|
|
|
|
heroSubtitle: 'developer_settings.subtitle'.tr(),
|
|
|
|
children: [
|
2024-02-23 16:50:28 +00:00
|
|
|
SectionTitle(title: 'developer_settings.server_setup'.tr()),
|
2023-02-23 14:49:14 +00:00
|
|
|
SwitchListTile(
|
|
|
|
title: Text('developer_settings.use_staging_acme'.tr()),
|
|
|
|
subtitle:
|
|
|
|
Text('developer_settings.use_staging_acme_description'.tr()),
|
2023-06-16 02:59:48 +00:00
|
|
|
value: TlsOptions.stagingAcme,
|
|
|
|
onChanged: (final bool value) => setState(
|
|
|
|
() => TlsOptions.stagingAcme = value,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SwitchListTile(
|
|
|
|
title: Text('developer_settings.ignore_tls'.tr()),
|
2023-07-02 11:41:54 +00:00
|
|
|
subtitle: Text('developer_settings.ignore_tls_description'.tr()),
|
2023-06-16 02:59:48 +00:00
|
|
|
value: TlsOptions.verifyCertificate,
|
|
|
|
onChanged: (final bool value) => setState(
|
2023-07-02 11:41:54 +00:00
|
|
|
() => TlsOptions.verifyCertificate = value,
|
2023-06-16 02:59:48 +00:00
|
|
|
),
|
2023-02-23 14:49:14 +00:00
|
|
|
),
|
2023-12-28 19:35:39 +00:00
|
|
|
SwitchListTile(
|
|
|
|
title: Text('developer_settings.allow_ssh_key_at_setup'.tr()),
|
|
|
|
subtitle: Text(
|
|
|
|
'developer_settings.allow_ssh_key_at_setup_description'.tr(),
|
|
|
|
),
|
|
|
|
value: TlsOptions.allowCustomSshKeyDuringSetup,
|
|
|
|
onChanged: (final bool value) => setState(
|
|
|
|
() => TlsOptions.allowCustomSshKeyDuringSetup = value,
|
|
|
|
),
|
|
|
|
),
|
2024-02-23 16:50:28 +00:00
|
|
|
SectionTitle(title: 'developer_settings.routing'.tr()),
|
2023-02-23 14:49:14 +00:00
|
|
|
ListTile(
|
|
|
|
title: Text('developer_settings.reset_onboarding'.tr()),
|
|
|
|
subtitle:
|
|
|
|
Text('developer_settings.reset_onboarding_description'.tr()),
|
|
|
|
enabled:
|
|
|
|
!context.watch<AppSettingsCubit>().state.isOnboardingShowing,
|
|
|
|
onTap: () => context
|
|
|
|
.read<AppSettingsCubit>()
|
|
|
|
.turnOffOnboarding(isOnboardingShowing: true),
|
|
|
|
),
|
2024-02-23 16:50:28 +00:00
|
|
|
ListTile(
|
|
|
|
title: Text('storage.start_migration_button'.tr()),
|
|
|
|
subtitle: Text('storage.data_migration_notice'.tr()),
|
|
|
|
enabled:
|
|
|
|
!context.watch<AppSettingsCubit>().state.isOnboardingShowing,
|
|
|
|
onTap: () => context.pushRoute(
|
|
|
|
ServicesMigrationRoute(
|
|
|
|
diskStatus: context.read<VolumesBloc>().state.diskStatus,
|
|
|
|
services: context
|
|
|
|
.read<ServicesBloc>()
|
|
|
|
.state
|
|
|
|
.services
|
|
|
|
.where(
|
|
|
|
(final service) =>
|
|
|
|
service.id == 'bitwarden' ||
|
|
|
|
service.id == 'gitea' ||
|
|
|
|
service.id == 'pleroma' ||
|
|
|
|
service.id == 'email' ||
|
|
|
|
service.id == 'nextcloud',
|
|
|
|
)
|
|
|
|
.toList(),
|
|
|
|
isMigration: true,
|
|
|
|
),
|
2023-02-23 14:49:14 +00:00
|
|
|
),
|
|
|
|
),
|
2024-02-23 16:50:28 +00:00
|
|
|
SectionTitle(title: 'developer_settings.cubit_statuses'.tr()),
|
2024-01-26 14:46:09 +00:00
|
|
|
ListTile(
|
|
|
|
title: const Text('ApiConnectionRepository status'),
|
|
|
|
subtitle: Text(
|
|
|
|
getIt<ApiConnectionRepository>()
|
|
|
|
.currentConnectionStatus
|
|
|
|
.toString(),
|
|
|
|
),
|
|
|
|
),
|
2023-02-23 14:49:14 +00:00
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|