Skip to content
Merged

V3 #25

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
36 changes: 0 additions & 36 deletions VITTY/GoogleService-Info.plist

This file was deleted.

16 changes: 11 additions & 5 deletions VITTY/VITTY.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
4B183EEA2D7C793800C9D801 /* RemindersData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B183EE92D7C791400C9D801 /* RemindersData.swift */; };
4B183EEC2D7CB15800C9D801 /* CourseRefs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B183EEB2D7CB11500C9D801 /* CourseRefs.swift */; };
4B1BDBCC2E1396B1008C2DE9 /* ToolTip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B1BDBCB2E1396A9008C2DE9 /* ToolTip.swift */; };
4B2D648F2E20BA6300412CB7 /* NetworkMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B2D648E2E20BA5A00412CB7 /* NetworkMonitor.swift */; };
4B2D64902E20BA6300412CB7 /* NetworkMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B2D648E2E20BA5A00412CB7 /* NetworkMonitor.swift */; };
4B2D64922E20C1AC00412CB7 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4B2D64912E20C1AC00412CB7 /* GoogleService-Info.plist */; };
4B2DD6952E0A703300BC3B67 /* CircleRequests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B2DD6942E0A702D00BC3B67 /* CircleRequests.swift */; };
4B341C0E2E1802910073906B /* FreindRequestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B341C0D2E18028A0073906B /* FreindRequestModel.swift */; };
4B341C102E1803070073906B /* FreindRequestViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B341C0F2E1802FC0073906B /* FreindRequestViewModel.swift */; };
Expand All @@ -37,7 +40,6 @@
4B37F1E92E04173A00DCEE5F /* SettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B37F1E82E04173500DCEE5F /* SettingsViewModel.swift */; };
4B40FE5D2E0A917F000BDD07 /* QrCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B40FE5C2E0A9179000BDD07 /* QrCode.swift */; };
4B47CD7B2D7DCB8B00A46FEF /* CreateReminder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B47CD7A2D7DCB8400A46FEF /* CreateReminder.swift */; };
4B4FCF632D317AFD002B392C /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4B4FCF622D317AFD002B392C /* GoogleService-Info.plist */; };
4B5977472DF97D5C009CC224 /* RemainderModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B5977462DF97D5A009CC224 /* RemainderModel.swift */; };
4B5977482DFAC034009CC224 /* RemainderModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B5977462DF97D5A009CC224 /* RemainderModel.swift */; };
4B74D8732E0BDF2100B390E9 /* CourseFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B74D8722E0BDF1E00B390E9 /* CourseFile.swift */; };
Expand Down Expand Up @@ -190,6 +192,8 @@
4B183EE92D7C791400C9D801 /* RemindersData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemindersData.swift; sourceTree = "<group>"; };
4B183EEB2D7CB11500C9D801 /* CourseRefs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseRefs.swift; sourceTree = "<group>"; };
4B1BDBCB2E1396A9008C2DE9 /* ToolTip.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolTip.swift; sourceTree = "<group>"; };
4B2D648E2E20BA5A00412CB7 /* NetworkMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkMonitor.swift; sourceTree = "<group>"; };
4B2D64912E20C1AC00412CB7 /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
4B2DD6942E0A702D00BC3B67 /* CircleRequests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircleRequests.swift; sourceTree = "<group>"; };
4B341C0D2E18028A0073906B /* FreindRequestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FreindRequestModel.swift; sourceTree = "<group>"; };
4B341C0F2E1802FC0073906B /* FreindRequestViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FreindRequestViewModel.swift; sourceTree = "<group>"; };
Expand All @@ -199,7 +203,6 @@
4B37F1E82E04173500DCEE5F /* SettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewModel.swift; sourceTree = "<group>"; };
4B40FE5C2E0A9179000BDD07 /* QrCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QrCode.swift; sourceTree = "<group>"; };
4B47CD7A2D7DCB8400A46FEF /* CreateReminder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateReminder.swift; sourceTree = "<group>"; };
4B4FCF622D317AFD002B392C /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
4B5977462DF97D5A009CC224 /* RemainderModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemainderModel.swift; sourceTree = "<group>"; };
4B74D8722E0BDF1E00B390E9 /* CourseFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseFile.swift; sourceTree = "<group>"; };
4B74D8762E0BF77400B390E9 /* Alerts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Alerts.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -401,7 +404,7 @@
isa = PBXGroup;
children = (
4BC853C52DF6F71B0092B2E2 /* VittyWidgetExtension.entitlements */,
4B4FCF622D317AFD002B392C /* GoogleService-Info.plist */,
4B2D64912E20C1AC00412CB7 /* GoogleService-Info.plist */,
52EE849D2CB9CD1F00CD864C /* GoogleService-Info.plist */,
5251A7FF2B46E3C000D44CFE /* .swift-format */,
314A408E27383BEC0058082F /* VITTYApp.swift */,
Expand Down Expand Up @@ -865,6 +868,7 @@
528CF1712B769AF2007298A0 /* Models */ = {
isa = PBXGroup;
children = (
4B2D648E2E20BA5A00412CB7 /* NetworkMonitor.swift */,
528CF1722B769B18007298A0 /* TimeTable.swift */,
);
path = Models;
Expand Down Expand Up @@ -1096,7 +1100,7 @@
31128CFA2772F57E0084C9EA /* Poppins-SemiBoldItalic.ttf in Resources */,
31128CFC2772F57E0084C9EA /* Poppins-Regular.ttf in Resources */,
52EE849E2CB9CD1F00CD864C /* GoogleService-Info.plist in Resources */,
4B4FCF632D317AFD002B392C /* GoogleService-Info.plist in Resources */,
4B2D64922E20C1AC00412CB7 /* GoogleService-Info.plist in Resources */,
314A409627383BEE0058082F /* Preview Assets.xcassets in Resources */,
314A409327383BEE0058082F /* Assets.xcassets in Resources */,
);
Expand All @@ -1123,6 +1127,7 @@
4B7DA5DF2D7094E8007354A3 /* Academics.swift in Sources */,
4B341C0E2E1802910073906B /* FreindRequestModel.swift in Sources */,
4B7DA5F22D7228F9007354A3 /* JoinGroup.swift in Sources */,
4B2D648F2E20BA6300412CB7 /* NetworkMonitor.swift in Sources */,
524B842F2B46EBBD006D18BD /* HomeView.swift in Sources */,
527E3E082B7662920086F23D /* TimeTableView.swift in Sources */,
524B843A2B46F5C6006D18BD /* AddFriendsView.swift in Sources */,
Expand Down Expand Up @@ -1213,6 +1218,7 @@
files = (
4B5977482DFAC034009CC224 /* RemainderModel.swift in Sources */,
4BC853C42DF6DA7A0092B2E2 /* TimeTable.swift in Sources */,
4B2D64902E20BA6300412CB7 /* NetworkMonitor.swift in Sources */,
4B74D8732E0BDF2100B390E9 /* CourseFile.swift in Sources */,
4B74D8732E0BDF2100B390E9 /* CourseFile.swift in Sources */,
);
Expand Down Expand Up @@ -1264,7 +1270,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
Expand Down
7 changes: 4 additions & 3 deletions VITTY/VITTY/Auth/ViewModels/AuthViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class AuthViewModel: NSObject, ASAuthorizationControllerDelegate {
token: backendUser.token,
username: backendUser.username
)

