From 4b8905bae57e67b3da8a39d3d467a747c3fdf0c5 Mon Sep 17 00:00:00 2001 From: adisve Date: Mon, 26 Feb 2024 23:19:24 +0100 Subject: [PATCH 1/2] Edit icons for bookmark cards. Edit localizations for date on resource cards --- .../Booking/Events/EventCardButton.swift | 2 +- .../Events/UpcomingEventCardButton.swift | 2 +- .../Booking/Sheets/ExamDetailsSheet.swift | 2 +- .../Booking/Sheets/ResourceDetailSheet.swift | 2 +- .../User/ResourceSection/ResourceCard.swift | 88 ++++++++++++------- .../Buttons/CompactEventButtonLabel.swift | 2 +- Assets/ar.lproj/Localizable.strings | 4 +- Assets/bs-BA.lproj/Localizable.strings | 4 +- Assets/de.lproj/Localizable.strings | 4 +- Assets/en.lproj/Localizable.strings | 4 +- Assets/fr.lproj/Localizable.strings | 4 +- Assets/it.lproj/Localizable.strings | 4 +- Assets/sv.lproj/Localizable.strings | 4 +- 13 files changed, 70 insertions(+), 56 deletions(-) diff --git a/App/Presentation/Views/Account/User/ResourceSection/Booking/Events/EventCardButton.swift b/App/Presentation/Views/Account/User/ResourceSection/Booking/Events/EventCardButton.swift index 1a95eee3..3e142105 100644 --- a/App/Presentation/Views/Account/User/ResourceSection/Booking/Events/EventCardButton.swift +++ b/App/Presentation/Views/Account/User/ResourceSection/Booking/Events/EventCardButton.swift @@ -36,7 +36,7 @@ struct EventCardButton: View { let eventEnd = event.eventEnd.convertToHoursAndMinutes(), let eventStart = event.eventStart.convertToHoursAndMinutes() { - Text(String(format: NSLocalizedString("%@, from %@ - %@", comment: ""), eventDate, eventStart, eventEnd)) + Text(String(format: NSLocalizedString("%@, from %@ to %@", comment: ""), eventDate, eventStart, eventEnd)) .font(.system(size: 15)) .foregroundColor(.onSurface.opacity(0.7)) } else { diff --git a/App/Presentation/Views/Account/User/ResourceSection/Booking/Events/UpcomingEventCardButton.swift b/App/Presentation/Views/Account/User/ResourceSection/Booking/Events/UpcomingEventCardButton.swift index 64f5c18f..9fc4b7ba 100644 --- a/App/Presentation/Views/Account/User/ResourceSection/Booking/Events/UpcomingEventCardButton.swift +++ b/App/Presentation/Views/Account/User/ResourceSection/Booking/Events/UpcomingEventCardButton.swift @@ -28,7 +28,7 @@ struct UpcomingEventCardButton: View { let eventEnd = event.eventEnd.toDate(), let eventStart = event.eventStart.convertToHoursAndMinutes() { - Text(String(format: NSLocalizedString("%@, from %@ - %@", comment: ""), eventDate, eventStart, eventEnd)) + Text(String(format: NSLocalizedString("%@, from %@ to %@", comment: ""), eventDate, eventStart, eventEnd)) .font(.system(size: 15)) .foregroundColor(.onSurface.opacity(0.7)) diff --git a/App/Presentation/Views/Account/User/ResourceSection/Booking/Sheets/ExamDetailsSheet.swift b/App/Presentation/Views/Account/User/ResourceSection/Booking/Sheets/ExamDetailsSheet.swift index e316f1cb..3033387d 100644 --- a/App/Presentation/Views/Account/User/ResourceSection/Booking/Sheets/ExamDetailsSheet.swift +++ b/App/Presentation/Views/Account/User/ResourceSection/Booking/Sheets/ExamDetailsSheet.swift @@ -31,7 +31,7 @@ struct ExamDetailsSheet: View { let date = event.eventStart.toDate() ?? NSLocalizedString("No date", comment: "") let start = event.eventStart.convertToHoursAndMinutes() ?? NSLocalizedString("(no time)", comment: "") let end = event.eventEnd.convertToHoursAndMinutes() ?? NSLocalizedString("(no time)", comment: "") - Text(String(format: NSLocalizedString("%@, from %@ - %@", comment: ""), date, start, end)) + Text(String(format: NSLocalizedString("%@, from %@ to %@", comment: ""), date, start, end)) .font(.system(size: 16)) .foregroundColor(.onSurface) diff --git a/App/Presentation/Views/Account/User/ResourceSection/Booking/Sheets/ResourceDetailSheet.swift b/App/Presentation/Views/Account/User/ResourceSection/Booking/Sheets/ResourceDetailSheet.swift index 09c805e0..7ea0fcb2 100644 --- a/App/Presentation/Views/Account/User/ResourceSection/Booking/Sheets/ResourceDetailSheet.swift +++ b/App/Presentation/Views/Account/User/ResourceSection/Booking/Sheets/ResourceDetailSheet.swift @@ -35,7 +35,7 @@ struct ResourceDetailSheet: View { let date = confirmationOpen.toDate() ?? "(missing)" let from = confirmationOpen.convertToHoursAndMinutes() ?? NSLocalizedString("(missing)", comment: "") let to = confirmationClosed.convertToHoursAndMinutes() ?? NSLocalizedString("(missing)", comment: "") - Text(String(format: NSLocalizedString("%@, from %@ - %@", comment: ""), date, from, to)) + Text(String(format: NSLocalizedString("%@, from %@ to %@", comment: ""), date, from, to)) .font(.system(size: 16)) .foregroundColor(.onSurface) }) diff --git a/App/Presentation/Views/Account/User/ResourceSection/ResourceCard.swift b/App/Presentation/Views/Account/User/ResourceSection/ResourceCard.swift index fbc60a8f..e39d6560 100644 --- a/App/Presentation/Views/Account/User/ResourceSection/ResourceCard.swift +++ b/App/Presentation/Views/Account/User/ResourceSection/ResourceCard.swift @@ -40,40 +40,17 @@ struct ResourceCard: View { onClick() }, label: { HStack { - VStack(alignment: .leading, spacing: 10) { - Text(title ?? NSLocalizedString("No title", comment: "")) - .font(.system(size: 17, weight: .medium)) - .foregroundColor(.onSurface) - .lineLimit(1) - .truncationMode(.tail) + VStack(alignment: .leading, spacing: 0) { + TitleView(title: title) + if let type = type { - HStack { - Image(systemName: "info.circle") - .font(.system(size: 15)) - .foregroundColor(.onSurface.opacity(0.7)) - Text(type) - .font(.system(size: 15)) - .foregroundColor(.onSurface.opacity(0.7)) - } + InformationView(imageName: "info.circle", text: type) } if let location = location { - HStack { - Image(systemName: "mappin.and.ellipse") - .font(.system(size: 15)) - .foregroundColor(.onSurface.opacity(0.7)) - Text(location) - .font(.system(size: 15)) - .foregroundColor(.onSurface.opacity(0.7)) - } - } - HStack { - Image(systemName: "calendar.badge.clock") - .font(.system(size: 15)) - .foregroundColor(.onSurface.opacity(0.7)) - Text(String(format: NSLocalizedString("%@, from %@ - %@", comment: ""), date, eventStart, eventEnd)) - .font(.system(size: 15)) - .foregroundColor(.onSurface.opacity(0.7)) + InformationView(imageName: "mappin.and.ellipse", text: location) } + + DateView(date: date, start: eventStart, end: eventEnd) } .padding() Spacer() @@ -83,3 +60,54 @@ struct ResourceCard: View { .buttonStyle(CompactButtonStyle(colored: true)) } } + +struct TitleView: View { + let title: String? + + var body: some View { + Text(title ?? NSLocalizedString("No title", comment: "")) + .font(.system(size: 17, weight: .medium)) + .foregroundColor(.onSurface) + .lineLimit(1) + .truncationMode(.tail) + } +} + +struct InformationView: View { + let imageName: String + let text: String + + var body: some View { + VStack (spacing: 0) { + Spacer() + HStack (alignment: .top) { + Image(systemName: imageName) + .font(.system(size: 15)) + .foregroundColor(.onSurface.opacity(0.7)) + Text(text) + .font(.system(size: 15)) + .foregroundColor(.onSurface.opacity(0.7)) + } + } + } +} + +struct DateView: View { + let date: String + let start: String + let end: String + + var body: some View { + VStack (spacing: 0) { + Spacer() + HStack (alignment: .top) { + Image(systemName: "calendar.badge.clock") + .font(.system(size: 15)) + .foregroundColor(.onSurface.opacity(0.7)) + Text(String(format: NSLocalizedString("%@, from %@ to %@", comment: ""), date, start, end)) + .font(.system(size: 15)) + .foregroundColor(.onSurface.opacity(0.7)) + } + } + } +} diff --git a/App/Presentation/Views/Buttons/CompactEventButtonLabel.swift b/App/Presentation/Views/Buttons/CompactEventButtonLabel.swift index c90b9644..05267751 100644 --- a/App/Presentation/Views/Buttons/CompactEventButtonLabel.swift +++ b/App/Presentation/Views/Buttons/CompactEventButtonLabel.swift @@ -24,7 +24,7 @@ struct CompactEventButtonLabel: View { Image(systemName: "arrow.down") .font(.system(size: 10, weight: .semibold)) .foregroundColor(.onSurface) - .padding(.vertical, 5) + .padding(.vertical, 7.5) Text("\(timeTo)") .font(.system(size: 14, weight: .semibold)) .foregroundColor(.onSurface) diff --git a/Assets/ar.lproj/Localizable.strings b/Assets/ar.lproj/Localizable.strings index 00ffea53..f60b1c84 100644 --- a/Assets/ar.lproj/Localizable.strings +++ b/Assets/ar.lproj/Localizable.strings @@ -361,7 +361,7 @@ "No date"="بدون تاريخ"; -"%@, from %@ - %@"="%@، من %@ - %@"; +"%@, from %@ to %@"="%@، من %@ إلى %@"; "Available until"="متاح حتى"; @@ -379,8 +379,6 @@ "(missing)"="(مفقود)"; -"%@, from %@ - %@"="%@، من %@ - %@"; - "Confirm booking"="تأكيد الحجز"; "Remove booking"="إزالة الحجز"; diff --git a/Assets/bs-BA.lproj/Localizable.strings b/Assets/bs-BA.lproj/Localizable.strings index bad479f3..5edaa50a 100644 --- a/Assets/bs-BA.lproj/Localizable.strings +++ b/Assets/bs-BA.lproj/Localizable.strings @@ -360,7 +360,7 @@ "No date"="Nema datuma"; -"%@, from %@ - %@"="%@, od %@ - %@"; +"%@, from %@ to %@"="%@, od %@ do %@"; "Available until"="Dostupno do"; @@ -378,8 +378,6 @@ "(missing)"="(nedostaje)"; -"%@, from %@ - %@"="%@, od %@ - %@"; - "Confirm booking"="Potvrdite rezervaciju"; "Remove booking"="Ukloni rezervaciju"; diff --git a/Assets/de.lproj/Localizable.strings b/Assets/de.lproj/Localizable.strings index 351f8050..ad63cdb4 100644 --- a/Assets/de.lproj/Localizable.strings +++ b/Assets/de.lproj/Localizable.strings @@ -360,7 +360,7 @@ "No date"="Kein Datum"; -"%@, from %@ - %@"="%@, aus %@ - %@"; +"%@, from %@ to %@"="%@, von %@ bis %@"; "Available until"="Verfügbar bis"; @@ -378,8 +378,6 @@ "(missing)"="(fehlen)"; -"%@, from %@ - %@"="%@, aus %@ - %@"; - "Confirm booking"="Buchung bestätigen"; "Remove booking"="Buchung entfernen"; diff --git a/Assets/en.lproj/Localizable.strings b/Assets/en.lproj/Localizable.strings index 00009fb2..8be2423c 100644 --- a/Assets/en.lproj/Localizable.strings +++ b/Assets/en.lproj/Localizable.strings @@ -356,7 +356,7 @@ "No date"="No date"; -"%@, from %@ - %@"="%@, from %@ - %@"; +"%@, from %@ to %@"="%@, from %@ to %@"; "Available until"="Available until"; @@ -374,8 +374,6 @@ "(missing)"="(missing)"; -"%@, from %@ - %@"="%@, from %@ - %@"; - "Confirm booking"="Confirm booking"; "Remove booking"="Remove booking"; diff --git a/Assets/fr.lproj/Localizable.strings b/Assets/fr.lproj/Localizable.strings index 36f6a7ae..1974a8fd 100644 --- a/Assets/fr.lproj/Localizable.strings +++ b/Assets/fr.lproj/Localizable.strings @@ -360,7 +360,7 @@ "No date"="Pas de date"; -"%@, from %@ - %@"="%@, de %@ - %@"; +"%@, from %@ to %@"="%@, de %@ à %@"; "Available until"="Disponible jusqu'au"; @@ -378,8 +378,6 @@ "(missing)"="(manquant)"; -"%@, from %@ - %@"="%@, depuis %@ - %@"; - "Confirm booking"="Confirmer la réservation"; "Remove booking"="Supprimer la réservation"; diff --git a/Assets/it.lproj/Localizable.strings b/Assets/it.lproj/Localizable.strings index 957e6213..f468d19b 100644 --- a/Assets/it.lproj/Localizable.strings +++ b/Assets/it.lproj/Localizable.strings @@ -360,7 +360,7 @@ "No date"="Nessuna data"; -"%@, from %@ - %@"="%@, da %@ - %@"; +"%@, from %@ to %@"="%@, da %@ a %@"; "Available until"="Disponibile fino"; @@ -378,8 +378,6 @@ "(missing)"="(mancante)"; -"%@, from %@ - %@"="%@, da %@ - %@"; - "Confirm booking"="Conferma prenotazione"; "Remove booking"="Rimuovi prenotazione"; diff --git a/Assets/sv.lproj/Localizable.strings b/Assets/sv.lproj/Localizable.strings index 85135d0a..f51d7a83 100644 --- a/Assets/sv.lproj/Localizable.strings +++ b/Assets/sv.lproj/Localizable.strings @@ -360,7 +360,7 @@ "No date"="Inget datum"; -"%@, from %@ - %@"="%@, från %@ - %@"; +"%@, from %@ to %@"="%@, från %@ till %@"; "Available until"="Tillgänglig till"; @@ -378,8 +378,6 @@ "(missing)"="(saknas)"; -"%@, from %@ - %@"="%@, från %@ - %@"; - "Confirm booking"="Bekräfta bokningen"; "Remove booking"="Ta bort bokningen"; From e80a65bb92092ba49c8d8f9035f28b32319fed68 Mon Sep 17 00:00:00 2001 From: adisve Date: Mon, 26 Feb 2024 23:56:46 +0100 Subject: [PATCH 2/2] Fix localization in widget. Edit margins/padding for widget and add subtitle --- Tumble.xcodeproj/project.pbxproj | 10 ++-------- Widget/Views/EventViews/MediumEvent.swift | 7 +++---- Widget/Views/EventViews/SmallEvent.swift | 15 +++++++++------ Widget/tumble_iosWidget.swift | 12 +++++++----- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Tumble.xcodeproj/project.pbxproj b/Tumble.xcodeproj/project.pbxproj index 6731da7b..d477b4ae 100644 --- a/Tumble.xcodeproj/project.pbxproj +++ b/Tumble.xcodeproj/project.pbxproj @@ -138,6 +138,7 @@ D46BB10A298AC31E00887A24 /* DetailsBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D46BB109298AC31E00887A24 /* DetailsBuilder.swift */; }; D46BB112298B0E2800887A24 /* SettingsButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D46BB111298B0E2800887A24 /* SettingsButton.swift */; }; D46BB118298B21DA00887A24 /* InfoLoading.swift in Sources */ = {isa = PBXBuildFile; fileRef = D46BB117298B21DA00887A24 /* InfoLoading.swift */; }; + D46CE0842B8D4C530069207A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = D4CD0F0729D5DC9D00AB5FD0 /* Localizable.strings */; }; D4722149292454560063BDB7 /* tumble_iosApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4722148292454560063BDB7 /* tumble_iosApp.swift */; }; D472214D292454570063BDB7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D472214C292454570063BDB7 /* Assets.xcassets */; }; D4722161292455710063BDB7 /* KronoxManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D472215E292455710063BDB7 /* KronoxManager.swift */; }; @@ -1364,7 +1365,6 @@ children = ( D4D778E62B8CE6DE00D82C94 /* Assets.xcassets */, D4D779142B8D12C000D82C94 /* Extensions */, - D4D779112B8D0F6400D82C94 /* Intents */, D4D7790E2B8D0F5200D82C94 /* Model */, D4D779082B8CFE0900D82C94 /* Views */, D4D778E22B8CE6DD00D82C94 /* tumble_iosWidgetBundle.swift */, @@ -1401,13 +1401,6 @@ path = Model; sourceTree = ""; }; - D4D779112B8D0F6400D82C94 /* Intents */ = { - isa = PBXGroup; - children = ( - ); - path = Intents; - sourceTree = ""; - }; D4D779142B8D12C000D82C94 /* Extensions */ = { isa = PBXGroup; children = ( @@ -1715,6 +1708,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + D46CE0842B8D4C530069207A /* Localizable.strings in Resources */, D4D778E72B8CE6DE00D82C94 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Widget/Views/EventViews/MediumEvent.swift b/Widget/Views/EventViews/MediumEvent.swift index 631709ef..a58cc020 100644 --- a/Widget/Views/EventViews/MediumEvent.swift +++ b/Widget/Views/EventViews/MediumEvent.swift @@ -14,12 +14,12 @@ struct MediumEvent: View { var body: some View { HStack { - VStack(alignment: .leading, spacing: 20) { + VStack(alignment: .leading, spacing: 25) { VStack(alignment: .leading, spacing: 2) { - Text(event.course?.englishName ?? "") + Text(event.title) .font(.system(size: 17, weight: .semibold)) .foregroundColor(.onSurface) - Text(event.title) + Text(event.course?.englishName ?? "") .lineLimit(1) .truncationMode(.tail) .font(.system(size: 15)) @@ -103,6 +103,5 @@ struct MediumEvent_Previews: PreviewProvider { lastModified: "2024-01-30T10:14:04Z" )) .previewContext(WidgetPreviewContext(family: .systemMedium)) - .widgetBackground(Color.surface) } } diff --git a/Widget/Views/EventViews/SmallEvent.swift b/Widget/Views/EventViews/SmallEvent.swift index dd260c25..06a51504 100644 --- a/Widget/Views/EventViews/SmallEvent.swift +++ b/Widget/Views/EventViews/SmallEvent.swift @@ -11,15 +11,19 @@ import WidgetKit struct SmallEvent: View { let event: Event - var body: some View { HStack { - VStack(alignment: .leading, spacing: 10) { - VStack(alignment: .leading) { + VStack(alignment: .leading, spacing: 7.5) { + VStack(alignment: .leading, spacing: 7.5) { Text(event.title) - .font(.system(size: 16, weight: .semibold)) + .font(.system(size: 14, weight: .semibold)) .foregroundColor(.onSurface) - .lineLimit(4) + .lineLimit(3) + Text(event.course?.englishName ?? "") + .lineLimit(3) + .truncationMode(.tail) + .font(.system(size: 12)) + .foregroundColor(.onSurface.opacity(0.7)) } Spacer() if let timeFrom = event.from.convertToHoursAndMinutesISOString(), @@ -78,6 +82,5 @@ struct SmallEvent_Previews: PreviewProvider { lastModified: "2024-01-30T10:14:04Z" )) .previewContext(WidgetPreviewContext(family: .systemSmall)) - .widgetBackground(Color.surface) } } diff --git a/Widget/tumble_iosWidget.swift b/Widget/tumble_iosWidget.swift index b03c2c37..48fa1f66 100644 --- a/Widget/tumble_iosWidget.swift +++ b/Widget/tumble_iosWidget.swift @@ -7,12 +7,14 @@ struct tumble_iosWidget: Widget { var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: Provider()) { entry in - if let event = entry.event { - WidgetView(event: event) - .widgetBackground(Color.surface) - } else { - Text(LocalizedStringKey("No upcoming events available")) + VStack { + if let event = entry.event { + WidgetView(event: event) + } else { + Text(NSLocalizedString("No upcoming events available", comment: "")) + } } + .widgetBackground(Color.surface) } .configurationDisplayName("Upcoming event") .description("Shows the earliest upcoming event.")