Skip to content

Commit

Permalink
[#73] 포트폴리오 공고 구현완료 (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
00yhsp authored Feb 19, 2024
1 parent 6dd6fa4 commit 3734169
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 7 deletions.
8 changes: 7 additions & 1 deletion Spon-us.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@
DF91F4042B4864330021291A /* Portfolio.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF91F4032B4864330021291A /* Portfolio.swift */; };
DFB22ED72B766FF3007903DF /* JoinModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB22ED62B766FF3007903DF /* JoinModel.swift */; };
DFB22ED92B767003007903DF /* JoinViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB22ED82B767003007903DF /* JoinViewModel.swift */; };
DFC5901C2B82D3D700A5B61D /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = DFC5901B2B82D3D700A5B61D /* GoogleService-Info.plist */; };
DFC5901E2B82D88E00A5B61D /* AnnouncementDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFC5901D2B82D88E00A5B61D /* AnnouncementDetailView.swift */; };
DFCD247C2B54D08100B00515 /* PopupView in Frameworks */ = {isa = PBXBuildFile; productRef = DFCD247B2B54D08100B00515 /* PopupView */; };
DFCD24822B5A67FC00B00515 /* DocumentPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFCD24812B5A67FC00B00515 /* DocumentPicker.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -210,7 +212,6 @@
3B81BCBD2B62312C0067E9CB /* Product.storekit */ = {isa = PBXFileReference; lastKnownFileType = text; path = Product.storekit; sourceTree = "<group>"; };
3B81BCBF2B6231680067E9CB /* ProductList.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = ProductList.plist; sourceTree = "<group>"; };
3BA7C0992B82BA1E00654B62 /* ReceivedOfferMyAnnouncementsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceivedOfferMyAnnouncementsViewModel.swift; sourceTree = "<group>"; };
3BA7C09D2B82BCFD00654B62 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../Downloads/GoogleService-Info.plist"; sourceTree = "<group>"; };
3BFC8D142B54AA55000D6006 /* EditPostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditPostView.swift; sourceTree = "<group>"; };
3BFC8D1A2B54D46D000D6006 /* MultiImagePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiImagePicker.swift; sourceTree = "<group>"; };
3BFC8D1E2B5597C9000D6006 /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -261,6 +262,8 @@
DF91F4032B4864330021291A /* Portfolio.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Portfolio.swift; sourceTree = "<group>"; };
DFB22ED62B766FF3007903DF /* JoinModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinModel.swift; sourceTree = "<group>"; };
DFB22ED82B767003007903DF /* JoinViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinViewModel.swift; sourceTree = "<group>"; };
DFC5901B2B82D3D700A5B61D /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../Downloads/GoogleService-Info.plist"; sourceTree = "<group>"; };
DFC5901D2B82D88E00A5B61D /* AnnouncementDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnnouncementDetailView.swift; sourceTree = "<group>"; };
DFCD24812B5A67FC00B00515 /* DocumentPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentPicker.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -505,6 +508,7 @@
children = (
DF91F4032B4864330021291A /* Portfolio.swift */,
DF692B192B7E970F00BF9B75 /* EditAnnouncementView.swift */,
DFC5901D2B82D88E00A5B61D /* AnnouncementDetailView.swift */,
);
path = Portfolio;
sourceTree = "<group>";
Expand Down Expand Up @@ -795,6 +799,7 @@
files = (
3B81BCC02B6231680067E9CB /* ProductList.plist in Resources */,
100D389C2B44833500498977 /* SUIT-Medium.otf in Resources */,
80A25CAA2B828E6800BDDDE4 /* GoogleService-Info.plist in Resources */,
80A25CB02B82D1A700BDDDE4 /* GoogleService-Info.plist in Resources */,
3B81BCBE2B62312C0067E9CB /* Product.storekit in Resources */,
100D38A32B44834700498977 /* Preview Assets.xcassets in Resources */,
Expand Down Expand Up @@ -842,6 +847,7 @@
107D6E692B7A8273005B6261 /* OrganizationModel.swift in Sources */,
DF498F302B7DF50200ADE078 /* LogoutViewModel.swift in Sources */,
8042C38D2B807957003DE096 /* SearchOrganizationModel.swift in Sources */,
DFC5901E2B82D88E00A5B61D /* AnnouncementDetailView.swift in Sources */,
100D38B32B4EF15600498977 /* HomeView.swift in Sources */,
8042C38B2B807946003DE096 /* SearchOrganizationViewModel.swift in Sources */,
DF3AD3DF2B61626300DBFCCC /* OnBoardingView.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Spon-us/SponusAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ extension SponusAPI: TargetType {
let requestBody = JoinRequestBody(name: name, email: email, password: password, organizationType: "STUDENT", suborganizationType: "STUDENT_COUNCIL")
return .requestJSONEncodable(requestBody)
case .studentClub:
let requestBody = JoinRequestBody(name: name, email: email, password: password, organizationType: "STUDENT", suborganizationType: "STUDENT_CLUB")
let requestBody = JoinRequestBody(name: name, email: email, password: password, organizationType: "STUDENT", suborganizationType: "CLUB")
return .requestJSONEncodable(requestBody)
}
case .company:
Expand Down
200 changes: 200 additions & 0 deletions Spon-us/View/Portfolio/AnnouncementDetailView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
//
// MyNoticeDetailView.swift
// Spon-us
//
// Created by 황인성 on 1/25/24.
//

import SwiftUI
import Moya
import Foundation

struct AnnouncementDetailView: View {
@Binding var rootIsActive: Bool
@State var announcementId: Int
@State var popup = false
@State var isCompleted = false
@State var announcementTitle = ""
@State var announcementCategory = ""
@State var announcementType = ""
@State var announcementContent = ""
@State var announcementImages: [URL] = []
@State var proposingID = 0

let provider = MoyaProvider<SponusAPI>(session: Session(interceptor: AuthInterceptor.shared))

var body: some View {
ZStack {
if !isCompleted {
VStack {
Spacer()
ProgressView()
Spacer()
}
}
else {
VStack(spacing: 0) {
// if popup == true{
// Text("popup = true")
// }
ScrollView {
LazyVStack(spacing: 0){

AsyncImageScrollView(imageURLs: announcementImages)

LazyVStack(alignment: .leading, spacing: 0) {
/*
HStack(spacing: 6){
Image("ic_eye_small")
Text("989")
.padding(.trailing, 10)

Image("ic_saved_small")
Text("34")
}
.font(.English16)
.foregroundColor(Color.sponusGrey700)
.frame(maxWidth: .infinity, alignment: .trailing)*/

NavigationLink(destination: Text("더미를 만들어야해요!"), label: {
HStack{
Text("스포대학교 총학생회")
.font(.Body10)
.foregroundColor(Color.sponusPrimary)

Image("ic_go_blue")
.frame(width: 16, height: 16)
}
})
.padding(.top, 23)
.disabled(true)


Text(String(announcementId))
.font(.Heading05)
.padding(.top, 16)


VStack(spacing: 0){

Rectangle()
.fill(Color.sponusGrey200)
.frame(maxWidth: .infinity, maxHeight: 1)
.padding(.top, 16)

HStack(spacing: 0){
HStack{
Text("유형")
.font(.Body10)
.foregroundColor(Color.sponusGrey700)

Spacer()

Text(announcementCategory)
.font(.Body10)
.padding(.trailing, 16)
}
.frame(maxWidth: .infinity)

Rectangle()
.fill(Color.sponusGrey200)
.frame(maxWidth: 1, minHeight: 49)

HStack{
Text("분야")
.font(.Body10)
.foregroundColor(Color.sponusGrey700)
.padding(.leading, 16)
Spacer()
Text(announcementType)
.font(.Body10)
}
.frame(maxWidth: .infinity)
}
Rectangle()
.fill(Color.sponusGrey200)
.frame(maxWidth: .infinity, maxHeight: 1)
}


// Korean/Body/Body10
Text("공고 상세")
.font(.Body10)
.foregroundColor(Color.sponusGrey700)
.padding(.top, 24)

// Korean/Body/Body10
Text(announcementContent)
.font(.Body10)
.foregroundColor(.black)
.padding(.top, 24)

Rectangle()
.fill(Color.sponusGrey200)
.frame(maxWidth: .infinity, maxHeight: 1)
.padding(.top, 24)

}
.padding(.horizontal, 20)
}
.foregroundColor(Color.sponusBlack)
.padding(.bottom, 20)

}

