Backup before removing hiddify references
This commit is contained in:
@@ -5,13 +5,14 @@ import 'package:gap/gap.dart';
|
||||
import 'package:hiddify/core/app_info/app_info_provider.dart';
|
||||
import 'package:hiddify/core/directories/directories_provider.dart';
|
||||
import 'package:hiddify/core/localization/translations.dart';
|
||||
import 'package:hiddify/core/model/constants.dart';
|
||||
import 'package:hiddify/core/model/failures.dart';
|
||||
import 'package:hiddify/core/widget/adaptive_icon.dart';
|
||||
import 'package:hiddify/features/app_update/notifier/app_update_notifier.dart';
|
||||
import 'package:hiddify/features/app_update/notifier/app_update_state.dart';
|
||||
import 'package:hiddify/features/app_update/widget/new_version_dialog.dart';
|
||||
import 'package:hiddify/features/common/nested_app_bar.dart';
|
||||
import 'package:hiddify/features/settings/about/privacy_policy_screen.dart';
|
||||
import 'package:hiddify/features/settings/about/terms_and_conditions_screen.dart';
|
||||
import 'package:hiddify/gen/assets.gen.dart';
|
||||
import 'package:hiddify/utils/utils.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
@@ -30,8 +31,7 @@ class AboutPage extends HookConsumerWidget {
|
||||
(_, next) async {
|
||||
if (!context.mounted) return;
|
||||
switch (next) {
|
||||
case AppUpdateStateAvailable(:final versionInfo) ||
|
||||
AppUpdateStateIgnored(:final versionInfo):
|
||||
case AppUpdateStateAvailable(:final versionInfo) || AppUpdateStateIgnored(:final versionInfo):
|
||||
return NewVersionDialog(
|
||||
appInfo.presentVersion,
|
||||
versionInfo,
|
||||
@@ -40,35 +40,19 @@ class AboutPage extends HookConsumerWidget {
|
||||
case AppUpdateStateError(:final error):
|
||||
return CustomToast.error(t.presentShortError(error)).show(context);
|
||||
case AppUpdateStateNotAvailable():
|
||||
return CustomToast.success(t.appUpdate.notAvailableMsg)
|
||||
.show(context);
|
||||
return CustomToast.success(t.appUpdate.notAvailableMsg).show(context);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
final conditionalTiles = [
|
||||
if (appInfo.release.allowCustomUpdateChecker)
|
||||
ListTile(
|
||||
title: Text(t.about.checkForUpdate),
|
||||
trailing: switch (appUpdate) {
|
||||
AppUpdateStateChecking() => const SizedBox(
|
||||
width: 24,
|
||||
height: 24,
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
_ => const Icon(FluentIcons.arrow_sync_24_regular),
|
||||
},
|
||||
onTap: () async {
|
||||
await ref.read(appUpdateNotifierProvider.notifier).check();
|
||||
},
|
||||
),
|
||||
// UMBRIX: Отключили проверку обновлений - используем свой сервер
|
||||
if (PlatformUtils.isDesktop)
|
||||
ListTile(
|
||||
title: Text(t.settings.general.openWorkingDir),
|
||||
trailing: const Icon(FluentIcons.open_folder_24_regular),
|
||||
onTap: () async {
|
||||
final path =
|
||||
ref.watch(appDirectoriesProvider).requireValue.workingDir.uri;
|
||||
final path = ref.watch(appDirectoriesProvider).requireValue.workingDir.uri;
|
||||
await UriUtils.tryLaunch(path);
|
||||
},
|
||||
),
|
||||
@@ -103,7 +87,8 @@ class AboutPage extends HookConsumerWidget {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Assets.images.logo.svg(width: 64, height: 64),
|
||||
// UMBRIX: Используем наш логотип
|
||||
Assets.images.umbrixLogo.image(width: 64, height: 64),
|
||||
const Gap(16),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -127,39 +112,45 @@ class AboutPage extends HookConsumerWidget {
|
||||
[
|
||||
...conditionalTiles,
|
||||
if (conditionalTiles.isNotEmpty) const Divider(),
|
||||
ListTile(
|
||||
title: Text(t.about.sourceCode),
|
||||
trailing: const Icon(FluentIcons.open_24_regular),
|
||||
onTap: () async {
|
||||
await UriUtils.tryLaunch(
|
||||
Uri.parse(Constants.githubUrl),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(t.about.telegramChannel),
|
||||
trailing: const Icon(FluentIcons.open_24_regular),
|
||||
onTap: () async {
|
||||
await UriUtils.tryLaunch(
|
||||
Uri.parse(Constants.telegramChannelUrl),
|
||||
);
|
||||
},
|
||||
),
|
||||
// UMBRIX: Убрали "Исходный код" - наш приватный форк
|
||||
// ListTile(
|
||||
// title: Text(t.about.sourceCode),
|
||||
// trailing: const Icon(FluentIcons.open_24_regular),
|
||||
// onTap: () async {
|
||||
// await UriUtils.tryLaunch(
|
||||
// Uri.parse(Constants.githubUrl),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// UMBRIX: Telegram канал пока закомментирован
|
||||
// ListTile(
|
||||
// title: Text(t.about.telegramChannel),
|
||||
// trailing: const Icon(FluentIcons.open_24_regular),
|
||||
// onTap: () async {
|
||||
// await UriUtils.tryLaunch(
|
||||
// Uri.parse(Constants.telegramChannelUrl),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
ListTile(
|
||||
title: Text(t.about.termsAndConditions),
|
||||
trailing: const Icon(FluentIcons.open_24_regular),
|
||||
onTap: () async {
|
||||
await UriUtils.tryLaunch(
|
||||
Uri.parse(Constants.termsAndConditionsUrl),
|
||||
trailing: const Icon(FluentIcons.chevron_right_20_regular),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const TermsAndConditionsScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(t.about.privacyPolicy),
|
||||
trailing: const Icon(FluentIcons.open_24_regular),
|
||||
onTap: () async {
|
||||
await UriUtils.tryLaunch(
|
||||
Uri.parse(Constants.privacyPolicyUrl),
|
||||
trailing: const Icon(FluentIcons.chevron_right_20_regular),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const PrivacyPolicyScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
92
lib/features/settings/about/licenses_screen.dart
Normal file
92
lib/features/settings/about/licenses_screen.dart
Normal file
@@ -0,0 +1,92 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hiddify/core/localization/translations.dart';
|
||||
import 'package:hiddify/gen/assets.gen.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
class LicensesScreen extends HookConsumerWidget {
|
||||
const LicensesScreen({super.key});
|
||||
|
||||
static Future<String> _loadAllLicenses() async {
|
||||
final licenses = await LicenseRegistry.licenses.toList();
|
||||
final buffer = StringBuffer();
|
||||
|
||||
for (final license in licenses) {
|
||||
for (final package in license.packages) {
|
||||
buffer.writeln(package);
|
||||
}
|
||||
buffer.writeln();
|
||||
|
||||
final paragraphs = license.paragraphs.toList();
|
||||
for (final paragraph in paragraphs) {
|
||||
buffer.writeln(paragraph.text);
|
||||
}
|
||||
|
||||
buffer.writeln();
|
||||
buffer.writeln('=' * 80);
|
||||
buffer.writeln();
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final t = ref.watch(translationsProvider);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(t.about.licenses),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
// Заголовок с логотипом
|
||||
Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
children: [
|
||||
Assets.images.umbrixLogo.image(
|
||||
width: 64,
|
||||
height: 64,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const Text(
|
||||
'0.1.0',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
// Весь текст лицензий
|
||||
Expanded(
|
||||
child: FutureBuilder<String>(
|
||||
future: _loadAllLicenses(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (snapshot.hasError) {
|
||||
return Center(child: Text('Ошибка: ${snapshot.error}'));
|
||||
}
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: SelectableText(
|
||||
snapshot.data ?? '',
|
||||
style: const TextStyle(
|
||||
fontSize: 5.5,
|
||||
fontFamily: 'monospace',
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
100
lib/features/settings/about/privacy_policy_screen.dart
Normal file
100
lib/features/settings/about/privacy_policy_screen.dart
Normal file
@@ -0,0 +1,100 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hiddify/core/localization/translations.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
class PrivacyPolicyScreen extends ConsumerWidget {
|
||||
const PrivacyPolicyScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final t = ref.watch(translationsProvider);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(t.about.privacyPolicy),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
t.about.privacyPolicy.toUpperCase(),
|
||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
t.privacyPolicy.lastUpdated,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_buildSection(
|
||||
context,
|
||||
'1. ${t.privacyPolicy.section1Title}',
|
||||
t.privacyPolicy.section1Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'2. ${t.privacyPolicy.section2Title}',
|
||||
t.privacyPolicy.section2Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'3. ${t.privacyPolicy.section3Title}',
|
||||
t.privacyPolicy.section3Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'4. ${t.privacyPolicy.section4Title}',
|
||||
t.privacyPolicy.section4Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'5. ${t.privacyPolicy.section5Title}',
|
||||
t.privacyPolicy.section5Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'6. ${t.privacyPolicy.section6Title}',
|
||||
t.privacyPolicy.section6Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'7. ${t.privacyPolicy.section7Title}',
|
||||
t.privacyPolicy.section7Content,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSection(BuildContext context, String title, String content) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
content,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
height: 1.6,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
100
lib/features/settings/about/terms_and_conditions_screen.dart
Normal file
100
lib/features/settings/about/terms_and_conditions_screen.dart
Normal file
@@ -0,0 +1,100 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hiddify/core/localization/translations.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
class TermsAndConditionsScreen extends ConsumerWidget {
|
||||
const TermsAndConditionsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final t = ref.watch(translationsProvider);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(t.about.termsAndConditions),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
t.about.termsAndConditions.toUpperCase(),
|
||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
t.termsAndConditions.lastUpdated,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_buildSection(
|
||||
context,
|
||||
'1. ${t.termsAndConditions.section1Title}',
|
||||
t.termsAndConditions.section1Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'2. ${t.termsAndConditions.section2Title}',
|
||||
t.termsAndConditions.section2Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'3. ${t.termsAndConditions.section3Title}',
|
||||
t.termsAndConditions.section3Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'4. ${t.termsAndConditions.section4Title}',
|
||||
t.termsAndConditions.section4Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'5. ${t.termsAndConditions.section5Title}',
|
||||
t.termsAndConditions.section5Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'6. ${t.termsAndConditions.section6Title}',
|
||||
t.termsAndConditions.section6Content,
|
||||
),
|
||||
_buildSection(
|
||||
context,
|
||||
'7. ${t.termsAndConditions.section7Title}',
|
||||
t.termsAndConditions.section7Content,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSection(BuildContext context, String title, String content) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
content,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
height: 1.6,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user