плашка хочешь обновить спуф

This commit is contained in:
jganenok
2025-11-17 14:33:53 +07:00
parent fb96dd0996
commit 2c405b49e3
3 changed files with 211 additions and 42 deletions

View File

@@ -53,7 +53,7 @@ class _HomeScreenState extends State<HomeScreen> {
_checkVersionInBackground(); _checkVersionInBackground();
_initDeepLinking(); _initDeepLinking();
_showSpoofUpdateDialogIfNeeded();
_connectionSubscription = ApiService.instance.connectionStatus.listen(( _connectionSubscription = ApiService.instance.connectionStatus.listen((
status, status,
@@ -68,7 +68,6 @@ class _HomeScreenState extends State<HomeScreen> {
} }
}); });
_messageSubscription = ApiService.instance.messages.listen((message) { _messageSubscription = ApiService.instance.messages.listen((message) {
if (message['type'] == 'session_terminated' && mounted) { if (message['type'] == 'session_terminated' && mounted) {
_handleSessionTerminated(message['message']); _handleSessionTerminated(message['message']);
@@ -86,7 +85,6 @@ class _HomeScreenState extends State<HomeScreen> {
if (!mounted) return; if (!mounted) return;
setState(() => _isProfileLoading = true); setState(() => _isProfileLoading = true);
try { try {
final cachedProfile = ApiService.instance.lastChatsPayload?['profile']; final cachedProfile = ApiService.instance.lastChatsPayload?['profile'];
if (cachedProfile != null) { if (cachedProfile != null) {
if (mounted) { if (mounted) {
@@ -96,7 +94,6 @@ class _HomeScreenState extends State<HomeScreen> {
}); });
} }
} else { } else {
final result = await ApiService.instance.getChatsAndContacts( final result = await ApiService.instance.getChatsAndContacts(
force: false, force: false,
); );
@@ -124,7 +121,7 @@ class _HomeScreenState extends State<HomeScreen> {
) async { ) async {
await showDialog( await showDialog(
context: context, context: context,
barrierDismissible: false, // Пользователь должен сделать выбор barrierDismissible: false, // Зачем давать им выбор оло
builder: (BuildContext dialogContext) { builder: (BuildContext dialogContext) {
return AlertDialog( return AlertDialog(
title: const Text('Доступно обновление'), title: const Text('Доступно обновление'),
@@ -135,7 +132,7 @@ class _HomeScreenState extends State<HomeScreen> {
TextButton( TextButton(
child: const Text('Отменить'), child: const Text('Отменить'),
onPressed: () { onPressed: () {
Navigator.of(dialogContext).pop(); // Просто закрыть диалог Navigator.of(dialogContext).pop();
}, },
), ),
FilledButton( FilledButton(
@@ -151,12 +148,10 @@ class _HomeScreenState extends State<HomeScreen> {
print("Ошибка переподключения: $e"); print("Ошибка переподключения: $e");
} }
if (mounted) { if (mounted) {
Navigator.of(dialogContext).pop(); Navigator.of(dialogContext).pop();
} }
if (mounted) { if (mounted) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
@@ -177,11 +172,9 @@ class _HomeScreenState extends State<HomeScreen> {
try { try {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
final isWebVersionCheckEnabled = final isWebVersionCheckEnabled =
prefs.getBool('enable_web_version_check') ?? false; prefs.getBool('enable_web_version_check') ?? false;
if (!isWebVersionCheckEnabled) { if (!isWebVersionCheckEnabled) {
print("Web version checking is disabled, skipping check"); print("Web version checking is disabled, skipping check");
return; return;
@@ -196,7 +189,6 @@ class _HomeScreenState extends State<HomeScreen> {
if (latestVersion != currentVersion) { if (latestVersion != currentVersion) {
if (isAutoUpdateEnabled) { if (isAutoUpdateEnabled) {
await prefs.setString('spoof_appversion', latestVersion); await prefs.setString('spoof_appversion', latestVersion);
print("Версия сессии автоматически обновлена до $latestVersion"); print("Версия сессии автоматически обновлена до $latestVersion");
@@ -223,7 +215,6 @@ class _HomeScreenState extends State<HomeScreen> {
); );
} }
} else if (showUpdateNotification) { } else if (showUpdateNotification) {
if (mounted) { if (mounted) {
_showUpdateDialog(context, latestVersion); _showUpdateDialog(context, latestVersion);
} }
@@ -574,6 +565,148 @@ class _HomeScreenState extends State<HomeScreen> {
); );
} }
Future<void> _showSpoofUpdateDialogIfNeeded() async {
final prefs = await SharedPreferences.getInstance();
final shouldShow = prefs.getBool('show_spoof_update_dialog') ?? true;
if (!shouldShow || !mounted) return;
Future.delayed(const Duration(milliseconds: 500), () {
if (!mounted) return;
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
bool dontShowAgain = false;
return StatefulBuilder(
builder: (context, setState) {
return AlertDialog(
title: const Text('Проверка обновлений'),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text('Хотите проверить обновления спуфа?'),
const SizedBox(height: 16),
Row(
children: [
Checkbox(
value: dontShowAgain,
onChanged: (value) {
setState(() {
dontShowAgain = value ?? false;
});
},
),
const Expanded(child: Text('Больше не показывать')),
],
),
],
),
actions: [
TextButton(
onPressed: () async {
if (dontShowAgain) {
final prefs = await SharedPreferences.getInstance();
await prefs.setBool('show_spoof_update_dialog', false);
}
Navigator.of(context).pop();
},
child: const Text('Нет'),
),
TextButton(
onPressed: () async {
if (dontShowAgain) {
final prefs = await SharedPreferences.getInstance();
await prefs.setBool('show_spoof_update_dialog', false);
}
Navigator.of(context).pop();
await _checkSpoofUpdateManually();
},
child: const Text('Ок!'),
),
],
);
},
);
},
);
});
}
Future<void> _checkSpoofUpdateManually() async {
try {
final prefs = await SharedPreferences.getInstance();
final isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? true;
final currentVersion = prefs.getString('spoof_appversion') ?? '0.0.0';
final latestVersion = await VersionChecker.getLatestVersion();
if (latestVersion != currentVersion) {
if (isAutoUpdateEnabled) {
await prefs.setString('spoof_appversion', latestVersion);
print("Версия сессии обновлена до $latestVersion");
try {
await ApiService.instance.performFullReconnection();
print("Переподключение выполнено успешно");
} catch (e) {
print("Ошибка переподключения: $e");
}
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Спуф сессии обновлен до версии $latestVersion'),
backgroundColor: Colors.green.shade700,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
margin: const EdgeInsets.all(10),
),
);
}
} else {
if (mounted) {
_showUpdateDialog(context, latestVersion);
}
}
} else {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('Версия спуфа актуальна'),
backgroundColor: Colors.blue.shade700,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
margin: const EdgeInsets.all(10),
),
);
}
}
} catch (e) {
print("Проверка версии спуфа не удалась: $e");
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Ошибка проверки обновлений: $e'),
backgroundColor: Colors.red.shade700,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
margin: const EdgeInsets.all(10),
),
);
}
}
}
void _handleGroupJoinError(Map<String, dynamic> message) { void _handleGroupJoinError(Map<String, dynamic> message) {
final errorPayload = message['payload']; final errorPayload = message['payload'];
String errorMessage = 'Неизвестная ошибка'; String errorMessage = 'Неизвестная ошибка';
@@ -730,7 +863,6 @@ class _DesktopLayoutState extends State<_DesktopLayout> {
_loadMyProfile(); _loadMyProfile();
} }
Future<void> _loadMyProfile() async { Future<void> _loadMyProfile() async {
if (!mounted) return; if (!mounted) return;
setState(() => _isProfileLoading = true); setState(() => _isProfileLoading = true);
@@ -753,7 +885,6 @@ class _DesktopLayoutState extends State<_DesktopLayout> {
} }
} }
void _onChatSelected( void _onChatSelected(
Chat chat, Chat chat,
Contact contact, Contact contact,

View File

@@ -44,8 +44,8 @@ class BypassScreen extends StatelessWidget {
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
"Эта функция позволяет отправлять сообщения заблокированным пользователям, " "Эта функция позволяет отправлять сообщения заблокированным пользователям. "
"даже если они заблокировали вас. Включите эту опцию, если хотите обойти " "Включите эту опцию, если хотите обойти "
"стандартные ограничения мессенджера.", "стандартные ограничения мессенджера.",
style: TextStyle(color: colors.onSurfaceVariant), style: TextStyle(color: colors.onSurfaceVariant),
), ),
@@ -104,7 +104,7 @@ class BypassScreen extends StatelessWidget {
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
"Важно знать", "ВНИМНИЕ🚨🚨🚨",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: colors.primary, color: colors.primary,
@@ -114,7 +114,7 @@ class BypassScreen extends StatelessWidget {
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( Text(
"Используя любую из bypass функций мы не несем ответственности за ваш аккаунт", "Используя любую из bypass функций, вас возможно накажут",
style: TextStyle( style: TextStyle(
color: colors.onSurfaceVariant, color: colors.onSurfaceVariant,
fontSize: 14, fontSize: 14,
@@ -133,7 +133,6 @@ class BypassScreen extends StatelessWidget {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: Stack( body: Stack(
children: [ children: [
GestureDetector( GestureDetector(
onTap: () => Navigator.of(context).pop(), onTap: () => Navigator.of(context).pop(),
child: Container( child: Container(
@@ -143,7 +142,6 @@ class BypassScreen extends StatelessWidget {
), ),
), ),
Center( Center(
child: Container( child: Container(
width: 400, width: 400,
@@ -162,7 +160,6 @@ class BypassScreen extends StatelessWidget {
), ),
child: Column( child: Column(
children: [ children: [
Container( Container(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -197,7 +194,6 @@ class BypassScreen extends StatelessWidget {
), ),
), ),
Expanded( Expanded(
child: ListView( child: ListView(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
@@ -247,11 +243,11 @@ class BypassScreen extends StatelessWidget {
builder: (context, themeProvider, child) { builder: (context, themeProvider, child) {
return SwitchListTile( return SwitchListTile(
title: const Text("Включить обход"), title: const Text("Включить обход"),
subtitle: const Text("Активировать функции обхода ограничений"), subtitle: const Text(
"Активировать функции обхода ограничений",
),
value: false, // Временно отключено value: false, // Временно отключено
onChanged: (value) { onChanged: (value) {},
},
); );
}, },
), ),
@@ -277,20 +273,14 @@ class BypassScreen extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: colors.primaryContainer.withOpacity(0.3), color: colors.primaryContainer.withOpacity(0.3),
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
border: Border.all( border: Border.all(color: colors.outline.withOpacity(0.3)),
color: colors.outline.withOpacity(0.3),
),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
Icon( Icon(Icons.info_outline, color: colors.primary, size: 20),
Icons.info_outline,
color: colors.primary,
size: 20,
),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
"Информация", "Информация",

View File

@@ -17,6 +17,7 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
bool _isAutoUpdateEnabled = true; bool _isAutoUpdateEnabled = true;
bool _showUpdateNotification = true; bool _showUpdateNotification = true;
bool _enableWebVersionCheck = false; bool _enableWebVersionCheck = false;
bool _showSpoofUpdateDialog = true;
@override @override
void initState() { void initState() {
@@ -28,12 +29,13 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
Future<void> _loadUpdateSettings() async { Future<void> _loadUpdateSettings() async {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
setState(() { setState(() {
_isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? true; _isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? true;
_showUpdateNotification = _showUpdateNotification =
prefs.getBool('show_update_notification') ?? true; prefs.getBool('show_update_notification') ?? true;
_enableWebVersionCheck = _enableWebVersionCheck =
prefs.getBool('enable_web_version_check') ?? false; prefs.getBool('enable_web_version_check') ?? false;
_showSpoofUpdateDialog =
prefs.getBool('show_spoof_update_dialog') ?? true;
}); });
} }
@@ -65,7 +67,6 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
Color statusColor; Color statusColor;
final defaultTextColor = Theme.of(context).textTheme.bodyMedium?.color; final defaultTextColor = Theme.of(context).textTheme.bodyMedium?.color;
final isDesktopOrIOS = final isDesktopOrIOS =
Platform.isWindows || Platform.isWindows ||
Platform.isMacOS || Platform.isMacOS ||
@@ -206,6 +207,24 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
_updateSettings('show_update_notification', value); _updateSettings('show_update_notification', value);
}, },
), ),
const Divider(height: 1),
SwitchListTile(
secondary: Icon(
Icons.sync_problem_outlined,
color: Theme.of(context).colorScheme.primary,
),
title: const Text("Диалог обновлений спуфа"),
subtitle: const Text(
"Показывать диалог проверки обновлений спуфа при запуске",
),
value: _showSpoofUpdateDialog,
onChanged: (bool value) {
setState(() {
_showSpoofUpdateDialog = value;
});
_updateSettings('show_spoof_update_dialog', value);
},
),
], ],
), ),
), ),
@@ -239,7 +258,6 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: Stack( body: Stack(
children: [ children: [
GestureDetector( GestureDetector(
onTap: () => Navigator.of(context).pop(), onTap: () => Navigator.of(context).pop(),
child: Container( child: Container(
@@ -249,7 +267,6 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
), ),
), ),
Center( Center(
child: Container( child: Container(
width: 400, width: 400,
@@ -268,7 +285,6 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
), ),
child: Column( child: Column(
children: [ children: [
Container( Container(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -303,7 +319,6 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
), ),
), ),
Expanded( Expanded(
child: ListView( child: ListView(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
@@ -367,6 +382,22 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
); );
}, },
), ),
SwitchListTile(
title: const Text("Диалог обновлений спуфа"),
subtitle: const Text(
"Показывать диалог проверки обновлений спуфа при запуске",
),
value: _showSpoofUpdateDialog,
onChanged: (value) {
setState(() {
_showSpoofUpdateDialog = value;
});
_updateSettings(
'show_spoof_update_dialog',
value,
);
},
),
SwitchListTile( SwitchListTile(
title: const Text("Проверка веб-версии"), title: const Text("Проверка веб-версии"),
subtitle: const Text( subtitle: const Text(
@@ -403,7 +434,6 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
Color statusColor; Color statusColor;
final defaultTextColor = Theme.of(context).textTheme.bodyMedium?.color; final defaultTextColor = Theme.of(context).textTheme.bodyMedium?.color;
final isDesktopOrIOS = final isDesktopOrIOS =
Platform.isWindows || Platform.isWindows ||
Platform.isMacOS || Platform.isMacOS ||
@@ -494,6 +524,24 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
_updateSettings('show_update_notification', value); _updateSettings('show_update_notification', value);
}, },
), ),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
secondary: Icon(
Icons.sync_problem_rounded,
color: Theme.of(context).colorScheme.primary,
),
title: const Text("Диалог обновлений спуфа"),
subtitle: const Text(
"Показывать диалог проверки обновлений спуфа при запуске",
),
value: _showSpoofUpdateDialog,
onChanged: (value) {
setState(() {
_showSpoofUpdateDialog = value;
});
_updateSettings('show_spoof_update_dialog', value);
},
),
SwitchListTile( SwitchListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 16), contentPadding: const EdgeInsets.symmetric(horizontal: 16),
secondary: Icon( secondary: Icon(