removed now indicator from android and ios widgets
This commit is contained in:
@@ -82,7 +82,6 @@ struct TimetableDayView: View {
|
||||
TimeGridView(
|
||||
lessons: data.lessons,
|
||||
periods: data.periods,
|
||||
anchorDate: data.anchorDate,
|
||||
hourHeight: max(
|
||||
MIN_HOUR_HEIGHT,
|
||||
min(MAX_HOUR_HEIGHT, geo.size.height / max(totalMin, 60) * 60)
|
||||
@@ -135,7 +134,6 @@ struct TimetableDayView: View {
|
||||
struct TimeGridView: View {
|
||||
let lessons: [WidgetLesson]
|
||||
let periods: [WidgetPeriod]
|
||||
let anchorDate: Date
|
||||
let hourHeight: CGFloat
|
||||
let showRoom: Bool
|
||||
let showTeacher: Bool
|
||||
@@ -170,9 +168,6 @@ struct TimeGridView: View {
|
||||
ForEach(lessons.indices, id: \.self) { idx in
|
||||
lessonBlock(lessons[idx])
|
||||
}
|
||||
if Calendar.current.isDate(anchorDate, inSameDayAs: Date()) {
|
||||
nowIndicator
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, minHeight: totalHeight, alignment: .top)
|
||||
}
|
||||
@@ -344,27 +339,6 @@ struct TimeGridView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var nowIndicator: some View {
|
||||
let cal = Calendar.current
|
||||
let comps = cal.dateComponents([.hour, .minute], from: Date())
|
||||
let nowMinutes = (comps.hour ?? 0) * 60 + (comps.minute ?? 0)
|
||||
let inside: Bool
|
||||
if let first = periods.first, let last = periods.last {
|
||||
inside = nowMinutes >= first.startMinutes && nowMinutes <= last.endMinutes
|
||||
} else {
|
||||
inside = true
|
||||
}
|
||||
let top = realMinutesToVirtual(nowMinutes, periods: periods) * hourHeight / 60.0
|
||||
return Group {
|
||||
if inside {
|
||||
Rectangle()
|
||||
.fill(Color.red)
|
||||
.frame(height: 2)
|
||||
.offset(y: top)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func subjectLabel(_ lesson: WidgetLesson) -> String {
|
||||
!lesson.subjectShort.isEmpty
|
||||
? lesson.subjectShort
|
||||
|
||||
@@ -131,7 +131,6 @@ struct TimetableWeekView: View {
|
||||
return TimeGridView(
|
||||
lessons: lessonsForDay,
|
||||
periods: data.periods,
|
||||
anchorDate: day,
|
||||
hourHeight: hourHeight,
|
||||
showRoom: !subjectOnly,
|
||||
showTeacher: !subjectOnly,
|
||||
|
||||
Reference in New Issue
Block a user