MobileMkch/main.go
2025-08-05 23:54:04 +03:00

69 lines
1.5 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"fmt"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"MobileMkch/api"
"MobileMkch/settings"
"MobileMkch/ui"
)
func main() {
a := app.NewWithID("com.mkch.mobile")
a.SetIcon(theme.ComputerIcon())
settings.SetApp(a)
MobileOptimizations(a)
w := a.NewWindow("MobileMkch")
w.Resize(fyne.NewSize(400, 700))
apiClient := api.NewClient()
appSettings, err := settings.Load()
if err == nil {
if appSettings.Key != "" {
if err := apiClient.Authenticate(appSettings.Key); err != nil {
fmt.Printf("Ошибка аутентификации по ключу: %v\n", err)
} else {
fmt.Println("Аутентификация по ключу успешна")
}
}
if appSettings.Passcode != "" {
if err := apiClient.LoginWithPasscode(appSettings.Passcode); err != nil {
fmt.Printf("Ошибка входа с passcode: %v\n", err)
} else {
fmt.Println("Вход с passcode успешен")
}
}
}
uiManager := ui.NewUIManager(a, w, apiClient)
w.SetContent(uiManager.GetMainContent())
w.ShowAndRun()
}
const Version = "1.0.0"
func showAbout() *widget.PopUp {
content := container.NewVBox(
widget.NewLabel("MobileMkch"),
widget.NewLabel(fmt.Sprintf("Версия: %s", Version)),
widget.NewLabel("Мобильный клиент для mkch.pooziqo.xyz"),
widget.NewLabel(""),
widget.NewLabel("Разработано с ❤️ на Go + Fyne"),
)
return widget.NewModalPopUp(content, nil)
}