Skip to content

Commit 63cfb3c

Browse files
committed
feat(android): rename APK to crossbar.apk and add Telegram caption support
- Configure applicationVariants.all in build.gradle.kts to generate crossbar.apk - Update Makefile to use Gradle output path instead of flutter-apk folder - Add CAPTION parameter for make android with tdl upload support - Fix AndroidManifest.xml to use @string/app_name instead of hardcoded value - Document CAPTION usage and syntax rules in AGENTS.md
1 parent bd13db4 commit 63cfb3c

File tree

4 files changed

+82
-23
lines changed

4 files changed

+82
-23
lines changed

AGENTS.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ Plugins usam a própria CLI do Crossbar para obter dados.
210210
| Testes (sem hardware) | `flutter test --exclude-tags=hardware` (evita glitches locais) |
211211
| Verificar Coverage | Verificar se coverage está >= 43% (lcov --summary coverage/lcov.info) |
212212
| Build Release (Linux) | `make linux` |
213+
| Build Release (Android) | `make android` ou `make android CAPTION="- Feature 1\n- Fix 2"` |
213214
| Analisar Código | `flutter analyze --no-fatal-infos` |
214215
| Monitorar CI | `gh run watch` |
215216
| **Matar GUI + Reabrir** | `pkill -9 -f crossbar-gui; ./build/linux/x64/release/bundle/crossbar gui` |
@@ -236,6 +237,48 @@ Ou use o comando combinado:
236237
pkill -9 -f crossbar-gui; pkill -9 -f crossbar; flutter build linux --release && ./build/linux/x64/release/bundle/crossbar gui
237238
```
238239

240+
### 📱 Build Android com Upload para Telegram
241+
242+
O comando `make android` gera `crossbar.apk` e faz upload via `tdl` (se instalado).
243+
244+
**Uso básico** (sem legenda):
245+
```bash
246+
make android
247+
```
248+
249+
**Com release notes** (use `\n` para quebras de linha):
250+
```bash
251+
make android CAPTION="- Corrigido bug X\n- Adicionada feature Y"
252+
```
253+
254+
**⚠️ Regras importantes para CAPTION:**
255+
1. **Use `\n` para quebras de linha** - Não use quebras de linha reais no terminal
256+
2. **Evite caracteres especiais** - ``, ``, emojis podem causar erros de parsing
257+
3. **Use hífen `-` para listas** - Funciona melhor que bullets
258+
4. **Aspas simples dentro do texto** - Escape com `\'` ou evite
259+
260+
**Exemplos corretos:**
261+
```bash
262+
# Lista simples
263+
make android CAPTION="- Feature 1\n- Feature 2\n- Bug fix"
264+
265+
# Com descrição
266+
make android CAPTION="Release v1.5.0\n\n- Nova UI\n- Performance melhorada"
267+
```
268+
269+
**Exemplos que causam erro:**
270+
```bash
271+
# ❌ Quebra de linha real (erro de sintaxe)
272+
make android CAPTION="- Feature 1
273+
- Feature 2"
274+
275+
# ❌ Bullet point unicode (erro de parsing)
276+
make android CAPTION="• Feature 1"
277+
278+
# ❌ Aspas não escapadas
279+
make android CAPTION="Versão "beta""
280+
```
281+
239282
---
240283

241284
## 9. Diretrizes de Desenvolvimento (Development Guidelines)

Makefile

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,25 @@ windows:
141141
dart compile exe bin/crossbar.dart -o $(WINDOWS_BUNDLE)/crossbar.exe
142142
@echo "Done! Binaries at $(WINDOWS_BUNDLE)/"
143143

