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
@@ -0,0 +1,82 @@
|
||||
//go:build !js
|
||||
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"github.com/egoist/mygo"
|
||||
"github.com/egoist/mygo/ui"
|
||||
)
|
||||
|
||||
// TestWindowHiddenBuildsAsItHides checks the promise of
|
||||
// Context.WindowHidden: a view that asks builds once as its window hides,
|
||||
// out of sight, and again as it shows. A frame waiting for the display
|
||||
// would never come: a minimized or hidden window's display link stops on
|
||||
// macOS, and Windows sends a minimized window no WM_PAINT. Linux and
|
||||
// Windows tell only that a window is minimized, and Xvfb has no window
|
||||
// manager to minimize one.
|
||||
func TestWindowHiddenBuildsAsItHides(t *testing.T) {
|
||||
type state struct {
|
||||
name string
|
||||
// do hides the window, and returns what shows it again.
|
||||
do func(w *mygo.Window) (undo func())
|
||||
}
|
||||
var states []state
|
||||
if runtime.GOOS == "darwin" {
|
||||
states = append(states, state{"hidden", func(w *mygo.Window) func() {
|
||||
w.Hide()
|
||||
return w.Show
|
||||
}})
|
||||
}
|
||||
if runtime.GOOS != "linux" {
|
||||
states = append(states, state{"minimized", func(w *mygo.Window) func() {
|
||||
w.Minimize()
|
||||
return w.Restore
|
||||
}})
|
||||
}
|
||||
if len(states) == 0 {
|
||||
t.Skip("no window manager to minimize windows")
|
||||
}
|
||||
for _, s := range states {
|
||||
t.Run(s.name, func(t *testing.T) {
|
||||
var builtHidden, builtShown, lastHidden atomic.Bool
|
||||
var builds atomic.Int64
|
||||
w := newWindow(t, mygo.WindowOptions{Title: "WindowHidden", Width: 320, Height: 240, Content: ui.View(func(c *ui.Context) {
|
||||
hidden := c.WindowHidden()
|
||||
lastHidden.Store(hidden)
|
||||
builds.Add(1)
|
||||
if hidden {
|
||||
builtHidden.Store(true)
|
||||
} else {
|
||||
builtShown.Store(true)
|
||||
}
|
||||
ui.Text(c, "WindowHidden")
|
||||
})})
|
||||
// In front, the window shows: one behind a full screen app's
|
||||
// would be out of sight from the start. A window may also be
|
||||
// out of sight a moment before it first shows, so the view
|
||||
// builds anew until it sees it shown.
|
||||
w.Focus()
|
||||
eventually(t, "the window focused", w.IsFocused)
|
||||
asked := int64(-1)
|
||||
eventually(t, "a build that sees the window shown", func() bool {
|
||||
n := builds.Load()
|
||||
if asked >= 0 && n > asked && !lastHidden.Load() {
|
||||
return true
|
||||
}
|
||||
asked = n
|
||||
w.Update(func() {})
|
||||
return false
|
||||
})
|
||||
builtHidden.Store(false)
|
||||
undo := s.do(w)
|
||||
eventually(t, "a build as the window hides", builtHidden.Load)
|
||||
builtShown.Store(false)
|
||||
undo()
|
||||
eventually(t, "a build as the window shows again", builtShown.Load)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user