Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
v2.8-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FoPPi committed Dec 22, 2022
1 parent 96cca6b commit 7e17452
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions WorkingWithAPI/UserCfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ func ReadUserConf() {
SendNotification = SettingsJSON.SendNotification

LastUpdate = SettingsJSON.DutInfo.LastUpdate

LastTabID = SettingsJSON.LastTabID
}

func WriteUserConf() {
Expand All @@ -69,6 +71,7 @@ func WriteUserConf() {
LessonName: LessonName,
LessonType: LessonType,
SendNotification: SendNotification,
LastTabID: LastTabID,
}

jsonData, err := json.Marshal(data)
Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions WorkingWithAPI/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
20 changes: 19 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7e17452

Please sign in to comment.