Skip to content

Commit

Permalink
Fix showLocalTime handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Nov 14, 2023
1 parent 6537909 commit e008563
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
34 changes: 18 additions & 16 deletions src/TrueWidget/swift/Views/Main/MainTimeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,28 @@ struct MainTimeView: View {
.padding(.bottom, 4.0)
}

HStack(alignment: .center, spacing: 0) {
Spacer()
if userSettings.showLocalTime {
HStack(alignment: .center, spacing: 0) {
Spacer()

HStack(alignment: .firstTextBaseline, spacing: 0) {
Text(
String(
format: " %02d:%02d",
time.localHour,
time.localMinute
HStack(alignment: .firstTextBaseline, spacing: 0) {
Text(
String(
format: " %02d:%02d",
time.localHour,
time.localMinute
)
)
)
.font(.custom("Menlo", size: userSettings.localTimeFontSize))
.font(.custom("Menlo", size: userSettings.localTimeFontSize))

Text(
String(
format: " %02d",
time.localSecond
Text(
String(
format: " %02d",
time.localSecond
)
)
)
.font(.custom("Menlo", size: userSettings.localTimeFontSize / 2))
.font(.custom("Menlo", size: userSettings.localTimeFontSize / 2))
}
}
}

Expand Down
42 changes: 20 additions & 22 deletions src/TrueWidget/swift/Views/Settings/SettingsTimeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,36 +41,34 @@ struct SettingsTimeView: View {
.padding()
}

if userSettings.showLocalTime {
GroupBox(label: Text("Advanced")) {
VStack(alignment: .leading) {
HStack {
Toggle(isOn: $userSettings.showLocalDate) {
Text("Show local date")
}
.switchToggleStyle()

Spacer()
GroupBox(label: Text("Local date")) {
VStack(alignment: .leading) {
HStack {
Toggle(isOn: $userSettings.showLocalDate) {
Text("Show local date")
}
.switchToggleStyle()

HStack {
Text("Local date font size: ")
Spacer()
}

DoubleTextField(
value: $userSettings.localDateFontSize,
range: 0...1000,
step: 2,
width: 40)
HStack {
Text("Local date font size: ")

Text("pt")
DoubleTextField(
value: $userSettings.localDateFontSize,
range: 0...1000,
step: 2,
width: 40)

Text("(Default: 12 pt)")
Text("pt")

Spacer()
}
Text("(Default: 12 pt)")

Spacer()
}
.padding()
}
.padding()
}

GroupBox(label: Text("Other time zones")) {
Expand Down

0 comments on commit e008563

Please sign in to comment.