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,85 @@
|
||||
//go:build windows && (amd64 || arm64)
|
||||
|
||||
package windows
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// TestEnvOptionsArguments checks that the options object gives the
|
||||
// environment the arguments it holds, beside its language.
|
||||
func TestEnvOptionsArguments(t *testing.T) {
|
||||
// ICoreWebView2EnvironmentOptions, from envOptionsVtbl.
|
||||
const (
|
||||
getAdditionalBrowserArguments = 3
|
||||
getLanguage = 5
|
||||
)
|
||||
for _, tt := range []struct {
|
||||
name, language, args string
|
||||
}{
|
||||
{"arguments only", "", "--remote-debugging-port=0"},
|
||||
{"language only", "fr", ""},
|
||||
} {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
options := newEnvOptions(tt.language, tt.args)
|
||||
defer release(options)
|
||||
for _, getter := range []struct {
|
||||
name string
|
||||
index int
|
||||
want string
|
||||
}{
|
||||
{"AdditionalBrowserArguments", getAdditionalBrowserArguments, tt.args},
|
||||
{"Language", getLanguage, tt.language},
|
||||
} {
|
||||
var p uintptr
|
||||
if hr := comCall(options, getter.index, uintptr(unsafe.Pointer(&p))); failed(hr) {
|
||||
t.Fatal(hresultError("get_"+getter.name, hr))
|
||||
}
|
||||
if getter.want == "" && p != 0 {
|
||||
t.Errorf("get_%s returned a string for no value", getter.name)
|
||||
}
|
||||
if got := takeWstr(p); got != getter.want {
|
||||
t.Errorf("get_%s = %q, want %q", getter.name, got, getter.want)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestChromiumLanguage checks the tags WebView2's browser is given for
|
||||
// Chinese, which Chromium names by region.
|
||||
func TestChromiumLanguage(t *testing.T) {
|
||||
for tag, want := range map[string]string{
|
||||
"zh-Hans": "zh-CN",
|
||||
"zh-Hant": "zh-TW",
|
||||
"zh-Hant-HK": "zh-HK",
|
||||
"zh-TW": "zh-TW",
|
||||
"zh-Hans-SG": "zh-CN",
|
||||
"zh": "zh-CN",
|
||||
"en-GB": "en-GB",
|
||||
"sr-Latn": "sr-Latn",
|
||||
} {
|
||||
if got := chromiumLanguage(tag); got != want {
|
||||
t.Errorf("chromiumLanguage(%q) = %q, want %q", tag, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestBrowserArguments checks the arguments WebView2's browser is given for
|
||||
// the options of the first page: none for neither, and both sets for both.
|
||||
func TestBrowserArguments(t *testing.T) {
|
||||
for _, tt := range []struct {
|
||||
unthrottled, autoplay bool
|
||||
want string
|
||||
}{
|
||||
{false, false, ""},
|
||||
{true, false, unthrottledArguments},
|
||||
{false, true, "--autoplay-policy=no-user-gesture-required"},
|
||||
{true, true, unthrottledArguments + " --autoplay-policy=no-user-gesture-required"},
|
||||
} {
|
||||
if got := browserArguments(tt.unthrottled, tt.autoplay); got != tt.want {
|
||||
t.Errorf("browserArguments(%v, %v) = %q, want %q", tt.unthrottled, tt.autoplay, got, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user