polish: strip verbose comments, simplify codebase

This commit is contained in:
esefxdz committed 2026-07-26 11:30:59 +03:00
1 parent a32252c56d
commit 35bfeb61c4
16 files changed
+26 -147

No files matched your search

+4 -32
View File
@@ -10,63 +10,36 @@ import 'package:revoltvpn/logic/consent_manager.dart';
import 'package:revoltvpn/logic/app_colors.dart';
import 'package:revoltvpn/screens/intro.dart';
/// The entry point for the REVOLT VPN application.
void main() async {
// Ensure that the Flutter engine is fully initialized before using platform channels
// (e.g., for SystemChrome or MobileAds).
WidgetsFlutterBinding.ensureInitialized();
// Lock the application to portrait orientation since the dashboard is a single-screen utility app
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
// Configure a stealth system bar layout: transparent status bar with light icons,
// blending seamlessly into the dark background gradient.
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.light,
systemNavigationBarColor: Color(0xFF0D1117), // Deep space black
systemNavigationBarColor: Color(0xFF0D1117),
systemNavigationBarIconBrightness: Brightness.light,
));
// ── GDPR Consent (Google UMP) ──────────────────────────────────────────
// Must run BEFORE MobileAds initialization. Shows consent dialog to
// EEA/UK users; no-op for everyone else.
await ConsentManager.requestConsentIfNeeded();
// ── Initialize AdMob ───────────────────────────────────────────────────
// Only after consent is resolved so AdMob respects user preferences.
await MobileAds.instance.initialize();
// Inflate the root widget
runApp(const ReVoltApp());
}
/// The root application widget wrapping the app in necessary state providers and themes.
class ReVoltApp extends StatelessWidget {
const ReVoltApp({super.key});
@override
Widget build(BuildContext context) {
// MultiProvider injects global state controllers down the widget tree.
return MultiProvider(
providers: [
// Manages the VLESS tunnel lifecycle
ChangeNotifierProvider(create: (_) => VpnConnection()),
// Manages the 1-hour session clock.
// Uses ProxyProvider to automatically inject the VpnConnection,
// allowing the timer to auto-disconnect the VPN when time expires.
ChangeNotifierProxyProvider<VpnConnection, SessionTimer>(
create: (ctx) => SessionTimer(
vpnConnection: ctx.read<VpnConnection>(),
),
update: (_, vpn, prev) =>
prev ?? SessionTimer(vpnConnection: vpn),
create: (ctx) => SessionTimer(vpnConnection: ctx.read<VpnConnection>()),
update: (_, vpn, prev) => prev ?? SessionTimer(vpnConnection: vpn),
),
// Manages rewarded ad lifecycle — preloads on startup.
ChangeNotifierProvider(create: (_) => AdManager()),
],
child: MaterialApp(
@@ -78,7 +51,6 @@ class ReVoltApp extends StatelessWidget {
);
}
/// Constructs the global dark theme used across the application.
ThemeData _buildDarkTheme() {
return ThemeData(
brightness: Brightness.dark,