fix: disable password dialog on windows

This commit is contained in:
Patryk Hegenberg 2025-03-20 19:17:22 +01:00
parent 4a3fb2be58
commit 26bdcd9a6a

View file

@ -6,6 +6,7 @@ import (
"jws/internal/logger"
"jws/internal/project"
"log/slog"
"runtime"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/data/binding"
@ -33,19 +34,23 @@ func Init(window fyne.Window, deps []dependency.Dependency, projs []project.Proj
// ShowPasswordDialog shows a dialog to enter sudo password for installations
func ShowPasswordDialog(index int) {
password := binding.NewString()
entry := widget.NewEntryWithData(password)
entry.Password = true
if runtime.GOOS == "linux" || runtime.GOOS == "darwin" {
password := binding.NewString()
entry := widget.NewEntryWithData(password)
entry.Password = true
dialog.NewForm("Sudo Password", "ok", "cancel",
[]*widget.FormItem{widget.NewFormItem("password", entry)},
func(b bool) {
pass, err := password.Get()
if err == nil {
if b {
dependency.InstallDependency(index, pass, dependencies, mainWindow)
dialog.NewForm("Sudo Password", "ok", "cancel",
[]*widget.FormItem{widget.NewFormItem("password", entry)},
func(b bool) {
pass, err := password.Get()
if err == nil {
if b {
dependency.InstallDependency(index, pass, dependencies, mainWindow)
}
}
}
},
mainWindow).Show()
},
mainWindow).Show()
} else {
dependency.InstallDependency(index, "", dependencies, mainWindow)
}
}