From 8151e0ca0d065d73ca45adb230c0e64a9036b64b Mon Sep 17 00:00:00 2001 From: denis0001-dev Date: Sat, 20 Dec 2025 17:41:42 +0300 Subject: [PATCH] Fix WebSocket, refactor code --- .cursor/rules/general.mdc | 21 +++++- .idea/inspectionProfiles/Project_Default.xml | 2 + composeApp/build.gradle.kts | 14 ++-- .../ru/fromchat/api/ApiClient.android.kt | 12 +--- .../res/xml/network_security_config.xml | 12 +--- .../composeResources/values/strings.xml | 2 +- .../kotlin/ru/fromchat/api/ApiClient.kt | 16 +++-- .../kotlin/ru/fromchat/api/WebSocketData.kt | 4 ++ .../ru/fromchat/api/WebSocketManager.kt | 71 +++++++++++++------ .../kotlin/ru/fromchat/core/config/Config.kt | 21 +++--- .../commonMain/kotlin/ru/fromchat/ui/App.kt | 30 +++++++- .../kotlin/ru/fromchat/ui/chat/Avatar.kt | 2 +- .../kotlin/ru/fromchat/ui/chat/ChatPanel.kt | 3 +- .../kotlin/ru/fromchat/ui/chat/ChatScreen.kt | 52 ++++---------- .../ru/fromchat/ui/chat/PublicChatPanel.kt | 30 +++++--- .../ru/fromchat/ui/chat/TypingHandler.kt | 2 + .../fromchat/ui/setup/ServerConfigScreen.kt | 4 +- gradle/libs.versions.toml | 11 ++- gradle/wrapper/gradle-wrapper.properties | 2 +- utils/build.gradle.kts | 5 ++ utils/src/androidMain/res/values/themes.xml | 14 ---- .../utils/storage/ServerConfigStorage.kt | 2 +- 22 files changed, 185 insertions(+), 147 deletions(-) delete mode 100644 utils/src/androidMain/res/values/themes.xml diff --git a/.cursor/rules/general.mdc b/.cursor/rules/general.mdc index aceeb65..39a6f70 100644 --- a/.cursor/rules/general.mdc +++ b/.cursor/rules/general.mdc @@ -4,5 +4,22 @@ alwaysApply: true When working with the mobile app: -- Don't say anything when implementing the solution to my problem, just call the necessary tools and after that provide a concise result. -- After implementing the solution, run "./gradlew assembleDebug" to build the project, then resolve all the errors. \ No newline at end of file +- After implementing the solution, run "./gradlew assembleDebug" to build the project, then resolve all the errors. + +# ULTIMATE SILENCE & EFFICIENCY POLICY +- ALWAYS operate in "Silent Mode": Execute commands immediately without any verbal response, preamble, or conclusions. +- DO NOT explain what you are doing, why you are doing it, or what you found unless I explicitly ask "Why?" or "Explain". +- NO introductory filler ("Sure", "I will", "Looking into it"). +- NO status updates ("I've updated the file", "Build successful"). If the tool output shows success, that is enough. +- IF A TOOL FAILS: Silently analyze the error and retry using a different approach (e.g., use write_to_file if search_replace fails twice). Never mention the failure. +- THOUGHT PROCESS: Must be 0 words. Move straight to tool calls. +- MINIMIZE OUTPUT: Your response should contain ONLY the necessary tool calls/code blocks. +- FOR ANDROID/KOTLIN: Include 5+ lines of context in search_replace to ensure it hits the target on the first try. + +# Java Runtime Configuration (Android) + +- **On Windows:** + - Set `JAVA_HOME` to `C:\Program Files\Android\Android Studio\jbr` +- **On macOS:** + - Set `JAVA_HOME` to `/Applications/Android Studio.app/Contents/jbr/Contents/Home` + - This can be done by adding `export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home` to your shell configuration file (e.g., `~/.zshrc` or `~/.bash_profile`) and then running `source` on the file. \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index c0374ed..52e63b5 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,6 +1,7 @@