Files
Password-Manager/android-client/repack-apk.ps1
T
r-zakarya 77809b09c8 refactor(android): the unlock screen moves to HTML, Skia and the style go
The caret in an Android TEdit does not land where you touch, which makes a long bearer token impossible to correct - the reason the last FMX screen had to go. A field in the engine inherits the system's text handling (caret, selection, handles, paste) for free.

With no FMX control left, two things became dead weight and are gone: the vendored Dark.style, which had nothing left to style, and Skia - 25 MB carried solely so FMX labels would shape Arabic. The engine does its own shaping; checked on the device, an Arabic filename still reads correctly. The APK drops from 22.0 to 12.7 MB.

Delphi stays the owner of the server settings; the page only edits them and hands them back when a field loses focus, one navigation per changed field rather than one per keystroke.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 10:40:06 +01:00

54 lines
2.9 KiB
PowerShell

# Refait les trois dernieres etapes de l'empaquetage Android, sur le dossier
# deja prepare - sans le vider au prealable.
#
# POURQUOI : la cible Deploy de MSBuild reconstruit library\lib avant d'appeler
# aapt, ce qui efface toute bibliotheque native ajoutee a la main. Or ce projet
# n'a pas d'entrees de deploiement fonctionnelles (voir README), donc nos icones
# ne peuvent y arriver autrement. On laisse Deploy faire son travail, puis on
# remet ce qu'il a efface et on refait aapt / zipalign / signature.
#
# A lancer depuis la racine du depot, apres un Deploy reussi.
$ErrorActionPreference = 'Stop'
$sdk = 'C:\Users\Public\Documents\Embarcadero\Studio\23.0\CatalogRepository\AndroidSDK-2525-23.0.51511.6924'
$bds = 'C:\Program Files (x86)\Embarcadero\Studio\23.0'
$jdk = 'C:\Program Files\Eclipse Adoptium\jdk-11.0.15.10-hotspot'
$pac = "$bds\bin\paclient.exe"
$p = '.\Android64\Debug\pmserverApk'
# 1. Nos icones par-dessus celles de Delphi :
# les proprietes Android_LauncherIcon* et Android_AdaptiveIcon* du .dproj
# devraient suffire, mais rien ne les deploie ici.
Copy-Item "$PSScriptRoot\android-res\*" "$p\res\" -Recurse -Force
# 1 ter. L'ecran de demarrage existe en plusieurs variantes de densite et de
# theme, toutes identiques chez nous. Une seule source, recopiee : quatre
# fichiers identiques dans le depot finiraient par diverger.
$splash = "$p\res\drawable\splash_vector.xml"
foreach ($v in 'drawable-anydpi-v31', 'drawable-night-anydpi-v21', 'drawable-night-anydpi-v31') {
if (Test-Path "$p\res\$v") { Copy-Item $splash "$p\res\$v\splash_vector.xml" -Force }
}
if (Test-Path "$p\res\drawable-anydpi-v21") {
Copy-Item "$p\res\drawable\splash_image_def.xml" "$p\res\drawable-anydpi-v21\splash_image_def.xml" -Force
}
# Le fond sombre vaut aussi en theme clair : l'application n'a qu'un theme.
if (Test-Path "$p\res\values-night-v21") {
Copy-Item "$PSScriptRoot\android-res\values\colors.xml" "$p\res\values-night-v21\colors.xml" -Force
}
# 2. aapt : reconstruit l'archive non alignee depuis library, classes, res.
& $pac -u8 --aaptpackage="$sdk\build-tools\33.0.2\Aapt.exe,$p\library,$p\classes,$p\res,$p\assets,$p\AndroidManifest.xml,$sdk\platforms\android-33\android.jar,$p\bin\pmserverApk-unaligned.apk"
if ($LASTEXITCODE -ne 0) { throw "aapt a echoue" }
# 3. zipalign refuse d'ecraser sa sortie : l'APK precedent doit disparaitre.
Remove-Item "$p\bin\pmserverApk.apk" -Force -ErrorAction SilentlyContinue
& $pac -u8 --zipalign="$sdk\build-tools\33.0.2\ZipAlign.exe,$p\bin\pmserverApk-unaligned.apk,$p\bin\pmserverApk.apk,4"
if ($LASTEXITCODE -ne 0) { throw "zipalign a echoue" }
& $pac -u8 --apksign="$jdk\bin\java.exe,$sdk\build-tools\33.0.2\lib\apksigner.jar,$p\bin\pmserverApk.apk,androiddebugkey,$env:APPDATA\Embarcadero\BDS\23.0\debug.keystore,android,android"
if ($LASTEXITCODE -ne 0) { throw "signature echouee" }
$apk = Get-Item "$p\bin\pmserverApk.apk"
"APK {0:N1} Mo" -f ($apk.Length / 1MB)