feat: port the client to MyGo native UI (0.3.0)

Switch from Asuka to MyGo, keeping the API client and the feature set:

- servers: saved servers, passwordless and password login, proxy,
  self-signed certificates, per-server device tokens (Keystore), connect
  form, instance list sheet with switch/disconnect
- sessions: virtualized list, search, new session, rename/archive/delete,
  running indicator, event stream keeps it live
- chat: pushed window with system back bar, streaming Markdown via
  ui/markdown, reasoning and tool rows with image previews, footer menu
  (read aloud via a Kotlin TTS plugin, copy, fork), user message menu
  (copy, revert, fork), context usage ring and detail sheet, attachments
  (photos/files via the document picker), permissions
- release builds allow plain http:// LAN servers (Go's net/http dials
  directly, no cleartext manifest needed)
- a local fork of MyGo (third_party/mygo) lowers the Android host's
  minSdk to 24 (Android 7.0); Go 1.27.4 via mise

Version 0.3.0.
This commit is contained in:
OpenChamber committed 2026-11-18 13:22:59 +08:00
1 parent 2fb4a8ea79
commit 6c0ee61750
2538 files changed
+675779 -4792

No files matched your search

+103
View File
@@ -0,0 +1,103 @@
//go:build darwin && !ios
package e2e
import (
"fmt"
"strings"
"sync/atomic"
"testing"
"github.com/egoist/mygo"
"github.com/egoist/mygo/internal/darwin"
"github.com/egoist/mygo/ui"
)
// TestAccessGrid reads, as VoiceOver does, a spreadsheet of 10,000 rows
// built only where it shows: a table whose size is in AXARIARowCount and
// AXARIAColumnCount, and AXRowCount, whose rows say which of all they are
// (AXIndex) and, with its cells, their places in AXARIARowIndex and
// AXARIAColumnIndex, as WebKit's grids do; a cell without a column of its
// own names no AXARIAColumnIndex, and one covering two columns says so in
// the length of its AXColumnIndexRange (aria-colspan), the cell after it
// in the column after those.
func TestAccessGrid(t *testing.T) {
var frames atomic.Int32
cell := func(c *ui.Context, name string) ui.Element {
return ui.Box(c).Role(ui.RoleCell).Label(name).Padding(2).Children(func() { ui.Text(c, name) })
}
view := func(c *ui.Context) {
frames.Add(1)
ui.Column(c).Fill().Padding(20).Gap(10).Children(func() {
ui.Column(c).Role(ui.RoleGrid).Label("Sheet").RowCount(10001).ColumnCount(3).Multiselectable(true).Children(func() {
for r := 4120; r < 4122; r++ {
ui.Row(c).Role(ui.RoleRow).RowIndex(r + 1).Selected(r == 4121).Children(func() {
cell(c, fmt.Sprintf("A%d", r))
cell(c, fmt.Sprintf("C%d", r)).ColumnIndex(3)
})
}
ui.Row(c).Role(ui.RoleRow).RowIndex(10001).Children(func() {
cell(c, "Total").ColumnSpan(2)
cell(c, "Sum")
})
})
ui.Column(c).Role(ui.RoleTreeGrid).Label("Outline").Children(func() {
ui.Row(c).Role(ui.RoleRow).Level(1).Children(func() { cell(c, "src") })
})
})
}
w := newWindow(t, mygo.WindowOptions{Title: "Grid", Width: 400, Height: 300, Content: ui.View(view)})
eventually(t, "a frame", func() bool { return frames.Load() > 0 })
// find reads the element named label through the newer API, which
// VoiceOver reads its role, rows and places through.
find := func(label string) (n darwin.TestAccessNode, ok bool) {
mygo.RunOnMain(func() {
for _, node := range darwin.TestAccessibility(w.NativeHandle()) {
if node.Label == label && !ok {
n, ok = node, true
}
}
})
return n, ok
}
eventually(t, "the grid", func() bool {
n, ok := find("Sheet")
return ok && n.Role == "AXTable" && n.RowCount == 10001
})
if n, _ := find("Outline"); n.Role != "AXTable" {
t.Errorf("the tree grid: %+v", n)
}
if n, _ := find("A4121 C4121"); n.Role != "AXRow" || n.Index != 4121 {
t.Errorf("row 4,122: %+v", n)
}
// The older API, which says the role as the newer one does, and the
// counts and places as WebKit's grids do.
for _, c := range []struct{ label, attr, want string }{
{"Sheet", "AXRole", "AXTable"},
{"Sheet", "AXARIARowCount", "10001"},
{"Sheet", "AXARIAColumnCount", "3"},
{"A4121 C4121", "AXARIARowIndex", "4122"},
{"C4121", "AXARIAColumnIndex", "3"},
{"C4121", "AXARIARowIndex", "4122"},
{"A4121", "AXARIARowIndex", "4122"},
} {
eventually(t, c.label+"'s "+c.attr, func() bool {
v, _, named, ok := axAttribute(w, c.label, c.attr)
return ok && (named || c.attr == "AXRole") && v == c.want
})
}
if v, _, named, ok := axAttribute(w, "A4121", "AXARIAColumnIndex"); !ok || named {
t.Errorf("A4121's AXARIAColumnIndex %q, named %v, found %v", v, named, ok)
}
// The ranges, which read as descriptions holding want.
for _, c := range []struct{ label, attr, want string }{
{"Total", "AXColumnIndexRange", "{0, 2}"},
{"Total", "AXRowIndexRange", "{10000, 1}"},
{"Sum", "AXColumnIndexRange", "{2, 1}"},
} {
eventually(t, c.label+"'s "+c.attr, func() bool {
v, _, named, ok := axAttribute(w, c.label, c.attr)
return ok && named && strings.Contains(v, c.want)
})
}
}