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

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();
_initDeepLinking();
_showSpoofUpdateDialogIfNeeded();
_connectionSubscription = ApiService.instance.connectionStatus.listen((
status,
@@ -68,7 +68,6 @@ class _HomeScreenState extends State<HomeScreen> {
}
});
_messageSubscription = ApiService.instance.messages.listen((message) {
if (message['type'] == 'session_terminated' && mounted) {
_handleSessionTerminated(message['message']);
@@ -86,7 +85,6 @@ class _HomeScreenState extends State<HomeScreen> {
if (!mounted) return;
setState(() => _isProfileLoading = true);
try {
final cachedProfile = ApiService.instance.lastChatsPayload?['profile'];
if (cachedProfile != null) {
if (mounted) {
@@ -96,7 +94,6 @@ class _HomeScreenState extends State<HomeScreen> {
});
}
} else {
final result = await ApiService.instance.getChatsAndContacts(
force: false,
);
@@ -124,7 +121,7 @@ class _HomeScreenState extends State<HomeScreen> {
) async {
await showDialog(
context: context,
barrierDismissible: false, // Пользователь должен сделать выбор
barrierDismissible: false, // Зачем давать им выбор оло
builder: (BuildContext dialogContext) {
return AlertDialog(
title: const Text('Доступно обновление'),
@@ -135,7 +132,7 @@ class _HomeScreenState extends State<HomeScreen> {
TextButton(
child: const Text('Отменить'),
onPressed: () {
Navigator.of(dialogContext).pop(); // Просто закрыть диалог
Navigator.of(dialogContext).pop();
},
),
FilledButton(
@@ -151,12 +148,10 @@ class _HomeScreenState extends State<HomeScreen> {
print("Ошибка переподключения: $e");
}
if (mounted) {
Navigator.of(dialogContext).pop();
}
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
@@ -177,11 +172,9 @@ class _HomeScreenState extends State<HomeScreen> {
try {
final prefs = await SharedPreferences.getInstance();
final isWebVersionCheckEnabled =
prefs.getBool('enable_web_version_check') ?? false;
if (!isWebVersionCheckEnabled) {
print("Web version checking is disabled, skipping check");
return;
@@ -196,7 +189,6 @@ class _HomeScreenState extends State<HomeScreen> {
if (latestVersion != currentVersion) {
if (isAutoUpdateEnabled) {
await prefs.setString('spoof_appversion', latestVersion);
print("Версия сессии автоматически обновлена до $latestVersion");
@@ -223,7 +215,6 @@ class _HomeScreenState extends State<HomeScreen> {
);
}
} else if (showUpdateNotification) {
if (mounted) {
_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) {
final errorPayload = message['payload'];
String errorMessage = 'Неизвестная ошибка';
@@ -730,7 +863,6 @@ class _DesktopLayoutState extends State<_DesktopLayout> {
_loadMyProfile();
}
Future<void> _loadMyProfile() async {
if (!mounted) return;
setState(() => _isProfileLoading = true);
@@ -753,7 +885,6 @@ class _DesktopLayoutState extends State<_DesktopLayout> {
}
}
void _onChatSelected(
Chat chat,
Contact contact,

View File

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

View File

@@ -17,6 +17,7 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
bool _isAutoUpdateEnabled = true;
bool _showUpdateNotification = true;
bool _enableWebVersionCheck = false;
bool _showSpoofUpdateDialog = true;
@override
void initState() {
@@ -28,12 +29,13 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
Future<void> _loadUpdateSettings() async {
final prefs = await SharedPreferences.getInstance();
setState(() {
_isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? true;
_showUpdateNotification =
prefs.getBool('show_update_notification') ?? true;
_enableWebVersionCheck =
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;
final defaultTextColor = Theme.of(context).textTheme.bodyMedium?.color;
final isDesktopOrIOS =
Platform.isWindows ||
Platform.isMacOS ||
@@ -206,6 +207,24 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
_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,
body: Stack(
children: [
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
@@ -249,7 +267,6 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
),
),
Center(
child: Container(
width: 400,
@@ -268,7 +285,6 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
),
child: Column(
children: [
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
@@ -303,7 +319,6 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
),
),
Expanded(
child: ListView(
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(
title: const Text("Проверка веб-версии"),
subtitle: const Text(
@@ -403,7 +434,6 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
Color statusColor;
final defaultTextColor = Theme.of(context).textTheme.bodyMedium?.color;
final isDesktopOrIOS =
Platform.isWindows ||
Platform.isMacOS ||
@@ -494,6 +524,24 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
_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(
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
secondary: Icon(