Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Feature/migrate search views #408

Merged
merged 7 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 206 additions & 6 deletions Campus-iOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

22 changes: 7 additions & 15 deletions Campus-iOS/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ import KVKCalendar

@main
struct CampusApp: App {
@StateObject var environmentValues: Model = Model()
@StateObject var model: Model = MockModel()

let persistenceController = PersistenceController.shared
@State var selectedTab = 0
@State var splashScreenPresented = false
@State private var showingAlert = false

init() {
UITabBar.appearance().isOpaque = true
Expand All @@ -29,25 +26,20 @@ struct CampusApp: App {

var body: some Scene {
WindowGroup {
tabViewComponent()
.sheet(isPresented: $model.isLoginSheetPresented) {
if splashScreenPresented {
Spinner()
.alert(isPresented: $showingAlert) {
Alert(title: Text("There is a problem with the connection"),
message: Text("Please restart the app"),
dismissButton: .default(Text("Got it!")))
}
} else {
if model.splashScreenPresented {
TUMSplashScreen()
} else {
tabViewComponent()
.sheet(isPresented: $model.isLoginSheetPresented) {
NavigationView {
LoginView(model: model)
.onAppear {
selectedTab = 2
}
}
}
}
.environmentObject(environmentValues)
.environmentObject(model)
}
}
}

Expand Down
Binary file removed Campus-iOS/Assets.xcassets/About.imageset/About.pdf
Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/About.imageset/Contents.json

This file was deleted.

Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/Calendar.imageset/Contents.json

This file was deleted.

Binary file removed Campus-iOS/Assets.xcassets/Cards.imageset/Cards.pdf
Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/Cards.imageset/Contents.json

This file was deleted.

12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/Feedback.imageset/Contents.json

This file was deleted.

Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/Grades.imageset/Contents.json

This file was deleted.

Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/Lectures.imageset/Contents.json

This file was deleted.

Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/Library.imageset/Contents.json

This file was deleted.

Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/MVG.imageset/Contents.json

This file was deleted.

Binary file removed Campus-iOS/Assets.xcassets/MVG.imageset/MVG.pdf
Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/Mensa.imageset/Contents.json

This file was deleted.

Binary file removed Campus-iOS/Assets.xcassets/Mensa.imageset/Mensa.pdf
Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/News.imageset/Contents.json

This file was deleted.

Binary file removed Campus-iOS/Assets.xcassets/News.imageset/News.pdf
Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/RoomFinder.imageset/Contents.json

This file was deleted.

Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/Search.imageset/Contents.json

This file was deleted.

Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/Tuition.imageset/Contents.json

This file was deleted.

Binary file not shown.
12 changes: 0 additions & 12 deletions Campus-iOS/Assets.xcassets/Tum.sexy.imageset/Contents.json

This file was deleted.

Binary file not shown.
11 changes: 11 additions & 0 deletions Campus-iOS/Campus-iOS/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,14 @@
"Week" = "Week";
"Month" = "Month";
"Year" = "Year";

// PersonSearch
"Unable to find person" = "Unable to find person";
"Person Search" = "Person Search";

// Tuition
"Open Amount" = "Offener Betrag";

// LectureSearch
"Lecture Search" = "Lecture Search";
"Unable to find lecture" = "Unable to find lecture";
11 changes: 11 additions & 0 deletions Campus-iOS/Campus-iOS/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,14 @@
"Week" = "Woche";
"Month" = "Monat";
"Year" = "Jahr";

// PersonSearch
"Unable to find person" = "Person kann nicht gefunden werden";
"Person Search" = "Personensuche";

// Tuition
"Open Amount" = "Offener Betrag";

// LectureSearch
"Lecture Search" = "Vorlesungssuche";
"Unable to find lecture" = "Vorlesung kann nicht gefunden werden";
53 changes: 52 additions & 1 deletion Campus-iOS/Enums/Enums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ enum TumCalendarTypes: String, CaseIterable {
}

var calendarType: CalendarType {
switch(self) {
switch self {
case .day:
return CalendarType.day
case .week:
Expand All @@ -37,3 +37,54 @@ enum TumCalendarTypes: String, CaseIterable {
}
}
}

enum Gender: Decodable, Hashable {
case male
case female
case nonBinary
case unkown

init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()

switch try container.decode(String.self) {
case "M", "m": self = .male
case "F", "f": self = .female
default: self = .unkown
}
}
}

enum ContactInfo {
case phone(String)
case mobilePhone(String)
case fax(String)
case additionalInfo(String)
case homepage(String)

init?(key: String, value: String) {
guard !value.isEmpty else { return nil }
switch key {
case "telefon": self = .phone(value)
case "mobiltelefon": self = .mobilePhone(value)
case "fax": self = .fax(value)
case "zusatz_info": self = .additionalInfo(value)
case "www_homepage": self = .homepage(value)
default: return nil
}
}
}

enum Role: String {
case student = "student"
case extern = "extern"
case employee = "employee"

var localizedDesription: String {
switch self {
case .student: return "Student".localized
case .extern: return "Extern".localized
case .employee: return "Employee".localized
}
}
}
5 changes: 3 additions & 2 deletions Campus-iOS/GradesComponent/Views/GradeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import SwiftUI

struct GradeView: View {
@Environment(\.colorScheme) var colorScheme

var grade: Grade

Expand All @@ -31,7 +30,7 @@ struct GradeView: View {
VStack(alignment: .leading, spacing: 8) {
Text(grade.title)
.fontWeight(.bold)
.foregroundColor(colorScheme == .dark ? Color.white : Color.black)
.foregroundColor(Color(.label))

VStack(alignment: .leading, spacing: 8) {
HStack(spacing: 16) {
Expand Down Expand Up @@ -76,5 +75,7 @@ struct GradeView: View {
struct GradeView_Previews: PreviewProvider {
static var previews: some View {
GradeView(grade: Grade.dummyData.first!)
GradeView(grade: Grade.dummyData.first!)
.preferredColorScheme(.dark)
}
}
9 changes: 9 additions & 0 deletions Campus-iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSContactsUsageDescription</key>
<string>TUM Campus App can add contacts from TUM Online to your address book</string>
<key>UILaunchScreen</key>
<dict>
<key>UIColorName</key>
<string>tumBlue</string>
<key>UIImageName</key>
<string>logo-white</string>
</dict>
<key>NSCalendarsUsageDescription</key>
<string>TODO</string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion Campus-iOS/LectureComponent/Model/Lecture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum LectureComponents {
public var row: [Row]
}

struct Row: Decodable, Identifiable {
struct Row: Decodable, Identifiable, Equatable {
public var id: UInt64
public var lvNumber: UInt64
public var title: String
Expand Down
Loading