Little refactor

This commit is contained in:
ivan2282
2025-12-10 17:34:10 +03:00
parent ecdb34505c
commit bdea92a61b
35 changed files with 74 additions and 30 deletions

View File

@@ -58,6 +58,8 @@ class RegistrationService {
) )
.asFunction(); .asFunction();
print('✅ LZ4 block decompress функция загружена'); print('✅ LZ4 block decompress функция загружена');
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
} catch (e) { } catch (e) {
print( print(
'⚠️ Функция LZ4_decompress_safe не найдена, пробуем альтернативные имена...', '⚠️ Функция LZ4_decompress_safe не найдена, пробуем альтернативные имена...',

View File

@@ -147,7 +147,8 @@ class ApiService {
return false; return false;
} }
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
Completer<Map<String, dynamic>>? _inflightChatsCompleter; Completer<Map<String, dynamic>>? _inflightChatsCompleter;
Map<String, dynamic>? _lastChatsPayload; Map<String, dynamic>? _lastChatsPayload;
DateTime? _lastChatsAt; DateTime? _lastChatsAt;

View File

@@ -36,7 +36,8 @@ extension ApiServiceAuth on ApiService {
}; };
_sendMessage(17, payload); _sendMessage(17, payload);
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
void requestSessions() { void requestSessions() {
_sendMessage(96, {}); _sendMessage(96, {});
} }

View File

@@ -48,7 +48,8 @@ extension ApiServiceChats on ApiService {
if (chatResponse['cmd'] == 1) { if (chatResponse['cmd'] == 1) {
print("✅ Авторизация (opcode 19) успешна. Сессия ГОТОВА."); print("✅ Авторизация (opcode 19) успешна. Сессия ГОТОВА.");
_isSessionReady = true; _isSessionReady = true;
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
_connectionStatusController.add("ready"); _connectionStatusController.add("ready");
_updateConnectionState( _updateConnectionState(
conn_state.ConnectionState.ready, conn_state.ConnectionState.ready,

View File

@@ -7,7 +7,8 @@ extension ApiServiceComplaints on ApiService {
final payload = {"complainSync": 0}; final payload = {"complainSync": 0};
_sendMessage(162, payload); _sendMessage(162, payload);
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
void sendComplaint(int chatId, String messageId, int typeId, int reasonId) { void sendComplaint(int chatId, String messageId, int typeId, int reasonId) {
final payload = { final payload = {
"reasonId": reasonId, "reasonId": reasonId,

View File

@@ -123,7 +123,8 @@ extension ApiServiceConnection on ApiService {
authToken = null; authToken = null;
clearAllCaches(); clearAllCaches();
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
_messageController.add({ _messageController.add({
'type': 'session_terminated', 'type': 'session_terminated',
'message': 'Твоя сессия больше не активна, войди снова', 'message': 'Твоя сессия больше не активна, войди снова',

View File

@@ -46,7 +46,8 @@ extension ApiServiceContacts on ApiService {
}; };
_sendMessage(54, payload); _sendMessage(54, payload);
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
Future<Map<String, dynamic>> getChatInfoByLink(String link) async { Future<Map<String, dynamic>> getChatInfoByLink(String link) async {
await waitUntilOnline(); await waitUntilOnline();

View File

@@ -12,7 +12,8 @@ extension ApiServiceMedia on ApiService {
) async { ) async {
try { try {
await waitUntilOnline(); await waitUntilOnline();
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
final Map<String, dynamic> payload = { final Map<String, dynamic> payload = {
"firstName": firstName, "firstName": firstName,
"lastName": lastName, "lastName": lastName,

View File

@@ -28,7 +28,8 @@ extension ApiServicePrivacy on ApiService {
} }
if (incomingCall != null) { if (incomingCall != null) {
final seq = incomingCall == 'ALL' ? 30 : 23; final seq = incomingCall == 'ALL' ? 30 : 23;
await _updatePrivacySettingWithSeq({'INCOMING_CALL': incomingCall}, seq); // If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI await _updatePrivacySettingWithSeq({'INCOMING_CALL': incomingCall}, seq);
} }
if (chatsInvite != null) { if (chatsInvite != null) {
final seq = chatsInvite == 'ALL' ? 51 : 55; final seq = chatsInvite == 'ALL' ? 51 : 55;

View File

@@ -159,7 +159,8 @@ class ConnectionLogger {
data: data, data: data,
); );
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
void logState(String from, String to, {Map<String, dynamic>? metadata}) { void logState(String from, String to, {Map<String, dynamic>? metadata}) {
final data = <String, dynamic>{ final data = <String, dynamic>{

View File

@@ -83,7 +83,8 @@ class ConnectionManager {
bool get canSendMessages => currentState.canSendMessages; bool get canSendMessages => currentState.canSendMessages;
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
Future<void> initialize() async { Future<void> initialize() async {
if (_isDisposed) { if (_isDisposed) {
_logger.logError('Попытка инициализации после dispose'); _logger.logError('Попытка инициализации после dispose');

View File

@@ -85,7 +85,8 @@ class ConnectionManagerSimple {
bool get canSendMessages => currentState.canSendMessages; bool get canSendMessages => currentState.canSendMessages;
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
Future<void> initialize() async { Future<void> initialize() async {
if (_isDisposed) { if (_isDisposed) {

View File

@@ -25,7 +25,8 @@ enum ConnectionState {
disabled, disabled,
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
class ConnectionInfo { class ConnectionInfo {
final ConnectionState state; final ConnectionState state;

View File

@@ -62,7 +62,8 @@ class HealthMetrics {
return max(0, score); return max(0, score);
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
ConnectionQuality get quality { ConnectionQuality get quality {
final score = healthScore; final score = healthScore;
if (score >= 90) return ConnectionQuality.excellent; if (score >= 90) return ConnectionQuality.excellent;

View File

@@ -119,7 +119,8 @@ class RetryStrategy {
), ),
}; };
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
Duration calculateDelay(int attempt, ErrorType errorType) { Duration calculateDelay(int attempt, ErrorType errorType) {
final config = errorConfigs[errorType] ?? errorConfigs[ErrorType.unknown]!; final config = errorConfigs[errorType] ?? errorConfigs[ErrorType.unknown]!;

View File

@@ -105,3 +105,5 @@ class Account {
); );
} }
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI

View File

@@ -115,3 +115,5 @@ class AttachmentsParser {
}).toList(); }).toList();
} }
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI

View File

@@ -38,3 +38,5 @@ class Channel {
); );
} }
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI

View File

@@ -108,3 +108,5 @@ class Chat {
); );
} }
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI

View File

@@ -83,3 +83,5 @@ class ChatFolderWidget {
); );
} }
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI

View File

@@ -45,3 +45,5 @@ class ComplaintData {
); );
} }
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI

View File

@@ -52,7 +52,8 @@ class Contact {
final isBlocked = status == 'BLOCKED'; final isBlocked = status == 'BLOCKED';
final isBlockedByMe = status == 'BLOCKED'; final isBlockedByMe = status == 'BLOCKED';
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
return Contact( return Contact(
id: json['id'], id: json['id'],
name: finalName, name: finalName,

View File

@@ -41,7 +41,8 @@ class Message {
} else { } else {
time = 0; time = 0;
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
return Message( return Message(
id: id:
json['id']?.toString() ?? json['id']?.toString() ??
@@ -115,7 +116,8 @@ class Message {
return hoursSinceCreation <= 24; return hoursSinceCreation <= 24;
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return { return {
'id': id, 'id': id,

View File

@@ -39,7 +39,8 @@ class Profile {
final names = profileData['names'] as List<dynamic>? ?? []; final names = profileData['names'] as List<dynamic>? ?? [];
final nameData = names.isNotEmpty ? names[0] as Map<String, dynamic> : {}; final nameData = names.isNotEmpty ? names[0] as Map<String, dynamic> : {};
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
return Profile( return Profile(
id: profileData['id'], id: profileData['id'],
phone: profileData['phone'].toString(), phone: profileData['phone'].toString(),

View File

@@ -4769,7 +4769,8 @@ class _SferumWebViewPanelState extends State<SferumWebViewPanel> {
); );
} }
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
class _AddChatsToFolderDialog extends StatefulWidget { class _AddChatsToFolderDialog extends StatefulWidget {
final ChatFolder folder; final ChatFolder folder;
final List<Chat> availableChats; final List<Chat> availableChats;

View File

@@ -100,7 +100,8 @@ class _CustomRequestScreenState extends State<CustomRequestScreen> {
} }
}); });
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
subscription = ApiService.instance.messages.listen((message) { subscription = ApiService.instance.messages.listen((message) {
if (message['seq'] == sentSeq) { if (message['seq'] == sentSeq) {

View File

@@ -16,7 +16,8 @@ class DebugScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final colors = Theme.of(context).colorScheme; final colors = Theme.of(context).colorScheme;
final theme = context.watch<ThemeProvider>(); final theme = context.watch<ThemeProvider>();
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Debug Settings'), title: const Text('Debug Settings'),

View File

@@ -167,7 +167,8 @@ class _HomeScreenState extends State<HomeScreen> {
}, },
); );
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
Future<void> _checkVersionInBackground() async { Future<void> _checkVersionInBackground() async {
try { try {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
@@ -178,7 +179,8 @@ class _HomeScreenState extends State<HomeScreen> {
if (!isWebVersionCheckEnabled) { if (!isWebVersionCheckEnabled) {
print("Web version checking is disabled, skipping check"); print("Web version checking is disabled, skipping check");
return; return;
} }// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
final isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? false; final isAutoUpdateEnabled = prefs.getBool('auto_update_enabled') ?? false;
final showUpdateNotification = final showUpdateNotification =

View File

@@ -122,7 +122,8 @@ class _MusicLibraryScreenState extends State<MusicLibraryScreen> {
final seconds = duration.inSeconds.remainder(60); final seconds = duration.inSeconds.remainder(60);
return '${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}'; return '${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}';
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);

View File

@@ -85,7 +85,8 @@ class _PasswordAuthScreenState extends State<PasswordAuthScreen> {
errorMessage = error['message']; errorMessage = error['message'];
} }
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text(errorMessage), content: Text(errorMessage),

View File

@@ -17,7 +17,8 @@ class AboutScreen extends StatelessWidget {
print('Could not launch $url'); print('Could not launch $url');
} }
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
Widget _buildTeamMember( Widget _buildTeamMember(
BuildContext context, { BuildContext context, {

View File

@@ -75,7 +75,8 @@ class _QrLoginScreenState extends State<QrLoginScreen> {
} }
} }
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
void _regenerateQrData() { void _regenerateQrData() {
if (_token == null) return; if (_token == null) return;

View File

@@ -22,7 +22,8 @@ class _ReconnectionScreenState extends State<ReconnectionScreen> {
_startFullReconnection(); _startFullReconnection();
_listenToApiMessages(); _listenToApiMessages();
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
@override @override
void dispose() { void dispose() {
_apiSubscription?.cancel(); _apiSubscription?.cancel();

View File

@@ -25,7 +25,8 @@ class LogEntry {
required this.type, required this.type,
}); });
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
class SocketLogScreen extends StatefulWidget { class SocketLogScreen extends StatefulWidget {
const SocketLogScreen({super.key}); const SocketLogScreen({super.key});

View File

@@ -88,7 +88,8 @@ class _TokenAuthScreenState extends State<TokenAuthScreen> {
} }
// If you're touching ( you doing this rignt now ) this file, STOP IMEDIATLY! This is violiating TeamKomet code revision policy!
// If you're touching ( you doing this rignt now ) this file, AND DONT WANT TO STOP! REFACTOR IT IMMEDIATLY TO MAKE SOME SENSE AND DONT LOOK LIKE SHIT BY AI
void _loginWithToken() { void _loginWithToken() {
final token = _tokenController.text.trim(); final token = _tokenController.text.trim();
if (token.isEmpty) { if (token.isEmpty) {