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.
63 lines
1.7 KiB
Go
63 lines
1.7 KiB
Go
// Package mobile holds what phones' interfaces are made of and desktops'
|
|
// aren't: sheets that come up from the bottom edge, pages and rows that a
|
|
// finger swipes, wheels that it spins, bars at the screen's edges, and the
|
|
// press of Material's ink, each looking as on its system.
|
|
//
|
|
// It is built on package ui's public API, as any app could be, and apps that
|
|
// don't import it don't pay for it. It works with a mouse too, and on
|
|
// desktops, with the look of the system that Current chooses.
|
|
package mobile
|
|
|
|
import (
|
|
"runtime"
|
|
|
|
"github.com/egoist/mygo/ui"
|
|
)
|
|
|
|
// Look is the design a widget follows.
|
|
type Look uint8
|
|
|
|
const (
|
|
// Automatic chooses by the system the app runs on.
|
|
Automatic Look = iota
|
|
// Cupertino follows Apple's Human Interface Guidelines.
|
|
Cupertino
|
|
// Material follows Google's Material Design.
|
|
Material
|
|
)
|
|
|
|
var look = Automatic
|
|
|
|
// SetLook makes the widgets follow a design whatever the system, as an app
|
|
// with one design everywhere, or to see the other system's on this one.
|
|
func SetLook(l Look) { look = l }
|
|
|
|
// Current returns the look widgets follow: Cupertino on Apple's systems
|
|
// unless SetLook said otherwise, Material elsewhere.
|
|
func Current() Look {
|
|
if look != Automatic {
|
|
return look
|
|
}
|
|
switch runtime.GOOS {
|
|
case "ios", "darwin":
|
|
return Cupertino
|
|
}
|
|
return Material
|
|
}
|
|
|
|
// overlayRadius is the corner of what comes up from the bottom of the screen.
|
|
func overlayRadius() float32 {
|
|
if Current() == Cupertino {
|
|
return 14
|
|
}
|
|
return 28
|
|
}
|
|
|
|
// scrim is the color that dims what is under a sheet or a drawer.
|
|
func scrim(c *ui.Context, fraction float32) ui.Color {
|
|
return ui.RGBA(0, 0, 0, 0.4*max(0, min(fraction, 1)))
|
|
}
|
|
|
|
// separator is the color of the lines between rows.
|
|
func separator(t *ui.Theme) ui.Color { return t.Border }
|