The desktop window always reset to its default size after restart because no WindowState was persisted. Add WindowStateStorage backed by multiplatform-settings (java.util.prefs on desktop) to save and restore width, height, and position. Use snapshotFlow inside the Window composition to persist changes continuously, with an explicit Preferences.flush() to ensure values reach disk before exit. Also add 'desktop-install' Makefile target to rebuild and copy the app to /Applications/myicek.app.
35 lines
1.3 KiB
Makefile
35 lines
1.3 KiB
Makefile
.PHONY: android desktop desktop-install android-usb android-emulator
|
|
|
|
ADB := $(shell command -v adb 2>/dev/null || echo "$(HOME)/Library/Android/sdk/platform-tools/adb")
|
|
EMULATOR := $(shell command -v emulator 2>/dev/null || echo "$(HOME)/Library/Android/sdk/emulator/emulator")
|
|
AVD := $(firstword $(shell $(EMULATOR) -list-avds 2>/dev/null))
|
|
APK := composeApp/build/outputs/apk/debug/composeApp-debug.apk
|
|
|
|
android:
|
|
./gradlew composeApp:assembleDebug
|
|
|
|
desktop:
|
|
./gradlew composeApp:run
|
|
|
|
desktop-install:
|
|
./gradlew composeApp:packageDistributionForCurrentOS
|
|
cp -R composeApp/build/compose/binaries/main/app/myicek.app /Applications/myicek.app
|
|
|
|
android-usb: android
|
|
$(ADB) -d install -r $(APK)
|
|
$(ADB) -d shell am start -n ch.parano.myicek/.MainActivity
|
|
|
|
android-emulator: android
|
|
@if ! $(ADB) devices | grep -q '^emulator'; then \
|
|
echo "Aucun émulateur en cours — lancement de $(AVD)…"; \
|
|
$(EMULATOR) -avd $(AVD) -no-snapshot-load >/dev/null 2>&1 & \
|
|
echo "En attente du démarrage…"; \
|
|
$(ADB) -e wait-for-device; \
|
|
while [ "$$($(ADB) -e shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')" != "1" ]; do \
|
|
sleep 2; \
|
|
done; \
|
|
echo "Émulateur prêt."; \
|
|
fi
|
|
$(ADB) -e install -r $(APK)
|
|
$(ADB) -e shell am start -n ch.parano.myicek/.MainActivity
|