Add explicit TUN and SOCKS5 connection modes, app routing controls, authenticated per-session local SOCKS5, Android network monitoring, persistent haptics, resilient session recovery, notification hardening and client-side Hivemind cleanup. Keep the hosted flutter_vless_android 1.1.5 runtime as the base and apply the Android compatibility/security patches at build time instead of restoring the unstable vendored runtime.
58 lines
1.4 KiB
Dart
58 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:revoltvpn/logic/app_colors.dart';
|
|
import 'package:revoltvpn/logic/haptic_settings.dart';
|
|
|
|
class HapticFeedbackTile extends StatefulWidget {
|
|
const HapticFeedbackTile({super.key});
|
|
|
|
@override
|
|
State<HapticFeedbackTile> createState() => _HapticFeedbackTileState();
|
|
}
|
|
|
|
class _HapticFeedbackTileState extends State<HapticFeedbackTile> {
|
|
bool _on = HapticSettings.enabled;
|
|
bool _saving = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_load();
|
|
}
|
|
|
|
Future<void> _load() async {
|
|
await HapticSettings.initialize();
|
|
if (mounted) setState(() => _on = HapticSettings.enabled);
|
|
}
|
|
|
|
Future<void> _toggle(bool value) async {
|
|
if (_saving) return;
|
|
setState(() {
|
|
_saving = true;
|
|
_on = value;
|
|
});
|
|
|
|
try {
|
|
await HapticSettings.setEnabled(value);
|
|
} catch (_) {
|
|
if (mounted) setState(() => _on = HapticSettings.enabled);
|
|
} finally {
|
|
if (mounted) setState(() => _saving = false);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SwitchListTile(
|
|
title: const Text(
|
|
'Haptic feedback',
|
|
style: TextStyle(color: AppColors.textWhite, fontSize: 15),
|
|
),
|
|
value: _on,
|
|
onChanged: _saving ? null : _toggle,
|
|
activeTrackColor: AppColors.accent.withAlpha(80),
|
|
activeThumbColor: AppColors.accent,
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 4),
|
|
);
|
|
}
|
|
}
|