Render the live location timeline item (#5209)

* created the data for the timeline item

# Conflicts:
#	ElementX/Sources/Other/Logging/Tracing.swift
#	ElementX/Sources/Services/Authentication/AuthenticationService.swift
#	ElementX/Sources/Services/Authentication/LinkNewDeviceService.swift

* Implemented the LLS timeline item

* updated preview tests

* pr and design suggestions

* previewscrollview is debug only
This commit is contained in:
Mauro
2026-03-24 10:34:00 +01:00
committed by GitHub
parent 055b6524a0
commit 8934f68f7b
51 changed files with 799 additions and 93 deletions

View File

@@ -42,6 +42,25 @@ struct DateTests {
#expect(theMillennium.formattedMinimal() == theMillennium.formatted(.dateTime.year().day().month()))
}
@Test
func expirationDateFormatting() throws {
// Within 24 hours show time only
let in23Hours = try #require(calendar.date(byAdding: .hour, value: 23, to: .now))
#expect(in23Hours.formattedExpiration() == in23Hours.formatted(date: .omitted, time: .shortened))
// Just over the 24h boundary show day and month
let in25Hours = try #require(calendar.date(byAdding: .hour, value: 25, to: .now))
#expect(in25Hours.formattedExpiration() == in25Hours.formatted(.dateTime.day().month()))
// Several months away show day and month
let inSixMonths = try #require(calendar.date(byAdding: .month, value: 6, to: .now))
#expect(inSixMonths.formattedExpiration() == inSixMonths.formatted(.dateTime.day().month()))
// More than a year away show year only
let inTwoYears = try #require(calendar.date(byAdding: .year, value: 2, to: .now))
#expect(inTwoYears.formattedExpiration() == inTwoYears.formatted(.dateTime.year()))
}
@Test
func dateSeparatorFormatting() throws {
let today = try #require(calendar.date(byAdding: DateComponents(hour: 9, minute: 30), to: startOfToday))