Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/yale-swe/f23-here
Browse files Browse the repository at this point in the history
  • Loading branch information
phucd5 committed Nov 9, 2023
2 parents d64c462 + 3a48015 commit 417cdba
Show file tree
Hide file tree
Showing 15 changed files with 461 additions and 109 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ server/node_modules
app/newHere1/newHere.xcodeproj/xcuserdata/*
app/newHere1/newHere.xcodeproj/xcshareddata/*
app/newHere1/newHere.xcodeproj/project.xcworkspace/xcuserdata
.DS_Store
app/newHere1/newHere.xcodeproj/project.pbxproj
Binary file modified app/.DS_Store
Binary file not shown.
Binary file modified app/newHere1/.DS_Store
Binary file not shown.
35 changes: 18 additions & 17 deletions app/newHere1/newHere.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
1506543B2AF8484A004C7909 /* api_call.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1506543A2AF84849004C7909 /* api_call.swift */; };
1531A8DE2AED95FD009F644E /* newHereApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1531A8DD2AED95FD009F644E /* newHereApp.swift */; };
1531A8E02AED95FD009F644E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1531A8DF2AED95FD009F644E /* ContentView.swift */; };
1531A8E22AED95FF009F644E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1531A8E12AED95FF009F644E /* Assets.xcassets */; };
Expand All @@ -22,6 +21,7 @@
1531A9132AEDAE2A009F644E /* LocationDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1531A9122AEDAE2A009F644E /* LocationDataManager.swift */; };
1531A9152AEDCADB009F644E /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1531A9142AEDCADB009F644E /* Message.swift */; };
15582E372AFB1544003910A2 /* Registration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15582E362AFB1544003910A2 /* Registration.swift */; };
15582E392AFB2659003910A2 /* Friends.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15582E382AFB2659003910A2 /* Friends.swift */; };
1562EDE82AF6EA2B00A41779 /* CustomARView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1562EDE62AF6EA2B00A41779 /* CustomARView.swift */; };
1562EDE92AF6EA2B00A41779 /* CustomARViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1562EDE72AF6EA2B00A41779 /* CustomARViewRepresentable.swift */; };
/* End PBXBuildFile section */
Expand All @@ -44,7 +44,6 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
1506543A2AF84849004C7909 /* api_call.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = api_call.swift; sourceTree = "<group>"; };
1531A8DA2AED95FD009F644E /* newHere.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = newHere.app; sourceTree = BUILT_PRODUCTS_DIR; };
1531A8DD2AED95FD009F644E /* newHereApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = newHereApp.swift; sourceTree = "<group>"; };
1531A8DF2AED95FD009F644E /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand All @@ -63,6 +62,7 @@
1531A9122AEDAE2A009F644E /* LocationDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationDataManager.swift; sourceTree = "<group>"; };
1531A9142AEDCADB009F644E /* Message.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = "<group>"; };
15582E362AFB1544003910A2 /* Registration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Registration.swift; sourceTree = "<group>"; };
15582E382AFB2659003910A2 /* Friends.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Friends.swift; sourceTree = "<group>"; };
1562EDE62AF6EA2B00A41779 /* CustomARView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomARView.swift; sourceTree = "<group>"; };
1562EDE72AF6EA2B00A41779 /* CustomARViewRepresentable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomARViewRepresentable.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -118,14 +118,14 @@
1531A8DD2AED95FD009F644E /* newHereApp.swift */,
1531A8DF2AED95FD009F644E /* ContentView.swift */,
1531A9082AED9618009F644E /* Home.swift */,
1562EDE62AF6EA2B00A41779 /* CustomARView.swift */,
1562EDE72AF6EA2B00A41779 /* CustomARViewRepresentable.swift */,
1531A90C2AED9663009F644E /* Messages.swift */,
71D79D8B2AFB3BA9009A054C /* CustomARView.swift */,
1531A90A2AED964A009F644E /* Profile.swift */,
15582E382AFB2659003910A2 /* Friends.swift */,
1531A90E2AED9917009F644E /* Post.swift */,
15582E362AFB1544003910A2 /* Registration.swift */,
1506543A2AF84849004C7909 /* api_call.swift */,
1531A9142AEDCADB009F644E /* Message.swift */,
71D79D8D2AFB3BBA009A054C /* Registration.swift */,
71D79D892AFB3AEE009A054C /* LoginView.swift */,
1531A9122AEDAE2A009F644E /* LocationDataManager.swift */,
1531A8E12AED95FF009F644E /* Assets.xcassets */,
1531A8E32AED95FF009F644E /* newHere.entitlements */,
Expand Down Expand Up @@ -289,14 +289,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
71D79D8C2AFB3BA9009A054C /* CustomARView.swift in Sources */,
71D79D8E2AFB3BBA009A054C /* Registration.swift in Sources */,
1531A9132AEDAE2A009F644E /* LocationDataManager.swift in Sources */,
1531A8E02AED95FD009F644E /* ContentView.swift in Sources */,
1531A90B2AED964A009F644E /* Profile.swift in Sources */,
15582E392AFB2659003910A2 /* Friends.swift in Sources */,
1531A90D2AED9663009F644E /* Messages.swift in Sources */,
15582E372AFB1544003910A2 /* Registration.swift in Sources */,
1562EDE82AF6EA2B00A41779 /* CustomARView.swift in Sources */,
1506543B2AF8484A004C7909 /* api_call.swift in Sources */,
1562EDE92AF6EA2B00A41779 /* CustomARViewRepresentable.swift in Sources */,
1531A90F2AED9917009F644E /* Post.swift in Sources */,
1531A9152AEDCADB009F644E /* Message.swift in Sources */,
1531A9092AED9618009F644E /* Home.swift in Sources */,
Expand Down Expand Up @@ -457,15 +456,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = newHere/newHere.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"newHere/Preview Content\"";
DEVELOPMENT_TEAM = A7X36A78B2;
DEVELOPMENT_TEAM = ACLZN9M2VC;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_LSApplicationCategoryType = "";
INFOPLIST_KEY_NSCameraUsageDescription = "Here needs access to your camera.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Here needs to access your location data to tell you your location";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
Expand All @@ -477,13 +476,14 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 16.6;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.eric.newHere;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -498,10 +498,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = newHere/newHere.entitlements;
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"newHere/Preview Content\"";
DEVELOPMENT_TEAM = A7X36A78B2;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -525,6 +525,7 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.eric.newHere;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -540,7 +541,7 @@
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = A7X36A78B2;
DEVELOPMENT_TEAM = ACLZN9M2VC;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
MACOSX_DEPLOYMENT_TARGET = 14.0;
Expand Down Expand Up @@ -585,7 +586,7 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = A7X36A78B2;
DEVELOPMENT_TEAM = ACLZN9M2VC;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
MACOSX_DEPLOYMENT_TARGET = 14.0;
Expand Down
10 changes: 8 additions & 2 deletions app/newHere1/newHere/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@
import SwiftUI

