Files
Qlyra/CLAUDE.md
T
klockky 888a6d2075 perf(android): уменьшаем вес APK на ~33% (65→43.6 МБ)
- media_kit только для десктопа — убраны ffmpeg/libass/mdk с мобилы (~10 МБ)
- google_fonts заменён бандлом Inter/Outfit/Unbounded — убран реестр всех
  шрифтов из libapp.so (22→10 МБ)
- удалена неиспользуемая зависимость camera (CameraX)
- Dart-обфускация (--obfuscate --split-debug-info) в релизных CI + выгрузка
  символов
- кастомные шрифты с Google Fonts вернулись через FontLoader + кэш, без веса
- хардкод Inter заменён наследованием шрифта из активной темы
2026-06-25 22:51:04 +03:00

85 lines
3.5 KiB
Markdown

# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project
Komet is a cross-platform Flutter messaging client (Android, iOS, macOS, Windows, Linux, Web) that communicates via a custom packet-based protocol with MessagePack serialization and Zstd compression.
## Commands
```bash
flutter pub get # install dependencies
flutter analyze # lint / static analysis
flutter run # run on connected device (default: komet flavor)
flutter run --flavor oneme -t lib/main.dart # run oneme flavor (FCM)
# Android builds (release builds use obfuscation; keep symbols to de-obfuscate crashes)
flutter build apk --release --flavor komet --obfuscate --split-debug-info=build/symbols
flutter build apk --release --split-per-abi --flavor komet --obfuscate --split-debug-info=build/symbols
flutter build appbundle --release --flavor komet --obfuscate --split-debug-info=build/symbols
# Other platforms
flutter build ios --release --no-codesign
flutter build macos --release
flutter build web --release
flutter build linux --release
flutter build windows --release
```
Android builds require **Java 17**. Gradle memory is configured to `-Xmx4096m`.
## Build Flavors
| Flavor | App ID | Notes |
|--------|--------|-------|
| `komet` | `ru.komet.app` | Default, no FCM |
| `oneme` | `ru.oneme.app` | FCM push notifications via Firebase |
Flavor-specific Android resources live in `android/app/src/komet/` and `android/app/src/oneme/`.
## Architecture
The codebase follows a strict layered architecture:
```
core/transport/ — raw socket I/O: connection, sender, receiver, dispatcher, proxy
core/protocol/ — Packet struct, opcode map, MessagePack + Zstd serialization
core/storage/ — SQLite (sqflite), secure token storage, spoofing service
core/push/ — FCM integration (oneme flavor only)
core/config/ — app config, proxy config, device presets, countries list
backend/api.dart — session lifecycle: connect, handshake, ping, auto-reconnect
backend/modules/ — feature modules: account, messages, chats, contacts, calls, folders
state/ — ChangeNotifier state classes consumed by the UI
models/ — plain data classes (User, Chat, Message, Call, Attachment, Session)
frontend/screens/ — full-page widgets grouped by feature (auth/, chats/, contacts/, calls/, profile/)
frontend/widgets/ — reusable components (message_bubble, chat_tile, avatar, etc.)
```
Data flow: UI → backend module → `api.dart` → transport layer → server.
Incoming packets: transport → dispatcher → backend module → state → UI rebuild.
## Key Conventions (from AGENTS.md)
- **No comments in code.** Write self-documenting code instead.
- **Use `showCustomNotification(context, 'text')`** for all user-facing notifications — never use SnackBars.
- When a fix can be done quickly with a hack or properly with a rewrite, **choose the proper rewrite**.
- Quality over quantity.
## Localization
Two locales supported: English (`lib/l10n/app_en.arb`) and Russian (`lib/l10n/app_ru.arb`).
Generated code is in `lib/l10n/` (produced by `flutter gen-l10n` via `l10n.yaml`).
## CI/CD
Four GitHub Actions workflows in `.github/workflows/`:
- `flutter-dev.yml` — PR lint + Android build for dev branch
- `flutter-main.yml` — PR lint + all-platform builds for main branch
- `build-android.yml` — production APKs + AAB (`komet` flavor), triggered on push to main
- `build-android-fcm.yml` — production APKs + AAB (`oneme` flavor with FCM), triggered on push to main