Rewrite the launcher in MoonBit (old code moves to legacy/) #1
No files matched your search
@@ -0,0 +1,33 @@
|
|||||||
|
name: Legacy launcher (Qt)
|
||||||
|
|
||||||
|
# The Qt build now lives in legacy/. The launcher is built from the repo root (MoonBit, see
|
||||||
|
# launcher.yml), so this runs only by hand, and does not publish a release unless asked: its
|
||||||
|
# releases (build-<minutes>) would otherwise compete with the MoonBit build's for "latest".
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
publish:
|
||||||
|
description: Publish the APK as a release
|
||||||
|
default: "false"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
apk:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 60
|
||||||
|
container: eclipse-temurin:17-jdk-noble
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
apt-get update -qq
|
||||||
|
apt-get install -y -qq --no-install-recommends git ca-certificates >/dev/null
|
||||||
|
git init -q
|
||||||
|
git -c http.extraHeader="Authorization: Basic $(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 -w0)" \
|
||||||
|
fetch -q --depth 1 "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" "${GITHUB_SHA}"
|
||||||
|
git checkout -q --detach FETCH_HEAD
|
||||||
|
- name: Test, build and release the Qt APK
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ github.token }}
|
||||||
|
LEGACY_PUBLISH: ${{ inputs.publish }}
|
||||||
|
run: bash legacy/ci/gitea-apk.sh
|
||||||
@@ -1,14 +1,17 @@
|
|||||||
name: Launcher
|
name: Legacy launcher
|
||||||
|
|
||||||
|
# The previous implementations (ultra WebView, Qt) now live in legacy/. The launcher is built
|
||||||
|
# from the repo root (MoonBit, see .gitea/workflows/launcher.yml), so this only runs by hand.
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: legacy
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
web:
|
web:
|
||||||
# Playwright's Chromium has no build for ubuntu-latest (26.04) yet.
|
# Playwright's Chromium has no build for ubuntu-latest (26.04) yet.
|
||||||
@@ -24,6 +27,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
locked: false
|
locked: false
|
||||||
|
manifest-path: legacy/pixi.toml
|
||||||
# Playwright's browser download hangs while unpacking under pixi's Node 26, so fetch
|
# Playwright's browser download hangs while unpacking under pixi's Node 26, so fetch
|
||||||
# Chromium with the runner's own Node; the test itself still runs in the pixi env.
|
# Chromium with the runner's own Node; the test itself still runs in the pixi env.
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v5
|
||||||
@@ -49,14 +53,14 @@ jobs:
|
|||||||
java-version: 17
|
java-version: 17
|
||||||
- uses: gradle/actions/setup-gradle@v5
|
- uses: gradle/actions/setup-gradle@v5
|
||||||
- name: Build the APK
|
- name: Build the APK
|
||||||
working-directory: android
|
working-directory: legacy/android
|
||||||
# The run number only grows, so each build's versionCode is newer than the last
|
# The run number only grows, so each build's versionCode is newer than the last
|
||||||
# (it restarts if this workflow is renamed; bump past the old numbers then).
|
# (it restarts if this workflow is renamed; bump past the old numbers then).
|
||||||
run: ./gradlew --no-daemon assembleDebug -PversionCode=${{ github.run_number }}
|
run: ./gradlew --no-daemon assembleDebug -PversionCode=${{ github.run_number }}
|
||||||
- uses: actions/upload-artifact@v5
|
- uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
name: ultra-launcher-apk
|
name: ultra-launcher-apk
|
||||||
path: android/app/build/outputs/apk/debug/app-debug.apk
|
path: legacy/android/app/build/outputs/apk/debug/app-debug.apk
|
||||||
# Keep a "launcher-latest" prerelease with the newest APK, so a phone can download it directly.
|
# Keep a "launcher-latest" prerelease with the newest APK, so a phone can download it directly.
|
||||||
- name: Publish the launcher-latest release
|
- name: Publish the launcher-latest release
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
# ultra launcher
|
||||||
|
|
||||||
|
An Android home screen, written in [MoonBit](https://www.moonbitlang.com). Home starts blank: long-press it to add apps (the drawer opens in a pick mode) or widgets, and long-press anything on it to drag it somewhere else; let go without moving to get its menu, or, for a widget, handles on its edges that resize it to the grid. Swipe down (or tap the search pill) for the drawer with every app and a search (Enter opens the first match); long-press an app there for its menu (add to home, app info, uninstall; system apps have no uninstall), and swipe up to close it. The **Windows** button in the panel at the top opens Recents. The layout is saved on the device, and the app updates itself from the latest release here.
|
||||||
|
|
||||||
|
| home | drawer | app menu | resize handles |
|
||||||
|
|---|---|---|---|
|
||||||
|
|  |  |  |  |
|
||||||
|
|
||||||
|
(Screenshots are of the browser demo at phone size.)
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Get the APK from the [latest release](https://git.site.latha.org/experiments/launcher/releases/latest), which CI rebuilds on every push to `main`. Open it once, press Home, and pick **ultra Home** as the default. The package is `dev.ultra.launcher` and builds are signed with the committed `android/debug.keystore`, the same key every earlier build (WebView, Qt) used, so this installs over them. The activity keeps the Qt build's class name, so the default-home choice survives.
|
||||||
|
|
||||||
|
The **Windows** button uses an accessibility service (`RecentsService`, which only performs the Recents action). Enable it once under Settings → Accessibility; on Android 13+ a sideloaded APK may first need App info → ⋮ → Allow restricted settings.
|
||||||
|
|
||||||
|
On first start the old WebView build's home screen (its `ultra.home.*` localStorage) is imported. The Qt build's layout is not imported (see *Not done* below).
|
||||||
|
|
||||||
|
## How it is built
|
||||||
|
|
||||||
|
MoonBit owns the logic and the UI; Java is only what Android itself requires.
|
||||||
|
|
||||||
|
```
|
||||||
|
┌──────────────── pure MoonBit (no platform deps; moon test on js and wasm-gc) ───────────────┐
|
||||||
|
pointer / touch / │ gesture ──► app.input ──► app.update(Model, Msg) ──► Effects (data) │
|
||||||
|
key events ───────►│ │ │
|
||||||
|
│ └──► app.view(Model) ──► vdom tree (data) │
|
||||||
|
└───────────────┬────────────────────────────────────────────────┬───────────────────────────┘
|
||||||
|
│ effects │ tree
|
||||||
|
┌───────────────▼─────────────────────────────────────────────────▼──────────────┐
|
||||||
|
│ web/ (js backend): runs effects against window.Android, patches the DOM, │
|
||||||
|
│ listens for events │
|
||||||
|
└───────────────┬─────────────────────────────────────────────────────────────────┘
|
||||||
|
│ window.Android.* / window.launcher.*
|
||||||
|
┌───────────────▼─────────────────────────────────────────────────────────────────┐
|
||||||
|
│ android/java (Java): HomeActivity + WebView + AppWidgetHostViews, Updater, │
|
||||||
|
│ RecentsService │
|
||||||
|
└─────────────────────────────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
| package | what | tested by |
|
||||||
|
|---|---|---|
|
||||||
|
| `grid/` | the home grid: packing (dense, with pinned cells), cell/box math, pin, resize steps, widget columns | `moon test` |
|
||||||
|
| `gesture/` | pointer state machine: tap, long press (500 ms, 10 px slop), drag, release, swipe | `moon test` |
|
||||||
|
| `updater/` | release/`version.json` parsing, `build-N` tags, the install/skip decision, 6 h throttle | `moon test` |
|
||||||
|
| `jsonx/` | small `Json` accessors | `moon test` |
|
||||||
|
| `vdom/` | a virtual DOM as plain data, generic over the message type; renders to HTML text for snapshots | `moon test` |
|
||||||
|
| `app/` | `Model`, `Msg`, `update` (returns `Effect`s), `view`, JSON persistence and the import of the old localStorage layout, search, sheets/menus, drag and resize, the update flow | 60 headless tests that drive it through pointer input |
|
||||||
|
| `web/` | the js-target program: keyed DOM patcher, event wiring, host bridge (`window.Android`, or stand-ins that show a toast in a desktop browser), icon loading | `tests/e2e.cjs`, `tests/android-sim.cjs` (Playwright) |
|
||||||
|
| `android/` | the Java shell, manifest, resources, signing key, `build.sh` | builds; needs a device to run |
|
||||||
|
|
||||||
|
Why this shape: the launcher's hard parts are layout math, gestures and state, and all of them are pure functions here, so `moon test` covers them on desktop with no Android and no browser. The view is a data tree rather than direct DOM calls, so its output is snapshot-tested as text, and pointer input is aimed at tree nodes by the tests exactly as the page aims it. Rendering in the existing WebView keeps the design that already works for widgets (real `AppWidgetHostView`s laid over transparent slots in the page).
|
||||||
|
|
||||||
|
### What stays Java, and why
|
||||||
|
|
||||||
|
About 1,100 lines in `android/java/dev/ultra/launcher/`; none of it decides anything, it carries out what the page asks:
|
||||||
|
|
||||||
|
- `HomeActivity`: Android requires an `Activity` for the HOME role; it hosts the WebView, serves `apps.json` / `widgets.json` / icons from `LauncherApps`, `PackageManager` and `AppWidgetManager`, and hosts `AppWidgetHostView`s, which are Java `View`s that can only be created and laid out by Java. Its widget touch interception (long press, drag) must decide synchronously whether to take a gesture from the widget, so it stays there and reports through `window.launcher.widget*`.
|
||||||
|
- `Updater`: `HttpURLConnection` (the page cannot `fetch` the Gitea API from the WebView's origin) and `PackageInstaller`.
|
||||||
|
- `RecentsService`: an `AccessibilityService` must be a Java class listed in the manifest; Android instantiates it by name.
|
||||||
|
|
||||||
|
A pure-MoonBit shell (native backend → C, `NativeActivity` + JNI, drawing through the NDK) was considered and rejected: it would still need the same Java classes (`RecentsService`, and something to host `AppWidgetHostView`), the rest would be hundreds of lines of hand-written JNI in C, and nothing of it could be run or tested here (no Android SDK/NDK on the dev machine, no device). The moon toolchain's Android support on mooncakes (e.g. `Nanaloveyuki/ajni`, `wzzc-dev/moui`) is young and was not evaluated further. Rabbita was also considered for the view layer; it would tie the view to its DOM `Html` type and closures, out of reach of plain-data tests, and the gesture/drag handling needs delegated pointer events and its own hit-testing anyway.
|
||||||
|
|
||||||
|
## Build and test
|
||||||
|
|
||||||
|
Needs [MoonBit](https://www.moonbitlang.com/download) (`curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash`), Node 22 for the browser tests, and for the APK a JDK 17+ plus the Android SDK's `build-tools;35.0.0` and `platforms/android-35/android.jar`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
moon test # the pure core: grid, gestures, updater, the app (js backend)
|
||||||
|
moon test --target wasm-gc # the same tests on a second backend
|
||||||
|
scripts/build-web.sh --demo # the page -> dist/web (with the demo apps.json / widgets.json)
|
||||||
|
npm install && npx playwright install chromium
|
||||||
|
npm test # builds the page, then tests/e2e.cjs and tests/android-sim.cjs
|
||||||
|
android/build.sh # the page + Java shell -> build/ultra-launcher.apk, signed
|
||||||
|
```
|
||||||
|
|
||||||
|
`android/build.sh` runs `moon build` (via `scripts/build-web.sh`), then `aapt2 compile/link`, `javac`, `d8`, `zip`, `zipalign` and `apksigner`, with no Gradle. It reads `versionName` from `moon.mod` and takes `VERSION_CODE` from the environment (default: minutes since the epoch, which is above every earlier build's). `ANDROID_SDK_ROOT` points at the SDK (default `~/android-sdk`).
|
||||||
|
|
||||||
|
To try the page in a desktop browser: `scripts/build-web.sh --demo && python3 -m http.server -d dist/web 8000`. It runs against `web/apps.json` and `web/widgets.json`, shows a toast instead of launching, and draws widgets as labelled placeholders. Click the search pill, or hold the empty home.
|
||||||
|
|
||||||
|
## CI and releases
|
||||||
|
|
||||||
|
`.gitea/workflows/launcher.yml`: a `test` job (MoonBit installed like in identicons-web, inside `node:22-bookworm`; `moon test` on js and wasm-gc, then the Playwright tests) and, on push to `main`, an `apk` job running `ci/gitea-apk.sh`, which builds the APK and publishes a Gitea release `build-<versionCode>` holding `ultra-launcher.apk` and `version.json` (a draft first, published once both files are up). The installed app compares that `versionCode` with its own and installs the newer APK. No `actions/setup-node`, no docker, every job has a `timeout-minutes`.
|
||||||
|
|
||||||
|
Releases of the app's version are managed with [sweet](https://github.com/chattocorp/sweet-release): `.sweet.config.yml` (feature → minor, fix/performance → patch, chore/refactor → none) and `.sweet.yml` (`moon.mod`'s `version` line is annotated `// sweet-version`). The Android `versionName` is read from `moon.mod` by the build, so that is the one file that carries the version.
|
||||||
|
|
||||||
|
## `legacy/`
|
||||||
|
|
||||||
|
The previous implementations, moved here with `git mv` so their history follows: the ultra (LPython → wasm) WebView build (`web/`, `android/`), the Qt Quick rewrite (`qt/`), and the experiments (`wasi/`, `android-wasm/`), with their tests and CI script. Their paths are fixed so they still build from `legacy/` (see its README), but they are not maintained; their CI workflows run only by hand. The MoonBit launcher is a port of `legacy/web/app.py` (and the gesture code in its `index.html`), `legacy/qt/qml/Layout.js` and the Java shell.
|
||||||
|
|
||||||
|
## Verified, and not
|
||||||
|
|
||||||
|
Verified here: `moon test` (60 tests, js and wasm-gc), the browser flows in `tests/e2e.cjs` (the legacy test's flows, ported), the page against a stub of the Java bridge (`tests/android-sim.cjs`: icons, widget placement, drawer cover, keyboard, Recents, update check and install request), and that `android/build.sh` produces a signed APK with package `dev.ultra.launcher` that `aapt2 dump badging` and `apksigner verify` accept.
|
||||||
|
|
||||||
|
**Not verified: anything on a device.** There is no Android runtime on the dev machine. The Java shell compiles and packages, and its logic was carried over from the legacy shell that ran on devices, but the combination (the MoonBit page in the WebView, real widget views over it, the installer, the accessibility service) has not been run.
|
||||||
|
|
||||||
|
Not done: importing the Qt build's saved layout (a `QSettings` INI file; the old WebView layout is imported), per-widget configuration beyond what the legacy shell did, and shrinking the page's JS (about 560 KB, mostly MoonBit's JSON and number-parsing runtime).
|
||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
"experiments/launcher/updater",
|
"experiments/launcher/updater",
|
||||||
"experiments/launcher/vdom",
|
"experiments/launcher/vdom",
|
||||||
"experiments/launcher/jsonx",
|
"experiments/launcher/jsonx",
|
||||||
"moonbitlang/core/json",
|
|
||||||
"moonbitlang/core/cmp",
|
"moonbitlang/core/cmp",
|
||||||
"moonbitlang/core/string",
|
"moonbitlang/core/string",
|
||||||
}
|
}
|
||||||
+7
-7
@@ -470,7 +470,7 @@ test "an app dropped in an empty cell stays there; the rest stay packed" {
|
|||||||
assert_eq(cells[0], Some({ col: 0, row: 0, w: 1, h: 1, }))
|
assert_eq(cells[0], Some({ col: 0, row: 0, w: 1, h: 1, }))
|
||||||
assert_eq(cells[2], Some({ col: 3, row: 2, w: 1, h: 1, }))
|
assert_eq(cells[2], Some({ col: 3, row: 2, w: 1, h: 1, }))
|
||||||
// and it survives a save and a load
|
// and it survives a save and a load
|
||||||
let back = load_json(save_json(s.m.home), Ref::new(1)).unwrap()
|
let back = load_json(save_json(s.m.home), Ref(1)).unwrap()
|
||||||
assert_eq((back[2].x, back[2].y), (3, 2))
|
assert_eq((back[2].x, back[2].y), (3, 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,7 +737,7 @@ test "the old WebView build's home screen is brought over once" {
|
|||||||
#|"ultra.home.kind.1":"1","ultra.home.str.1":"Clock","ultra.home.wid.1":"12","ultra.home.h.1":"136",
|
#|"ultra.home.kind.1":"1","ultra.home.str.1":"Clock","ultra.home.wid.1":"12","ultra.home.h.1":"136",
|
||||||
#|"ultra.home.w.1":"3","ultra.home.cx.1":"1","ultra.home.cy.1":"2",
|
#|"ultra.home.w.1":"3","ultra.home.cx.1":"1","ultra.home.cy.1":"2",
|
||||||
#|"ultra.home.kind.2":"0"}
|
#|"ultra.home.kind.2":"0"}
|
||||||
let next = Ref::new(1)
|
let next = Ref(1)
|
||||||
let slots = legacy_import(legacy, next)
|
let slots = legacy_import(legacy, next)
|
||||||
assert_eq(slots.length(), 2)
|
assert_eq(slots.length(), 2)
|
||||||
assert_eq((slots[0].kind, slots[0].str), (App, "c.chrome/.Main"))
|
assert_eq((slots[0].kind, slots[0].str), (App, "c.chrome/.Main"))
|
||||||
@@ -745,8 +745,8 @@ test "the old WebView build's home screen is brought over once" {
|
|||||||
(slots[1].wid, slots[1].w, slots[1].rows, slots[1].x, slots[1].y),
|
(slots[1].wid, slots[1].w, slots[1].rows, slots[1].x, slots[1].y),
|
||||||
(12, 3, 2, 1, 2),
|
(12, 3, 2, 1, 2),
|
||||||
)
|
)
|
||||||
assert_eq(legacy_import("{}", Ref::new(1)).length(), 0)
|
assert_eq(legacy_import("{}", Ref(1)).length(), 0)
|
||||||
assert_eq(legacy_import("garbage", Ref::new(1)).length(), 0)
|
assert_eq(legacy_import("garbage", Ref(1)).length(), 0)
|
||||||
let s = Sim::new()
|
let s = Sim::new()
|
||||||
s.run(update(s.m, Restore(saved=None, legacy=Some(legacy))))
|
s.run(update(s.m, Restore(saved=None, legacy=Some(legacy))))
|
||||||
assert_eq(s.m.home.length(), 2)
|
assert_eq(s.m.home.length(), 2)
|
||||||
@@ -772,11 +772,11 @@ fn slot_app(c : String) -> @grid.Slot {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
test "load_json rejects what is not a layout and drops nameless slots" {
|
test "load_json rejects what is not a layout and drops nameless slots" {
|
||||||
assert_true(load_json("nope", Ref::new(1)) is None)
|
assert_true(load_json("nope", Ref(1)) is None)
|
||||||
assert_true(load_json("{}", Ref::new(1)) is None)
|
assert_true(load_json("{}", Ref(1)) is None)
|
||||||
let r = load_json(
|
let r = load_json(
|
||||||
"{\"slots\":[{\"kind\":\"app\"},{\"kind\":\"app\",\"str\":\"a\"}]}",
|
"{\"slots\":[{\"kind\":\"app\"},{\"kind\":\"app\",\"str\":\"a\"}]}",
|
||||||
Ref::new(1),
|
Ref(1),
|
||||||
).unwrap()
|
).unwrap()
|
||||||
assert_eq(r.length(), 1)
|
assert_eq(r.length(), 1)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
///|
|
///|
|
||||||
fn trimmed(s : String) -> String {
|
fn trimmed(s : String) -> String {
|
||||||
s.trim().to_string()
|
s.trim().to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -438,7 +438,7 @@ fn Model::choose_widget(self : Model, i : Int32, fx : Array[Effect]) -> Unit {
|
|||||||
fn step(m : Model, msg : Msg, fx : Array[Effect]) -> Unit {
|
fn step(m : Model, msg : Msg, fx : Array[Effect]) -> Unit {
|
||||||
match msg {
|
match msg {
|
||||||
Restore(saved~, legacy~) => {
|
Restore(saved~, legacy~) => {
|
||||||
let next = Ref::new(m.next_key)
|
let next = Ref(m.next_key)
|
||||||
let mut slots = None
|
let mut slots = None
|
||||||
if saved is Some(text) {
|
if saved is Some(text) {
|
||||||
slots = load_json(text, next)
|
slots = load_json(text, next)
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 132 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 148 KiB |
+3
-1
@@ -1,10 +1,12 @@
|
|||||||
|
> **This is the previous implementation.** The launcher is now written in MoonBit at the repository root (see the top-level README). This folder keeps the ultra WebView build (`web/`, `android/`), the Qt rewrite (`qt/`) and the experiments (`wasi/`, `android-wasm/`) with paths fixed so they still build from here; nothing in it is maintained beyond that. Its CI runs only by hand (`.gitea/workflows/legacy.yml`, `.github/workflows/legacy.yml`).
|
||||||
|
|
||||||
# ultra launcher
|
# ultra launcher
|
||||||
|
|
||||||
An Android home screen written as an [ultra](https://github.com/nandi-conda/ultra) app (LPython compiled to WebAssembly, Elm-style). The home starts blank (add a clock widget if you want one): long-press it to add apps (the drawer opens in a pick mode) or widgets, and long-press anything on it to drag it somewhere else; let go without moving to get its menu, or, for a widget, handles on its edges that resize it to the grid. Swipe down for the drawer with every app and a search (Enter opens the first match); long-press an app there for its menu (add to home, app info, uninstall; system apps have no uninstall), and swipe up to close it. The panel at the top has a **Windows** button that opens Recents. The layout is saved in localStorage.
|
An Android home screen written as an [ultra](https://github.com/nandi-conda/ultra) app (LPython compiled to WebAssembly, Elm-style). The home starts blank (add a clock widget if you want one): long-press it to add apps (the drawer opens in a pick mode) or widgets, and long-press anything on it to drag it somewhere else; let go without moving to get its menu, or, for a widget, handles on its edges that resize it to the grid. Swipe down for the drawer with every app and a search (Enter opens the first match); long-press an app there for its menu (add to home, app info, uninstall; system apps have no uninstall), and swipe up to close it. The panel at the top has a **Windows** button that opens Recents. The layout is saved in localStorage.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Get the APK from the [latest release](https://git.site.latha.org/experiments/launcher/releases/latest) on the Gitea forge, which CI rebuilds on every push to `main`. Open it once, press Home, and pick **ultra Home** as the default. Builds are signed with the committed `android/app/debug.keystore`, so each one installs over the last.
|
Releases now come from the MoonBit build at the repository root; see the top-level README. Open it once, press Home, and pick **ultra Home** as the default. Builds are signed with the committed `android/app/debug.keystore`, so each one installs over the last.
|
||||||
|
|
||||||
The **Windows** button uses an accessibility service (`RecentsService`, which only performs the Recents action). Enable it once under Settings → Accessibility; on Android 13+ a sideloaded APK may first need App info → ⋮ → Allow restricted settings.
|
The **Windows** button uses an accessibility service (`RecentsService`, which only performs the Recents action). Enable it once under Settings → Accessibility; on Android 13+ a sideloaded APK may first need App info → ⋮ → Allow restricted settings.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
# Tests the Qt launcher (qt/), builds its APK and publishes it as a Gitea release:
|
# Tests the Qt launcher (qt/), builds its APK and publishes it as a Gitea release:
|
||||||
# build-<versionCode>, holding ultra-launcher.apk and version.json, made a draft first
|
# build-<versionCode>, holding ultra-launcher.apk and version.json, made a draft first
|
||||||
# and published once both files are up, so the latest release never lacks them.
|
# and published once both files are up, so the latest release never lacks them.
|
||||||
# Runs in .gitea/workflows/launcher.yml's "apk" job (JDK 17 container, as root).
|
# Runs in .gitea/workflows/legacy.yml (JDK 17 container, as root), from legacy/; publishes only
|
||||||
|
# when LEGACY_PUBLISH=true, so it does not compete with the MoonBit build's releases.
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
@@ -56,6 +57,11 @@ test -n "$apk" || { find build-android -name "*.apk"; exit 1; }
|
|||||||
cp "$apk" ultra-launcher.apk
|
cp "$apk" ultra-launcher.apk
|
||||||
printf '{"versionCode": %s, "commit": "%s"}\n' "$VERSION_CODE" "$COMMIT" > version.json
|
printf '{"versionCode": %s, "commit": "%s"}\n' "$VERSION_CODE" "$COMMIT" > version.json
|
||||||
|
|
||||||
|
if [ "${LEGACY_PUBLISH:-false}" != "true" ]; then
|
||||||
|
echo "built legacy/ultra-launcher.apk; not publishing (LEGACY_PUBLISH != true)"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
echo "== release build-$VERSION_CODE"
|
echo "== release build-$VERSION_CODE"
|
||||||
server="${GITHUB_SERVER_URL:-https://git.site.latha.org}"
|
server="${GITHUB_SERVER_URL:-https://git.site.latha.org}"
|
||||||
repo="${GITHUB_REPOSITORY:-experiments/launcher}"
|
repo="${GITHUB_REPOSITORY:-experiments/launcher}"
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "launcher-tests",
|
||||||
|
"private": true,
|
||||||
|
"description": "Browser tests of the launcher page (Playwright); the launcher itself is MoonBit, see README.md",
|
||||||
|
"scripts": {
|
||||||
|
"build:web": "scripts/build-web.sh --demo",
|
||||||
|
"test": "scripts/build-web.sh --demo && node tests/e2e.cjs && node tests/android-sim.cjs"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"playwright": "1.65.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
let model : @app.Model = @app.Model::new()
|
let model : @app.Model = @app.Model::new()
|
||||||
|
|
||||||
///|
|
///|
|
||||||
let state : Ref[PageState] = Ref::new(PageState::new())
|
let state : Ref[PageState] = Ref(PageState::new())
|
||||||
|
|
||||||
///|
|
///|
|
||||||
priv struct PageState {
|
priv struct PageState {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import {
|
|||||||
"experiments/launcher/app",
|
"experiments/launcher/app",
|
||||||
"experiments/launcher/vdom",
|
"experiments/launcher/vdom",
|
||||||
"experiments/launcher/gesture",
|
"experiments/launcher/gesture",
|
||||||
"moonbitlang/core/json",
|
|
||||||
"moonbitlang/core/string",
|
"moonbitlang/core/string",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-6
@@ -14,7 +14,6 @@ priv struct RNode {
|
|||||||
mut n : Int32
|
mut n : Int32
|
||||||
mut classes : String
|
mut classes : String
|
||||||
mut attrs : Map[String, String]
|
mut attrs : Map[String, String]
|
||||||
mut props : Map[String, String]
|
|
||||||
mut style : String
|
mut style : String
|
||||||
mut children : Array[RNode]
|
mut children : Array[RNode]
|
||||||
}
|
}
|
||||||
@@ -32,7 +31,6 @@ fn new_rnode(n : @vdom.Node[@app.Msg]) -> RNode {
|
|||||||
n: -1,
|
n: -1,
|
||||||
classes: "",
|
classes: "",
|
||||||
attrs: {},
|
attrs: {},
|
||||||
props: {},
|
|
||||||
style: "",
|
style: "",
|
||||||
children: [],
|
children: [],
|
||||||
}
|
}
|
||||||
@@ -46,7 +44,6 @@ fn new_rnode(n : @vdom.Node[@app.Msg]) -> RNode {
|
|||||||
n: -1,
|
n: -1,
|
||||||
classes: "",
|
classes: "",
|
||||||
attrs: {},
|
attrs: {},
|
||||||
props: {},
|
|
||||||
style: "",
|
style: "",
|
||||||
children: [],
|
children: [],
|
||||||
}
|
}
|
||||||
@@ -87,7 +84,7 @@ fn update_rnode(
|
|||||||
r.classes = classes
|
r.classes = classes
|
||||||
dom_class(r.dom, classes)
|
dom_class(r.dom, classes)
|
||||||
}
|
}
|
||||||
let attrs : Map[String, String] = {}
|
let attrs : Map[String, String] = Map([])
|
||||||
for kv in e.attrs {
|
for kv in e.attrs {
|
||||||
attrs[kv.0] = kv.1
|
attrs[kv.0] = kv.1
|
||||||
}
|
}
|
||||||
@@ -134,7 +131,7 @@ fn patch_children(
|
|||||||
counter : Ref[Int32],
|
counter : Ref[Int32],
|
||||||
) -> Array[RNode] {
|
) -> Array[RNode] {
|
||||||
let used : Array[Bool] = Array::make(old.length(), false)
|
let used : Array[Bool] = Array::make(old.length(), false)
|
||||||
let by_key : Map[Int32, Int32] = {}
|
let by_key : Map[Int32, Int32] = Map([])
|
||||||
for i in 0..<old.length() {
|
for i in 0..<old.length() {
|
||||||
if old[i].key != 0 {
|
if old[i].key != 0 {
|
||||||
by_key[old[i].key] = i
|
by_key[old[i].key] = i
|
||||||
@@ -188,5 +185,5 @@ fn patch_root(
|
|||||||
old : Array[RNode],
|
old : Array[RNode],
|
||||||
tree : Array[@vdom.Node[@app.Msg]],
|
tree : Array[@vdom.Node[@app.Msg]],
|
||||||
) -> Array[RNode] {
|
) -> Array[RNode] {
|
||||||
patch_children(root, old, tree, Ref::new(0))
|
patch_children(root, old, tree, Ref(0))
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user