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:
1 parent
2fb4a8ea79
commit
6c0ee61750
2538 files changed
+675779
-4792
No files matched your search
Vendored
+71
@@ -0,0 +1,71 @@
|
||||
package mobile
|
||||
|
||||
import "github.com/egoist/mygo/ui"
|
||||
|
||||
// RowOptions are what a ListRow shows.
|
||||
type RowOptions struct {
|
||||
Title, Subtitle string
|
||||
// Leading and Trailing build what goes at its ends.
|
||||
Leading, Trailing func()
|
||||
// Disclosure shows that it goes somewhere: a chevron on Cupertino.
|
||||
Disclosure bool
|
||||
}
|
||||
|
||||
// ListRow shows a row of a list, of a height a finger can tap: UITableViewCell's
|
||||
// on Cupertino and Material's list item on Material, with its look of being
|
||||
// pressed. Clicked reports a tap.
|
||||
func ListRow(c *ui.Context, o RowOptions) ui.Element {
|
||||
t := c.Theme()
|
||||
minH := float32(44)
|
||||
if Current() == Material {
|
||||
minH = 56
|
||||
}
|
||||
label := o.Title
|
||||
if o.Subtitle != "" {
|
||||
label += ", " + o.Subtitle // screen readers read the row as one
|
||||
}
|
||||
row := ui.Row(c).FillWidth().MinHeight(minH).AlignItems(ui.Center).Padding(10, 16).Gap(12).Role(ui.RoleButton).Label(label)
|
||||
press(row, t)
|
||||
row.Children(func() {
|
||||
if o.Leading != nil {
|
||||
o.Leading()
|
||||
}
|
||||
ui.Column(c).Grow(1).Basis(0).Gap(2).Children(func() {
|
||||
ui.Text(c, o.Title)
|
||||
if o.Subtitle != "" {
|
||||
ui.Text(c, o.Subtitle).FontSize(14).TextColor(t.TextMuted)
|
||||
}
|
||||
})
|
||||
if o.Trailing != nil {
|
||||
o.Trailing()
|
||||
}
|
||||
if o.Disclosure && Current() == Cupertino {
|
||||
ui.Text(c, "›").FontSize(20).TextColor(t.TextMuted)
|
||||
}
|
||||
})
|
||||
return row
|
||||
}
|
||||
|
||||
// Section shows rows together under a header: UITableView's inset grouped style
|
||||
// on Cupertino, with a line between them; on Material, a heading over the list.
|
||||
func Section(c *ui.Context, header string, rows func()) ui.Element {
|
||||
t := c.Theme()
|
||||
col := ui.Column(c).FillWidth().Gap(6)
|
||||
if Current() == Cupertino {
|
||||
col.PaddingX(16)
|
||||
}
|
||||
col.Children(func() {
|
||||
if header != "" {
|
||||
h := ui.Text(c, header).FontSize(13).TextColor(t.TextMuted)
|
||||
if Current() == Material {
|
||||
h.PaddingX(16)
|
||||
}
|
||||
}
|
||||
body := ui.Column(c).FillWidth().Dividers(0.5, t.Border)
|
||||
if Current() == Cupertino {
|
||||
body.Background(t.Surface).Radius(10).Clip()
|
||||
}
|
||||
body.Children(rows)
|
||||
})
|
||||
return col
|
||||
}
|
||||
Reference in new issue
Block a user