Skip to content

Commit e59c492

Browse files
authored
timetable parser change (#31)
1 parent 7bbd9d4 commit e59c492

8 files changed

Lines changed: 1044 additions & 284 deletions

File tree

VITTY/VITTY/Connect/View/ConnectPage.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ struct ConnectPage: View {
149149
selectedTab = 0
150150
}
151151
communityPageViewModel.fetchCircleData(
152-
from: "\(APIConstants.base_url)circles",
152+
from: "\(APIConstants.base_urlv3)circles",
153153
token: authViewModel.loggedInBackendUser?.token ?? "",
154154
loading: true
155155
)
@@ -177,15 +177,15 @@ struct ConnectPage: View {
177177

178178
if communityPageViewModel.circles.isEmpty || !hasLoadedInitialData {
179179
communityPageViewModel.fetchCircleData(
180-
from: "\(APIConstants.base_url)circles",
180+
from: "\(APIConstants.base_urlv3)circles",
181181
token: authViewModel.loggedInBackendUser?.token ?? "",
182182
loading: shouldShowLoading
183183
)
184184
}
185185

186186
if communityPageViewModel.circleRequests.isEmpty || !hasLoadedInitialData {
187187
friendRequestViewModel.fetchFriendRequests(
188-
from: URL(string: "\(APIConstants.base_url)requests/")!,
188+
from: URL(string: "\(APIConstants.base_urlv3)requests/")!,
189189
authToken: authViewModel.loggedInBackendUser?.token ?? "",
190190
loading: shouldShowLoading
191191
)

VITTY/VITTY/Home/View/HomeView.swift

Lines changed: 61 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class CampusUpdateService {
4848
}
4949
}
5050

51-
// MARK: - Campus Selection Dialog
51+
5252
import SwiftUI
5353

5454
struct CampusSelectionDialog: View {
@@ -59,7 +59,6 @@ struct CampusSelectionDialog: View {
5959
@State private var showError: Bool = false
6060
@State private var errorMessage: String = ""
6161

62-
6362
private let campusOptions = [
6463
("VIT Chennai", "chennai"),
6564
("VIT Vellore", "vellore"),
@@ -68,22 +67,26 @@ struct CampusSelectionDialog: View {
6867

6968
var body: some View {
7069
ZStack {
71-
Color.black.opacity(0.4)
70+
Color.black.opacity(0.5)
7271
.ignoresSafeArea()
72+
.onTapGesture {
73+
74+
}
7375

74-
VStack(spacing: 20) {
75-
76+
VStack(spacing: 24) {
77+
// Header Section
7678
VStack(spacing: 8) {
7779
Text("Select Your Campus")
7880
.font(.custom("Poppins-Bold", size: 20))
79-
.foregroundColor(.primary)
81+
.foregroundColor(.white)
8082

8183
Text("Please select your campus to continue")
8284
.font(.custom("Poppins-Regular", size: 14))
83-
.foregroundColor(.secondary)
85+
.foregroundColor(.white.opacity(0.7))
86+
.multilineTextAlignment(.center)
8487
}
8588

86-
89+
8790
VStack(spacing: 12) {
8891
ForEach(campusOptions, id: \.0) { campus in
8992
Button(action: {
@@ -92,23 +95,31 @@ struct CampusSelectionDialog: View {
9295
HStack {
9396
Text(campus.0)
9497
.font(.custom("Poppins-Medium", size: 16))
95-
.foregroundColor(.primary)
98+
.foregroundColor(.white)
9699

97100
Spacer()
98101

99102
if selectedCampus == campus.1 {
100103
Image(systemName: "checkmark.circle.fill")
101-
.foregroundColor(.blue)
104+
.foregroundColor(Color("Accent"))
105+
.font(.system(size: 20))
102106
}
103107
}
104108
.padding(.horizontal, 16)
105-
.padding(.vertical, 12)
109+
.padding(.vertical, 14)
106110
.background(
107-
RoundedRectangle(cornerRadius: 8)
111+
RoundedRectangle(cornerRadius: 12)
108112
.fill(selectedCampus == campus.1 ?
109-
Color.blue.opacity(0.1) : Color.gray.opacity(0.1))
113+
Color("Accent").opacity(0.15) : Color("Secondary").opacity(0.6))
114+
)
115+
.overlay(
116+
RoundedRectangle(cornerRadius: 12)
117+
.stroke(selectedCampus == campus.1 ?
118+
Color("Accent") : Color.clear, lineWidth: 1)
110119
)
111120
}
121+
.buttonStyle(PlainButtonStyle())
122+
.disabled(isUpdating)
112123
}
113124
}
114125

@@ -118,39 +129,61 @@ struct CampusSelectionDialog: View {
118129
.font(.custom("Poppins-Regular", size: 12))
119130
.foregroundColor(.red)
120131
.padding(.horizontal)
132+
.multilineTextAlignment(.center)
121133
}
122134

123-
124-
HStack(spacing: 16) {
125-
Button("Update") {
135+
136+
if isUpdating {
137+
ProgressView()
138+
.progressViewStyle(CircularProgressViewStyle(tint: .white))
139+
.scaleEffect(1.2)
140+
}
141+
142+
143+
HStack(spacing: 12) {
144+
145+
Button("Skip for now") {
146+
isPresented = false
147+
}
148+
.disabled(isUpdating)
149+
.padding(.horizontal, 20)
150+
.padding(.vertical, 12)
151+
.background(
152+
RoundedRectangle(cornerRadius: 10)
153+
.fill(Color("Secondary").opacity(0.8))
154+
)
155+
.foregroundColor(.white.opacity(0.8))
156+
.font(.custom("Poppins-Medium", size: 14))
157+
158+
159+
Button("Update Campus") {
126160
Task {
127161
await updateCampus()
128162
}
129163
}
130164
.disabled(selectedCampus.isEmpty || isUpdating)
131-
.padding(.horizontal, 32)
165+
.padding(.horizontal, 20)
132166
.padding(.vertical, 12)
133167
.background(
134-
RoundedRectangle(cornerRadius: 8)
168+
RoundedRectangle(cornerRadius: 10)
135169
.fill(selectedCampus.isEmpty || isUpdating ?
136-
Color.gray.opacity(0.3) : Color.blue)
170+
Color.gray.opacity(0.3) : Color("Accent"))
137171
)
138172
.foregroundColor(.white)
139-
.font(.custom("Poppins-Medium", size: 16))
140-
}
141-
142-
if isUpdating {
143-
ProgressView()
144-
.progressViewStyle(CircularProgressViewStyle())
173+
.font(.custom("Poppins-Medium", size: 14))
145174
}
175+
.padding(.top, 8)
146176
}
147177
.padding(24)
148178
.background(
149-
RoundedRectangle(cornerRadius: 16)
150-
.fill(Color(UIColor.systemBackground))
179+
RoundedRectangle(cornerRadius: 20)
180+
.fill(Color("Background"))
181+
.shadow(color: .black.opacity(0.3), radius: 20, x: 0, y: 10)
151182
)
152-
.padding(.horizontal, 40)
183+
.padding(.horizontal, 32)
153184
}
185+
.animation(.easeInOut(duration: 0.3), value: isUpdating)
186+
.animation(.easeInOut(duration: 0.3), value: showError)
154187
}
155188

156189
private func updateCampus() async {
@@ -168,7 +201,6 @@ struct CampusSelectionDialog: View {
168201
token: token
169202
)
170203

171-
172204
DispatchQueue.main.async {
173205
authViewModel.updateUserCampus(selectedCampus)
174206
isPresented = false

VITTY/VITTY/Settings/View/SettingsView.swift

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct SettingsView: View {
88
@Query private var timeTables: [TimeTable]
99

1010
@StateObject private var viewModel = SettingsViewModel()
11-
@StateObject private var settingsTipManager = SettingsTipManager()
11+
@StateObject private var settingsTipManager = SettingsTipManager()
1212

1313
@State private var showDaySelection = false
1414
@State private var selectedDay: String? = nil
@@ -160,8 +160,35 @@ struct SettingsView: View {
160160
}
161161

162162
SettingsSectionView(title: "About") {
163-
AboutLinkView(image: "github-icon", title: "GitHub Repository", url: URL(string: "https://github.com/GDGVIT/vitty-ios"))
164-
AboutLinkView(image: "gdsc-logo", title: "GDSC VIT", url: URL(string: "https://dscvit.com/"))
163+
VStack(alignment: .leading, spacing: 12) {
164+
AboutLinkView(image: "github-icon", title: "GitHub Repository", url: URL(string: "https://github.com/GDGVIT/vitty-ios"))
165+
AboutLinkView(image: "gdsc-logo", title: "GDSC VIT", url: URL(string: "https://dscvit.com/"))
166+
167+
// Support Email
168+
HStack(spacing: 12) {
169+
Image(systemName: "envelope.fill")
170+
.foregroundColor(.white)
171+
.frame(width: 30, height: 30)
172+
173+
VStack(alignment: .leading, spacing: 4) {
174+
Text("Support")
175+
.font(.system(size: 15, weight: .semibold))
176+
.foregroundColor(.white)
177+
178+
Text("dscvit.vitty@gmail.com")
179+
.font(.system(size: 12))
180+
.foregroundColor(.gray.opacity(0.8))
181+
}
182+
183+
Spacer()
184+
}
185+
.padding(.vertical, 6)
186+
.onTapGesture {
187+
if let url = URL(string: "mailto:dscvit.vitty@gmail.com") {
188+
UIApplication.shared.open(url)
189+
}
190+
}
191+
}
165192
}
166193
}
167194
.scrollContentBackground(.hidden)
@@ -842,6 +869,7 @@ struct DeleteUserAlert: View {
842869
}
843870
}
844871

872+
845873
struct SyncAlert: View {
846874
let message: String
847875
let isSuccess: Bool

0 commit comments

Comments
 (0)