- Event loop: call w.Event() and FrameEvent.Frame() on the same goroutine; no channel bridge (the bridge broke frame rendering). - clip: use clip.UniformRRect(...).Push(gtx.Ops) / Pop() for real clipping in layoutRRect (old .Add(ops) painted unclipped). - Window clear color is white in v0.10.2. - Fonts: always provide gofont; on Android use WithCollection(gofont.Collection()). - Button labels: explicitly set Color (zero-value NRGBA has A=0, i.e. transparent, so labels were invisible). - Filter: detect changes by comparing the editor text, since material.Editor.Layout consumes the editor's input events internally and a later FilterEd.Update(gtx) never sees them. - idPage: persist the manually entered ID with store.SetID (on Android nativeIdentities is unimplemented, so there are no id buttons to click). - Use U+2026 (gofont) instead of U+22EE (not in gofont) for the menu button. - Split getConfDir/noidLabelText out into impl_linux.go for the Linux build.
64 lines
1.2 KiB
Go
64 lines
1.2 KiB
Go
//go:build darwin
|
|
|
|
package main
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
"os/user"
|
|
"path"
|
|
|
|
"gioui.org/font/opentype"
|
|
)
|
|
|
|
var (
|
|
noidLabelText = "No GPG ids available. Please create a private key or enter a key ID above"
|
|
)
|
|
|
|
func setFont() error {
|
|
f, err := os.Open("/System/Library/Fonts/AppleSDGothicNeo.ttc")
|
|
if err != nil {
|
|
log(Info, "Cannot open system font collection")
|
|
return err
|
|
|
|
}
|
|
defer f.Close()
|
|
data, err := io.ReadAll(f)
|
|
if err != nil {
|
|
log(Info, "Cannot read system font collection")
|
|
return err
|
|
}
|
|
fnts, err := opentype.ParseCollection(data)
|
|
if err != nil {
|
|
log(Info, "Cannot parse font collection")
|
|
return err
|
|
}
|
|
collection = append(collection, fnts...)
|
|
return nil
|
|
}
|
|
|
|
func init() {
|
|
fontSize = 16
|
|
setFont()
|
|
}
|
|
|
|
func getConfDir() (string, error) {
|
|
usr, err := user.Current()
|
|
if err != nil {
|
|
log(Error, "Cannot get current user: ", err)
|
|
return "", err
|
|
}
|
|
ret := path.Join(usr.HomeDir, ".config/passgo")
|
|
if _, err := os.Stat(ret); os.IsNotExist(err) {
|
|
err = os.MkdirAll(ret, 0700)
|
|
if err != nil {
|
|
log(Info, "Cannot create configuration directory ", confDir)
|
|
return "", err
|
|
} else {
|
|
log(Info, "Configuration directory created")
|
|
return ret, nil
|
|
}
|
|
}
|
|
return ret, nil
|
|
}
|