144-
# Android build
144+
# Android build (APK name configured in android/app/build.gradle.kts)
145+
# Usage: make android CAPTION="Release notes here"
146+
# Caption supports HTML: <b>bold</b>, <i>italic</i>, <code>code</code>
147+
# Use \n for newlines in CAPTION
148+
CAPTION ?=
145149
android:
146150
flutter build apk --release --target-platform android-arm64
147-
@if command -v tdl >/dev/null 2>&1; then tdl up -t 6 --path=./build/app/outputs/flutter-apk/app-release.apk; fi
148-
@echo "Done! APK at build/app/outputs/flutter-apk/app-release.apk"
151+
@if command -v tdl >/dev/null 2>&1; then \
152+
VERSION=$$(grep '^version:' pubspec.yaml | cut -d' ' -f2); \
153+
if [ -n "$(CAPTION)" ]; then \
154+
tdl up -t 6 -c 3305021517 --path=./build/app/outputs/apk/release/crossbar.apk \
155+
--caption "\"<b>Crossbar v$$VERSION</b>\n\n$(CAPTION)\""; \
156+
else \
157+
tdl up -t 6 -c 3305021517 --path=./build/app/outputs/apk/release/crossbar.apk \
158+
--caption "\"<b>Crossbar v$$VERSION</b>\""; \
159+
fi; \
160+
fi
161+
@echo "Done! APK at build/app/outputs/apk/release/crossbar.apk"
162+
@echo "Done! APK at build/app/outputs/apk/release/crossbar.apk"
149163

150164
# Run tests
151165
test:
@@ -222,5 +236,3 @@ icons:
222236
@echo "Generating launcher icons (Android, Windows, macOS)..."
223237
dart run flutter_launcher_icons
224238
@echo "Done! All icons generated."
225-
226-

android/app/build.gradle.kts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ plugins {
88
id("dev.flutter.flutter-gradle-plugin")
99
}
1010

11-
val keystoreProperties = Properties()
1211
val keystorePropertiesFile = rootProject.file("key.properties")
12+
val keystoreProperties = Properties()
1313
if (keystorePropertiesFile.exists()) {
1414
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
1515
}
@@ -29,33 +29,29 @@ android {
2929
jvmTarget = JavaVersion.VERSION_17.toString()
3030
}
3131

32-
defaultConfig {
33-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
34-
applicationId = "com.verseles.crossbar"
35-
// You can update the following values to match your application needs.
36-
// For more information, see: https://flutter.dev/to/review-gradle-config.
37-
minSdk = 24
38-
targetSdk = flutter.targetSdkVersion
39-
versionCode = flutter.versionCode
40-
versionName = flutter.versionName
41-
}
42-
4332
signingConfigs {
4433
create("release") {
4534
keyAlias = keystoreProperties["keyAlias"] as String?
4635
keyPassword = keystoreProperties["keyPassword"] as String?
47-
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
36+
storeFile = keystoreProperties["storeFile"]?.let { file("$it") }
4837
storePassword = keystoreProperties["storePassword"] as String?
4938
}
5039
}
5140

41+
defaultConfig {
42+
applicationId = "com.verseles.crossbar"
43+
minSdk = 24
44+
targetSdk = flutter.targetSdkVersion
45+
versionCode = flutter.versionCode
46+
versionName = flutter.versionName
47+
}
48+
5249
buildTypes {
5350
release {
54-
// Configures the signing config for the release build.
55-
if (keystoreProperties["storeFile"] != null) {
56-
signingConfig = signingConfigs.getByName("release")
51+
signingConfig = if (keystorePropertiesFile.exists()) {
52+
signingConfigs.getByName("release")
5753
} else {
58-
signingConfig = signingConfigs.getByName("debug")
54+
signingConfigs.getByName("debug")
5955
}
6056

6157
// Enable minification and obfuscation for release
@@ -68,6 +64,14 @@ android {
6864
)
6965
}
7066
}
67+
68+
applicationVariants.all {
69+
outputs.forEach { output ->
70+
if (output is com.android.build.gradle.internal.api.BaseVariantOutputImpl) {
71+
output.outputFileName = "crossbar.apk"
72+
}
73+
}
74+
}
7175
}
7276

7377
flutter {

android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22
<application
3-
android:label="crossbar"
3+
android:label="@string/app_name"
44
android:name="${applicationName}"
55
android:icon="@mipmap/ic_launcher"
66
android:usesCleartextTraffic="true">

0 commit comments

Comments
 (0)