Extract app UI platform glue
This commit is contained in:
@@ -36,6 +36,7 @@ import (
|
||||
"git.julianfamily.org/keepassgo/internal/apiaudit"
|
||||
"git.julianfamily.org/keepassgo/internal/apitokens"
|
||||
"git.julianfamily.org/keepassgo/internal/appstate"
|
||||
"git.julianfamily.org/keepassgo/internal/appui/platform"
|
||||
keepassassets "git.julianfamily.org/keepassgo/internal/assets"
|
||||
"git.julianfamily.org/keepassgo/internal/autofillcache"
|
||||
"git.julianfamily.org/keepassgo/internal/clipboard"
|
||||
@@ -466,7 +467,7 @@ type ui struct {
|
||||
settingsIcon *widget.Icon
|
||||
menuIcon *widget.Icon
|
||||
clipboardWriter clipboard.Writer
|
||||
vaultSharer vaultSharer
|
||||
vaultSharer platform.VaultSharer
|
||||
loadingMessage string
|
||||
loadingActionLabel string
|
||||
lifecycleMode string
|
||||
@@ -546,10 +547,6 @@ type backgroundActionResult struct {
|
||||
id int
|
||||
}
|
||||
|
||||
type vaultSharer interface {
|
||||
ShareVault(path, title string) error
|
||||
}
|
||||
|
||||
var (
|
||||
bgColor = color.NRGBA{R: 242, G: 239, B: 233, A: 255}
|
||||
panelColor = color.NRGBA{R: 250, G: 248, B: 244, A: 255}
|
||||
@@ -691,7 +688,7 @@ func newUIWithState(mode string, sess appstate.CurrentSession, paths statePaths)
|
||||
syncDefaultDirection: syncDirectionPull,
|
||||
apiPolicyGroupScope: true,
|
||||
autofillNoticePreference: autofillNoticeAll,
|
||||
vaultSharer: newPlatformVaultSharer(runtime.GOOS),
|
||||
vaultSharer: platform.NewVaultSharer(runtime.GOOS),
|
||||
backgroundResults: make(chan backgroundActionResult, 8),
|
||||
phoneGroupBrowserExpanded: true,
|
||||
}
|
||||
@@ -6980,7 +6977,7 @@ func run(w *app.Window, mode string, paths statePaths, grpcAddr string) error {
|
||||
ui := newUIWithSession(mode, manager, paths)
|
||||
ui.fileExplorer = explorer.NewExplorer(w)
|
||||
ui.invalidate = w.Invalidate
|
||||
ui.clipboardWriter = newPlatformClipboardWriter(runtime.GOOS, w.Invalidate)
|
||||
ui.clipboardWriter = platform.NewClipboardWriter(runtime.GOOS, w.Invalidate)
|
||||
host, err := api.StartHost(grpcAddr, manager, passwords.DefaultProfiles(), ui.clipboardWriter, func() bool { return ui.state.Dirty })
|
||||
if err != nil {
|
||||
ui.state.ErrorMessage = fmt.Sprintf("start gRPC API: %v", err)
|
||||
@@ -7001,7 +6998,7 @@ func run(w *app.Window, mode string, paths statePaths, grpcAddr string) error {
|
||||
gtx := app.NewContext(&ops, e)
|
||||
ui.processBackgroundActions()
|
||||
ui.layout(gtx)
|
||||
processClipboardWrites(gtx, ui.clipboardWriter)
|
||||
platform.ProcessClipboardWrites(gtx, ui.clipboardWriter)
|
||||
e.Frame(gtx.Ops)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user