-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/#2 recruit feed view1
- Loading branch information
Showing
106 changed files
with
1,355 additions
and
142 deletions.
There are no files selected for viewing
261 changes: 154 additions & 107 deletions
261
project02-teamB-OUR-consumer/project02-teamB-OUR-consumer.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
.../project02-teamB-OUR-consumer/Model/ThirdTapModel/RecruitStudyModel/SharedViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// SharedViewModel.swift | ||
// project02-teamB-OUR-consumer | ||
// | ||
// Created by 박서연 on 2023/08/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
class SharedViewModel: ObservableObject { | ||
@Published var selectedLocality: String = "" | ||
} | ||
|
File renamed without changes.
42 changes: 42 additions & 0 deletions
42
...roject02-teamB-OUR-consumer/Model/ThirdTapModel/RecruitStudyModel/StudyRecruitModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// StudyRecruitModel.swift | ||
// project02-teamB-OUR-consumer | ||
// | ||
// Created by 박서연 on 2023/08/24. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
struct StudyRecruitModel { | ||
var id: String = UUID().uuidString | ||
var creator: String | ||
var studyTitle: String | ||
|
||
var startAt: Date | ||
var dueAt: Date | ||
|
||
var description: String | ||
var isOnline: Bool | ||
var isOffline: Bool | ||
|
||
var imageURL: [String] | ||
var locationName: String // 이름 | ||
var reportCount: Int // 신고 횟수 | ||
|
||
|
||
private static let dateFormatter: DateFormatter = { | ||
let formatter = DateFormatter() | ||
formatter.dateFormat = "yy년 M월 dd일 HH:mm" | ||
return formatter | ||
}() | ||
|
||
var startDate: String { | ||
return StudyRecruitModel.dateFormatter.string(from: startAt) | ||
} | ||
|
||
var dueDate: String { | ||
return StudyRecruitModel.dateFormatter.string(from: dueAt) | ||
} | ||
|
||
} |
82 changes: 82 additions & 0 deletions
82
...roject02-teamB-OUR-consumer/Model/ThirdTapModel/RecruitStudyModel/StudyRecruitStore.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// | ||
// AddRecruitStore.swift | ||
// project02-teamB-OUR-consumer | ||
// | ||
// Created by 박서연 on 2023/08/24. | ||
// | ||
|
||
import Foundation | ||
import FirebaseFirestore | ||
import FirebaseFirestoreSwift | ||
|
||
class StudyRecruitStore: ObservableObject { | ||
|
||
@Published var studyStores: [StudyRecruitModel] = [] | ||
|
||
let dbRef = Firestore.firestore().collection("StudyPosts") | ||
|
||
func fetchFeeds() { | ||
|
||
dbRef.getDocuments { (snapshot, error) in | ||
|
||
self.studyStores.removeAll() | ||
|
||
if let snapshot { | ||
var tempStudys: [StudyRecruitModel] = [] | ||
|
||
for document in snapshot.documents { | ||
|
||
|
||
let id: String = document.documentID | ||
let docData: [String: Any] = document.data() | ||
let creator: String = docData["creator"] as? String ?? "" | ||
let studyTitle: String = docData["studyTitle"] as? String ?? "" | ||
|
||
let description: String = docData["description"] as? String ?? "" | ||
let isOnline: Bool = docData["isOnline"] as? Bool ?? false | ||
let isOffline: Bool = docData["isOffline"] as? Bool ?? false | ||
|
||
let imageURL: [String] = docData["imageURL"] as? [String] ?? [] | ||
let locationName: String = docData["locationName"] as? String ?? "" | ||
let reportCount: Int = docData["reportCount"] as? Int ?? 0 | ||
|
||
let startAt: Date = docData["startAt"] as? Date ?? Date() | ||
let dueAt: Date = docData["dueAt"] as? Date ?? Date() | ||
|
||
let studys = StudyRecruitModel(id: id, creator: creator, studyTitle: studyTitle, startAt: startAt, dueAt: dueAt, description: description, isOnline: isOnline, isOffline: isOffline, imageURL: imageURL, locationName: locationName, reportCount: reportCount) | ||
tempStudys.append(studys) | ||
} | ||
|
||
self.studyStores = tempStudys | ||
} | ||
} | ||
} | ||
|
||
func addFeed(_ study: StudyRecruitModel) { | ||
|
||
dbRef.document(study.id) | ||
.setData(["creator": study.creator, | ||
"description": study.description, | ||
"imageURL": study.imageURL, | ||
"locationName": study.locationName, | ||
"isOnline": study.isOnline, | ||
"isOffline": study.isOffline, | ||
"startAt": study.startAt, | ||
"dueAt": study.dueAt, | ||
"studyTitle": study.studyTitle, | ||
"reportCount": study.reportCount]) | ||
|
||
fetchFeeds() | ||
} | ||
|
||
|
||
func removeFeed(_ study: StudyRecruitModel) { | ||
|
||
dbRef.document(study.id).delete() | ||
|
||
fetchFeeds() | ||
} | ||
|
||
|
||
|
||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
67 changes: 67 additions & 0 deletions
67
...amB-OUR-consumer/project02-teamB-OUR-consumer/Views/SecondTapView/LocationSheetView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// LocationSheetView.swift | ||
// project02-teamB-OUR-consumer | ||
// | ||
// Created by 여성은 on 2023/08/22. | ||
// | ||
|
||
import SwiftUI | ||
import MapKit | ||
|
||
struct Annotation: Identifiable { | ||
var id: UUID = UUID() | ||
let coordinate: CLLocationCoordinate2D | ||
} | ||
|
||
struct LocationSheetView: View { | ||
|
||
@Binding var isShowingLocationSheet: Bool | ||
|
||
var locationName: String = "광화문역 사거리" | ||
|
||
var locationCoordinate: CLLocationCoordinate2D | ||
|
||
//locationCoordinate 여기서 안받아오면 region에 바로 쓸 수 있으려나!? | ||
@State private var region = MKCoordinateRegion( | ||
center: CLLocationCoordinate2D(latitude: 37.5718, | ||
longitude: 126.9769), | ||
span: MKCoordinateSpan(latitudeDelta: 0.008, longitudeDelta: 0.008)) | ||
|
||
var body: some View { | ||
|
||
NavigationStack { | ||
HStack { | ||
Image(systemName: "mappin.and.ellipse") | ||
Text("\(locationName)") | ||
.fontWeight(.heavy) | ||
Spacer() | ||
} | ||
.navigationTitle("모임 장소 위치") | ||
.navigationBarTitleDisplayMode(.inline) | ||
.toolbar { | ||
ToolbarItem(placement: .navigationBarTrailing) { | ||
Button { | ||
isShowingLocationSheet = false | ||
} label: { | ||
Image(systemName: "xmark") | ||
} | ||
} | ||
} | ||
|
||
Map(coordinateRegion: $region, | ||
annotationItems: [Annotation(coordinate: locationCoordinate)]) { annotation in | ||
MapMarker(coordinate: annotation.coordinate) | ||
} | ||
.frame(height: 250) | ||
|
||
|
||
} | ||
.padding() | ||
} | ||
} | ||
|
||
struct LocationSheetView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
LocationSheetView(isShowingLocationSheet: .constant(false), locationCoordinate: CLLocationCoordinate2D(latitude: 37.5718, longitude: 126.9769)) | ||
} | ||
} |
97 changes: 97 additions & 0 deletions
97
...UR-consumer/project02-teamB-OUR-consumer/Views/SecondTapView/StudyCommentReportView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// | ||
// StudyCommentReportView.swift | ||
// project02-teamB-OUR-consumer | ||
// | ||
// Created by 여성은 on 2023/08/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct StudyCommentReportView: View { | ||
|
||
@Environment(\.dismiss) private var dismiss | ||
@Environment(\.presentationMode) var mode: Binding<PresentationMode> | ||
|
||
var userId: String | ||
var comment: StudyComment | ||
|
||
//신고유형들 쭈루룩 | ||
let reports: [String] = ["스팸","사기 또는 거짓", "혐오 발언 또는 상징", "계정이 해킹당 했을 수 있음"] | ||
|
||
@State var showAlert: Bool = false | ||
@State var reportCategory: String = "" | ||
|
||
@Binding var isEditing: Bool | ||
|
||
var body: some View { | ||
NavigationStack { | ||
Divider() | ||
VStack(alignment: .leading) { | ||
Text("신고하는 댓글") | ||
.fontWeight(.heavy) | ||
StudyReplyDetailView(isEditing: $isEditing, userId: "성은", comment: comment) | ||
.padding(10) | ||
.overlay( | ||
RoundedRectangle(cornerRadius: 20) | ||
.stroke(Color.gray, lineWidth: 0.5) | ||
) | ||
|
||
} | ||
|
||
Divider() | ||
|
||
Form { | ||
Text("신고하는 이유") | ||
.fontWeight(.heavy) | ||
.padding([.bottom, .top], 5) | ||
ForEach(reports, id: \.self) { report in | ||
|
||
Button { | ||
reportCategory = report | ||
showAlert = true | ||
} label: { | ||
Text("\(report)") | ||
.padding(.bottom, 5) | ||
|
||
} | ||
.foregroundColor(.black) | ||
Divider() | ||
|
||
} | ||
} | ||
.formStyle(.columns) | ||
|
||
|
||
|
||
|
||
Spacer() | ||
} | ||
.navigationTitle("신고하기") | ||
.navigationBarTitleDisplayMode(.inline) | ||
.navigationBarBackButtonHidden(true) | ||
.navigationBarItems(leading: Button(action : { | ||
self.mode.wrappedValue.dismiss() | ||
}){ | ||
Image(systemName: "chevron.backward") | ||
}) | ||
.padding() | ||
.alert(isPresented: $showAlert) { | ||
Alert(title: Text("신고하시겠습니까?"), | ||
message: Text("\"\(reportCategory)\" 사유로 신고합니다"), | ||
primaryButton: .destructive(Text("신고하기")) { | ||
print(reportCategory) | ||
dismiss()//뷰 닫기 | ||
//신고관련된 함수넣기 | ||
}, | ||
secondaryButton: .cancel(Text("취소"))) | ||
} | ||
} | ||
} | ||
|
||
struct StudyCommentReportView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
NavigationStack{ | ||
StudyCommentReportView(userId: "성은", comment: StudyComment(userId: "성은", content: "최악의 스터디 소개글이네여 ;;"), isEditing: .constant(true)) | ||
} | ||
} | ||
} |
Oops, something went wrong.