Partial fixes for lock screen calendar

This commit is contained in:
Hariharan Mudaliar 2026-02-07 22:26:03 +05:30
commit f411676d02
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E
10 changed files with 1348 additions and 27 deletions

View file

@ -0,0 +1,79 @@
/*
* Atoll (DynamicIsland)
* Copyright (C) 2024-2026 Atoll Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import SwiftUI
struct LockScreenCalendarEventRow: View {
let line: String
let isVisible: Bool
let renderToken: Int
let font: Font
let alignment: Alignment
let iconName: String
let iconRenderingMode: SymbolRenderingMode
let iconColors: [Color]
var body: some View {
HStack(alignment: .center, spacing: 6) {
calendarIcon
.frame(width: 26, height: 26)
Text(line)
.font(font)
.lineLimit(1)
.truncationMode(.tail)
.minimumScaleFactor(0.85)
.allowsTightening(true)
.layoutPriority(10)
}
.frame(maxWidth: .infinity, alignment: alignment)
.padding(.horizontal, 2)
.id(renderToken)
.opacity(isVisible ? 1 : 0)
.accessibilityHidden(!isVisible)
.allowsHitTesting(false)
}
@ViewBuilder
private var calendarIcon: some View {
let baseImage = Image(systemName: iconName)
.font(.system(size: 20, weight: .semibold))
.id(iconRenderingModeIdentifier)
if iconRenderingModeIdentifier.lowercased().contains("palette"), iconColors.count >= 2 {
baseImage
.symbolRenderingMode(.palette)
.foregroundStyle(iconColors[0], iconColors[1])
} else if iconColors.count >= 2 {
baseImage
.symbolRenderingMode(iconRenderingMode)
.foregroundStyle(iconColors[0], iconColors[1])
} else if iconColors.count == 1 {
baseImage
.symbolRenderingMode(iconRenderingMode)
.foregroundStyle(iconColors[0])
} else {
baseImage
.symbolRenderingMode(iconRenderingMode)
}
}
private var iconRenderingModeIdentifier: String {
String(describing: iconRenderingMode)
}
}