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

+82
View File
@@ -0,0 +1,82 @@
package ui
import (
"math"
"github.com/egoist/mygo/internal/scene"
)
// StrokePolyline draws a line through points in DIPs, width DIPs wide,
// with round joins and caps, as StrokePath draws a path of straight lines:
// a NaN or infinite point breaks the line there, and a point alone draws
// nothing. It suits lines that change every frame, as live charts: on a
// GPU, an opaque line draws each segment as a rounded rectangle instead of
// rasterizing a mask of the whole line, so that its edges can look a
// little bolder where segments overlap. Translucent lines draw as
// StrokePath's, which keeps overlaps from showing darker, unless they are
// one segment, which has nothing to overlap: many lines of one, as a
// hatching, each stroked alone, cost no masks.
func (p *Painter) StrokePolyline(points [][2]float32, width float32, c Color) {
finite := func(v float32) bool { return !math.IsNaN(float64(v)) && !math.IsInf(float64(v), 0) }
if width <= 0 || !finite(width) || c.A == 0 {
return
}
f := &p.rt.paths.flat
f.reset()
from := 0
flush := func() {
if len(f.pts)-from > 1 {
f.starts = append(f.starts, from)
f.closed = append(f.closed, false)
} else {
f.pts = f.pts[:from]
}
from = len(f.pts)
}
for _, pt := range points {
pt = [2]float32{pt[0] * p.scale, pt[1] * p.scale}
if !finite(pt[0]) || !finite(pt[1]) {
flush()
continue
}
f.pts = append(f.pts, pt)
}
flush()
w := width * p.scale
if !finite(w) {
return
}
h, ok := p.rt.host.(*windowHost)
if !ok || !h.onGPU || h.degraded || (c.A != 255 || p.opacity != 1) && len(f.pts) != 2 {
p.drawPath(f, w, c, nil)
return
}
hw := w / 2
wide := p.wide(c, Color{}, Color{})
op := scene.Op{Kind: scene.OpFill, Rect: scene.Rect{X: -hw, Y: -hw, H: w}, Radii: scene.Uniform(hw), Color: c.scene(), Wide: wide, Opacity: p.opacity}
// Painter.add converts this transform for each op; all segments here
// share it, as they share the style above.
transform := p.transform.Pixels(p.scale)
for i := range f.polys() {
pts := f.poly(i)
for j := 1; j < len(pts); j++ {
a, b := pts[j-1], pts[j]
dx, dy := b[0]-a[0], b[1]-a[1]
length := float32(math.Hypot(float64(dx), float64(dy)))
if !finite(length) {
continue
}
m := scene.Translation(a[0], a[1])
if length > 0 {
dx, dy = dx/length, dy/length
m = scene.Matrix(dx, dy, -dy, dx, a[0], a[1])
}
op.Rect.W = length + w
op.Transform = m
if transform.Set {
op.Transform = transform.Mul(m)
}
p.s.Ops = append(p.s.Ops, op)
}
}
}