print("this is the log need to check \(backendUser)")

UserDefaults.standard.set(backendUser.token, forKey: UserDefaultKeys.tokenKey)
UserDefaults.standard.set(backendUser.username, forKey: UserDefaultKeys.usernameKey)
Expand Down Expand Up @@ -271,8 +271,9 @@ class AuthViewModel: NSObject, ASAuthorizationControllerDelegate {
if let firebaseUser = self.loggedInFirebaseUser {
await checkBackendUserExists(uuid: firebaseUser.uid,url: APIConstants.base_url)
}





}

private func signInWithApple() {
Expand Down
2 changes: 1 addition & 1 deletion VITTY/VITTY/Connect/View/Circles/View/Circles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
//
// Created by Rujin Devkota on 2/27/25.
//
import SwiftUI

import SwiftUI


struct CirclesView: View {
@Binding var isCreatingGroup: Bool
@State private var searchText = ""
Expand Down
49 changes: 41 additions & 8 deletions VITTY/VITTY/Connect/ViewModel/CommunityPageViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ class CommunityPageViewModel {
let detail: String
}


func createCircle(name: String, token: String, completion: @escaping (Result<String, Error>) -> Void) {

guard let encodedName = name.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else {
Expand All @@ -390,27 +391,59 @@ class CommunityPageViewModel {
case .success(let data):
if data.detail.lowercased().contains("successfully") {
self.logger.info("Successfully created circle: \(name)")
completion(.success(name))

// Now fetch the updated circles data and wait for completion
self.fetchCircleDataWithCompletion(
from: "\(APIConstants.base_url)circles",
token: token,
circleName: name,
completion: completion
)

} else {
let error = NSError(domain: "CreateCircleError", code: 1, userInfo: [NSLocalizedDescriptionKey: data.detail])
self.logger.error("Error creating circle: \(data.detail)")
completion(.failure(error))
}


self.fetchCircleData(
from: "\(APIConstants.base_url)circles",
token: token,
loading: false
)

case .failure(let error):
self.logger.error("Error creating circle: \(error)")
completion(.failure(error))
}
}
}
}


private func fetchCircleDataWithCompletion(from url: String, token: String, circleName: String, completion: @escaping (Result<String, Error>) -> Void) {

AF.request(url, method: .get, headers: ["Authorization": "Token \(token)"])
.validate()
.responseDecodable(of: CircleResponse.self) { response in
DispatchQueue.main.async {
switch response.result {
case .success(let data):
self.circles = data.data
self.errorCircle = false
print("Successfully fetched circles after creation: \(data.data)")


if let createdCircle = self.circles.first(where: { $0.circleName == circleName }) {
print("Found created circle with ID: \(createdCircle.circleID)")
completion(.success(createdCircle.circleID))
} else {
let error = NSError(domain: "CreateCircleError", code: 2, userInfo: [NSLocalizedDescriptionKey: "Could not find created circle in updated data"])
self.logger.error("Could not find created circle: \(circleName)")
completion(.failure(error))
}

case .failure(let error):
self.logger.error("Error fetching circles after creation: \(error)")
completion(.failure(error))
}
}
}
}

func sendCircleInvitation(circleId: String, username: String, token: String, completion: @escaping (Bool) -> Void) {

Expand Down
4 changes: 2 additions & 2 deletions VITTY/VITTY/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<string>Google SignIn</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.272763363329-i8n51oo9m30h9it7qq9ufmd0lahnmm63</string>
<string>com.googleusercontent.apps.266303676876-77duk9tr18717lspccrvjuqcnuv0dp2s</string>
</array>
</dict>
<dict>
Expand All @@ -30,7 +30,7 @@
<key>FirebaseAppDelegateProxyEnabled</key>
<false/>
<key>GIDClientID</key>
<string>272763363329-i8n51oo9m30h9it7qq9ufmd0lahnmm63.apps.googleusercontent.com</string>
<string>266303676876-77duk9tr18717lspccrvjuqcnuv0dp2s.apps.googleusercontent.com</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>comgooglemaps</string>
Expand Down
Loading
Loading