struct ContentView: View {
@State private var isAuthenticated = false
@State private var isRegistered = false
@ObservedObject var locationDataManager = LocationDataManager()

// testing
@State var friendsPresented = true
@State var userId = "653d51478ff5b3c9ace45c26"

var body: some View {
if isRegistered {
if isAuthenticated {
// NavigationView {
HomePageView()
.environmentObject(locationDataManager)

// }
} else {
RegistrationView(isRegistered: $isRegistered)
LoginView(isAuthenticated: $isAuthenticated)
// RegistrationView(isRegistered: $isRegistered)
}
// HomePageView()
// .environmentObject(locationDataManager)
Expand Down
2 changes: 1 addition & 1 deletion app/newHere1/newHere/CustomARViewRepresentable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct CustomARViewRepresentable: UIViewRepresentable {

// Define the range of random positions for x, y, and z coordinates
let xRange: ClosedRange<Float> = -3.0...3.0 // Represents a 10-meter width (-5m to +5m)
let yRange: ClosedRange<Float> = -1.5...2.0 // Represents a height range above the ground (0m to +2m)
let yRange: ClosedRange<Float> = -1.0...2.0 // Represents a height range above the ground (0m to +2m)
let zRange: ClosedRange<Float> = -3.0...3.0 // Represents a 10-meter depth (-5m to +5m)

for message in messages {
Expand Down
107 changes: 107 additions & 0 deletions app/newHere1/newHere/Friends.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import SwiftUI

struct Friends: View {
@Binding var isPresented: Bool
@Binding var userId: String

// State to hold the friends list
@State private var friendsList: [String] = []
@State private var errorMessage: String?
@State private var searchText: String = ""

var body: some View {
VStack {

// top bar
HStack {
Spacer()
Button(action: {
isPresented.toggle() // Close the popup
}) {
Text("Close")
.font(.headline)
.padding()
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(10)
}
.padding(.trailing, 20) // Adjust the position of the close button
}

// search bar
HStack {
TextField("Search...", text: $searchText)
.padding(7)
.padding(.horizontal, 25)
.background(Color(.systemGray6))
.cornerRadius(8)
.overlay(
HStack {
Image(systemName: "magnifyingglass")
.foregroundColor(.gray)
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
.padding(.leading, 8)

if !searchText.isEmpty {
Button(action: {
searchText = ""
}) {
Image(systemName: "multiply.circle.fill")
.foregroundColor(.gray)
.padding(.trailing, 8)
}
}
}
)
.autocapitalization(.none)
.keyboardType(.webSearch)

Button(action: {
addFriendByName(userId: userId, friendName: searchText) {
result in
switch result {
case .success(let response):
print("Friend added successfully: \(response)")
case .failure(let error):
print("Error adding friend: \(error.localizedDescription)")
self.errorMessage = error.localizedDescription
}
}

}) {
Text("Add Friend")
.padding(.horizontal, 16)
.padding(.vertical, 8)
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(8)
}
}
.padding()

if let errorMessage = errorMessage {
Text(errorMessage)
} else {
List(friendsList, id: \.self) { friend in
Text(friend)
}
}
}
.onAppear {
getAllUserFriends(userId: userId) { result in
switch result {
case .success(let response):
print("Friends fetched successfully: \(response)")
// self.friendsList = response // Assuming response is [String]

case .failure(let error):
print("Error getting messages: \(error.localizedDescription)")
self.errorMessage = error.localizedDescription
}
}
}
}
}

// Make sure `getAllUserFriends` has a signature similar to this:
// func getAllUserFriends(userId: String, completion: @escaping (Result<[String], Error>) -> Void)
4 changes: 3 additions & 1 deletion app/newHere1/newHere/Home.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ struct HomePageView: View {
@State private var isShowingMessages = false
@State private var isShowingPosts = false

@State var userId = "653d51478ff5b3c9ace45c26"

@EnvironmentObject var locationDataManager: LocationDataManager

@StateObject var messageState = MessageState()
Expand Down Expand Up @@ -101,7 +103,7 @@ struct HomePageView: View {
}
}
.sheet(isPresented: $isShowingProfile) {
ProfilePopup(isPresented: $isShowingProfile) // Pass the binding to control visibility
ProfilePopup(isPresented: $isShowingProfile, userId: $userId) // Pass the binding to control visibility
}
.sheet(isPresented: $isShowingMessages) {
MessagesPopup(isPresented: $isShowingMessages)
Expand Down
Loading

0 comments on commit 417cdba

Please sign in to comment.