From 7e17452c40229f181173c634febf6a8e15db1125 Mon Sep 17 00:00:00 2001 From: FoPPi Date: Thu, 22 Dec 2022 13:44:17 +0200 Subject: [PATCH] v2.8-fix --- WorkingWithAPI/UserCfg.go | 4 ++++ WorkingWithAPI/consts.go | 2 ++ main.go | 20 +++++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/WorkingWithAPI/UserCfg.go b/WorkingWithAPI/UserCfg.go index d2e6c2d..89ef698 100644 --- a/WorkingWithAPI/UserCfg.go +++ b/WorkingWithAPI/UserCfg.go @@ -47,6 +47,8 @@ func ReadUserConf() { SendNotification = SettingsJSON.SendNotification LastUpdate = SettingsJSON.DutInfo.LastUpdate + + LastTabID = SettingsJSON.LastTabID } func WriteUserConf() { @@ -69,6 +71,7 @@ func WriteUserConf() { LessonName: LessonName, LessonType: LessonType, SendNotification: SendNotification, + LastTabID: LastTabID, } jsonData, err := json.Marshal(data) @@ -92,6 +95,7 @@ type Settings struct { LessonName bool `json:"lesson_name"` LessonType bool `json:"lesson_type"` SendNotification bool `json:"send_notification"` + LastTabID int `json:"last_tab_id"` } type DutInfo struct { diff --git a/WorkingWithAPI/consts.go b/WorkingWithAPI/consts.go index eeb1889..d467aed 100644 --- a/WorkingWithAPI/consts.go +++ b/WorkingWithAPI/consts.go @@ -16,5 +16,7 @@ var ( LessonType bool = true // true - show | false - hide SendNotification bool = true // true - send | false - hide + LastTabID int = 2 + Version string = "v2.8" ) diff --git a/main.go b/main.go index a50f050..5130301 100644 --- a/main.go +++ b/main.go @@ -307,10 +307,28 @@ func main() { &container.TabItem{Text: "Appearance", Content: appearance}, ) - tabs.Select(tabs.Items[2]) + tabs.Select(tabs.Items[api.LastTabID]) + // Refresh theme tabs.OnSelected = func(t *container.TabItem) { t.Content.Refresh() + + if api.GroupID != 0 { + switch t.Text { + case "Time": + api.LastTabID = 0 + break + case "Calendar": + api.LastTabID = 1 + case "Settings": + api.LastTabID = 2 + case "Appearance": + api.LastTabID = 3 + } + + api.WriteUserConf() + } + } DateSelector.OnChanged = func(value string) { arrCards = TakeRozkald(value)