2023-09-13 23:19:16 +03:30
|
|
|
import 'dart:io';
|
|
|
|
|
|
2024-02-15 15:23:02 +03:30
|
|
|
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
2023-09-01 15:00:41 +03:30
|
|
|
import 'package:flutter/material.dart';
|
2023-12-01 12:56:24 +03:30
|
|
|
import 'package:hiddify/core/localization/translations.dart';
|
|
|
|
|
import 'package:hiddify/core/preferences/general_preferences.dart';
|
2023-11-01 20:36:16 +03:30
|
|
|
import 'package:hiddify/core/router/router.dart';
|
2023-11-09 15:23:48 +03:30
|
|
|
import 'package:hiddify/features/common/general_pref_tiles.dart';
|
2023-12-01 12:56:24 +03:30
|
|
|
import 'package:hiddify/features/per_app_proxy/model/per_app_proxy_mode.dart';
|
2024-01-18 22:53:17 +03:30
|
|
|
import 'package:hiddify/features/settings/notifier/platform_settings_notifier.dart';
|
2023-09-01 15:00:41 +03:30
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
|
|
|
|
|
|
class AdvancedSettingTiles extends HookConsumerWidget {
|
|
|
|
|
const AdvancedSettingTiles({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
|
final t = ref.watch(translationsProvider);
|
|
|
|
|
|
2023-09-07 13:43:46 +03:30
|
|
|
final debug = ref.watch(debugModeNotifierProvider);
|
2024-03-02 22:53:14 +03:30
|
|
|
final disableMemoryLimit = ref.watch(Preferences.disableMemoryLimit);
|
2023-09-01 15:00:41 +03:30
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
2024-07-04 21:04:44 +02:00
|
|
|
// const RegionPrefTile(),
|
|
|
|
|
// ListTile(
|
|
|
|
|
// title: Text(t.settings.geoAssets.pageTitle),
|
|
|
|
|
// leading: const Icon(
|
|
|
|
|
// FluentIcons.arrow_routing_rectangle_multiple_24_regular,
|
|
|
|
|
// ),
|
|
|
|
|
// onTap: () async {
|
|
|
|
|
// // await const GeoAssetsRoute().push(context);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
2024-01-13 16:16:49 +03:30
|
|
|
SwitchListTile(
|
|
|
|
|
title: Text(t.settings.advanced.memoryLimit),
|
|
|
|
|
subtitle: Text(t.settings.advanced.memoryLimitMsg),
|
|
|
|
|
value: !disableMemoryLimit,
|
2024-02-15 15:23:02 +03:30
|
|
|
secondary: const Icon(FluentIcons.developer_board_24_regular),
|
2024-01-13 16:16:49 +03:30
|
|
|
onChanged: (value) async {
|
2024-07-04 21:04:44 +02:00
|
|
|
await ref.read(Preferences.disableMemoryLimit.notifier).update(!value);
|
2024-01-13 16:16:49 +03:30
|
|
|
},
|
|
|
|
|
),
|
2024-01-18 22:53:17 +03:30
|
|
|
if (Platform.isIOS)
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text(t.settings.advanced.resetTunnel),
|
2024-02-15 15:23:02 +03:30
|
|
|
leading: const Icon(FluentIcons.arrow_reset_24_regular),
|
2024-01-18 22:53:17 +03:30
|
|
|
onTap: () async {
|
|
|
|
|
await ref.read(resetTunnelProvider.notifier).run();
|
|
|
|
|
},
|
|
|
|
|
),
|
2023-09-01 15:00:41 +03:30
|
|
|
SwitchListTile(
|
|
|
|
|
title: Text(t.settings.advanced.debugMode),
|
|
|
|
|
value: debug,
|
2024-02-15 15:23:02 +03:30
|
|
|
secondary: const Icon(FluentIcons.window_dev_tools_24_regular),
|
2023-09-01 15:00:41 +03:30
|
|
|
onChanged: (value) async {
|
|
|
|
|
if (value) {
|
|
|
|
|
await showDialog<bool>(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (context) {
|
|
|
|
|
return AlertDialog(
|
|
|
|
|
title: Text(t.settings.advanced.debugMode),
|
|
|
|
|
content: Text(t.settings.advanced.debugModeMsg),
|
|
|
|
|
actions: [
|
|
|
|
|
TextButton(
|
2023-12-28 10:43:57 +03:30
|
|
|
onPressed: () => Navigator.of(context).maybePop(true),
|
2023-09-01 15:00:41 +03:30
|
|
|
child: Text(
|
|
|
|
|
MaterialLocalizations.of(context).okButtonLabel,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-09-07 13:43:46 +03:30
|
|
|
await ref.read(debugModeNotifierProvider.notifier).update(value);
|
2023-09-01 15:00:41 +03:30
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|