NavigationLink(destination: EditPostView(popup: $popup), label: {
Text("수정하기")
.font(.Body01)
.foregroundColor(Color.sponusPrimaryDarkmode)
.frame(maxWidth: .infinity)
.padding(.top, 20)
.background(Color.sponusBlack)
})
}
.navigationTitle("내 공고").font(.Body01)
.navigationBarTitleDisplayMode(.inline)
.navigationBarBackButtonHidden(true)
.navigationBarItems(leading: CustomBackButton(), trailing: Button(action: {self.rootIsActive = false}, label: {
Image(.icHome)
.renderingMode(.template)
.foregroundStyle(.black)
}))
}
}.onAppear() {
provider.request(.getAnnouncement(announcementId: self.announcementId)) { result in
switch result {
case let .success(response):
do {
let responseBody = try response.map(AnnouncementModel.self)
self.announcementTitle = responseBody.content.title
self.announcementType = changeToKorean(category: responseBody.content.category) ?? "nil"
self.announcementCategory = changeToKorean(type: responseBody.content.type) ?? "nil"
self.announcementContent = responseBody.content.content
for elem in responseBody.content.announcementImages {
if let url = URL(string: elem.url) {
self.announcementImages.append(url)
} else {
print("error")
}
}
self.isCompleted = true
} catch {
print("catch")
}

case let .failure(response):
print("failure")
}

}
}// NavigationView {


// }
}
}


//#Preview {
// MyNoticeDetailView(rootIsActive: .constant(false))
//}
16 changes: 11 additions & 5 deletions Spon-us/View/Portfolio/Portfolio.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ struct Portfolio: View {
@State var activeToProgressingDetail = false
@State var activeToCompletedDetail = false

@State var activeNavLinkToAnnouncement = false

@State private var currentDialogID = 0
@State private var currentProgressingID = 0
@State private var currentProgressingStatus = ""
Expand Down Expand Up @@ -212,9 +214,10 @@ struct Portfolio: View {
VStack(alignment: .leading, spacing: 0) {
ForEach(myAnnouncementsViewModel.myAnnouncementsContents, id: \.id) { cell in
if cell.status == "OPENED" {
NavigationLink(
destination: MyNoticeDetailView(rootIsActive: $rootIsActive),
label: {
Button {
currentDialogID = cell.id
activeNavLinkToAnnouncement = true
} label: {
VStack(spacing: 0) {
HStack(spacing: 0) {
AsyncImageView(url: URL(string: cell.mainImage.url))
Expand Down Expand Up @@ -351,7 +354,7 @@ struct Portfolio: View {
Divider().backgroundStyle(.sponusGrey200).padding(.top, 16)
}.frame(maxWidth: .infinity, maxHeight: .infinity)
}
)

}
}
}
Expand Down Expand Up @@ -635,6 +638,9 @@ struct Portfolio: View {
.navigationDestination(isPresented: $activeNavLinkToReport) {
ReportView(currentReportId: currentReportID, popToRootView: self.$rootIsActive)
}
.navigationDestination(isPresented: $activeNavLinkToAnnouncement) {
AnnouncementDetailView(rootIsActive: self.$rootIsActive, announcementId: self.currentDialogID)
}
.toolbar(.hidden, for: .tabBar)
.onAppear() {
myAnnouncementsViewModel.getMyAnnouncements()
Expand Down Expand Up @@ -1148,7 +1154,7 @@ struct ReportView: View {
.frame(width: 16, height: 16)
.foregroundStyle(.sponusPrimary)
}
}.padding(.top, 23)
}.padding(.top, 23).disabled(true)
// Korean/Heading/Heading05
Text(reportTitle)
.font(.Heading05)
Expand Down

0 comments on commit 3734169

Please sign in to comment.