Skip to content

Commit

Permalink
Merge pull request #11 from ITlearning/Budimyproflie
Browse files Browse the repository at this point in the history
Budimyproflie
  • Loading branch information
ITlearning authored Jan 13, 2022
2 parents 1c7727a + 5816842 commit ab40412
Show file tree
Hide file tree
Showing 22 changed files with 394 additions and 133 deletions.
4 changes: 4 additions & 0 deletions Budi/Budi/Resource/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>앨범 사용 권한을 허용합니다.</string>
<key>NSCameraUsageDescription</key>
<string>카메라 사용 권한을 허용합니다.</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import UIKit
import Combine

protocol ProjectMembersBottomViewControllerDelegate: AnyObject {
func getRecruitingPositions(_ recruitingPositions: [RecruitingPosition])
func getRecruitingPositions(_ recruitingPositions: [RecruitingPosition], _ selectPosition: Int)
}

extension ProjectMembersBottomViewControllerDelegate {
func getRecruitingPositions(_ recruitingPositions: [RecruitingPosition], _ selectPosition: Int = 0) {
getRecruitingPositions(recruitingPositions, selectPosition)
}
}

final class ProjectMembersBottomViewController: UIViewController {
Expand All @@ -32,7 +38,7 @@ final class ProjectMembersBottomViewController: UIViewController {
private var positionSwitch: PositionSwitch
private var selectedPosition: Position?
private var recruitingPositions: [RecruitingPosition] = []

private var selectPosition: Int = 0
weak var delegate: ProjectMembersBottomViewControllerDelegate?

init(nibName: String?, bundle: Bundle?, developerPositions: [String], designerPositions: [String], productManagerPositions: [String], viewSwitch: PositionSwitch) {
Expand Down Expand Up @@ -76,7 +82,12 @@ private extension ProjectMembersBottomViewController {
.receive(on: DispatchQueue.main)
.sink { [weak self] _ in
guard let self = self else { return }
self.delegate?.getRecruitingPositions(self.recruitingPositions)
switch self.positionSwitch {
case .myBudi:
self.delegate?.getRecruitingPositions(self.recruitingPositions, self.selectPosition)
case .writing:
self.delegate?.getRecruitingPositions(self.recruitingPositions)
}
self.hideBottomView()
}.store(in: &cancellables)
}
Expand Down Expand Up @@ -213,6 +224,7 @@ extension ProjectMembersBottomViewController: UICollectionViewDataSource, UIColl
if selectedPosition == nil {
showBottomView(constant: 350)
}
self.selectPosition = indexPath.row+1
guard let newSelectedPosition = Position(rawValue: indexPath.row+1),
newSelectedPosition != self.selectedPosition else { return }
self.selectedPosition = newSelectedPosition
Expand Down
10 changes: 7 additions & 3 deletions Budi/Budi/Source/Login/View/NickNameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class NickNameView: UIView {

func checkID(flag: Bool?) {
if flag == nil {
checkTextLabel.text = ""
return
}
guard let flag = flag else { return }
Expand All @@ -93,8 +92,13 @@ class NickNameView: UIView {
}
}

func emptyText() {
checkTextLabel.text = ""
func emptyText(text: String) {
if text.count == 0 {
checkTextLabel.text = ""
} else {
checkTextLabel.text = "닉네임은 3글자 이상입니다."
checkTextLabel.textColor = UIColor.primary
}
}

private func configureObserver() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import CombineCocoa
import Combine



class HistoryManagementViewController: UIViewController {
weak var coordinator: LoginCoordinator?
private let viewModel: SignupViewModel
Expand Down Expand Up @@ -169,7 +168,7 @@ extension HistoryManagementViewController: UITableViewDelegate, UITableViewDataS
if data.itemInfo.isInclude {
if data.portfolioLink.count >= 1 {
guard let cell = tableView.dequeueReusableCell(withIdentifier: PortfolioURLTableViewCell.cellId, for: indexPath) as? PortfolioURLTableViewCell else { return UITableViewCell() }
cell.configureParsing(url: data.portfolioLink)
cell.configureParsing(urlString: data.portfolioLink)

cell.editButton.tapPublisher
.receive(on: DispatchQueue.main)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import CombineCocoa
import Combine

protocol HistoryWriteViewControllerDelegate: AnyObject {
func getProject(_ project: SignupInfoModel?)
func getProject(_ project: SignupInfoModel?, _ editItem: Item?)
}

class HistoryWriteViewController: UIViewController {
Expand Down Expand Up @@ -72,41 +72,19 @@ class HistoryWriteViewController: UIViewController {
}

private func bindViewModel() {
viewModel.state.writedInfoData
.receive(on: DispatchQueue.main)
.sink { data in
guard let data = data else { return }
self.saveButton.isEnabled = data.mainName.count >= 1 && data.description.count >= 1 && data.startDate.count >= 1 && data.endDate.count >= 1 ? true : false
self.saveButton.backgroundColor = data.mainName.count >= 1 && data.description.count >= 1 && data.startDate.count >= 1 && data.endDate.count >= 1 ? UIColor.primary : UIColor.textDisabled
self.saveButton.setTitleColor(UIColor.white, for: .normal)
self.saveButton.setTitleColor(UIColor.white, for: .disabled)
}
.store(in: &cancellables)

viewModel.state.editData
.receive(on: DispatchQueue.main)
.sink { [weak self] editData in
print(editData)
guard let self = self else { return }
guard let editData = editData else { return }
self.mainNameTextField.text = editData.name
self.leftDateTextField.text = editData.startDate
self.rightDateTextField.text = editData.endDate
self.descriptionTextField.text = editData.description
self.workingSwitchButton.isSelected = editData.nowWork
if self.workingSwitchButton.isSelected {
self.workingSwitchButton.isSelected = true
self.workingSwitchButton.imageView?.image = UIImage(systemName: "checkmark.circle.fill")
self.workingSwitchButton.tintColor = UIColor.primary
self.rightDateTextField.text = "현재"
self.rightDateTextField.isSelected = false
} else {
self.workingSwitchButton.isSelected = false
self.workingSwitchButton.imageView?.image = UIImage(systemName: "checkmark.circle")
self.workingSwitchButton.tintColor = UIColor.textDisabled
self.rightDateTextField.isSelected = true
}

self.saveButton.backgroundColor = UIColor.primary
self.saveButton.isEnabled = true
guard var data = self.viewModel.state.writedInfoData.value else { return }
data.mainName = editData.name
data.startDate = editData.startDate
Expand All @@ -118,6 +96,24 @@ class HistoryWriteViewController: UIViewController {
}
.store(in: &cancellables)

viewModel.state.writedInfoData
.receive(on: DispatchQueue.main)
.sink { [weak self] data in
guard let self = self else { return }
guard let data = data else { return }
self.saveButton.isEnabled = data.mainName.count >= 1 && data.description.count >= 1 && data.startDate.count >= 1 && data.endDate.count >= 1 ? true : false
self.saveButton.backgroundColor = data.mainName.count >= 1 && data.description.count >= 1 && data.startDate.count >= 1 && data.endDate.count >= 1 ? UIColor.primary : UIColor.textDisabled
self.saveButton.setTitleColor(UIColor.white, for: .normal)
self.saveButton.setTitleColor(UIColor.white, for: .disabled)

if self.viewModel.state.editData.value != nil {
self.saveButton.isEnabled = true
self.saveButton.backgroundColor = UIColor.primary
}

}
.store(in: &cancellables)

viewModel.state.reUseModalView
.receive(on: DispatchQueue.main)
.sink { data in
Expand Down Expand Up @@ -167,7 +163,11 @@ class HistoryWriteViewController: UIViewController {
guard let self = self else { return }
if self.myBudiCoordinator != nil {
let send = self.viewModel.state.writedInfoData.value
self.delegate?.getProject(send)
if self.viewModel.state.editData.value != nil {
self.delegate?.getProject(send, self.viewModel.state.editData.value)
} else {
self.delegate?.getProject(send, nil)
}
} else {
self.viewModel.action.fetchSignupInfoData.send(())
self.viewModel.state.editData.send(nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Combine
import CombineCocoa

protocol PortfolioViewControllerDelegate: AnyObject {
func getPortfolio(_ portfolio: SignupInfoModel?)
func getPortfolio(_ portfolio: SignupInfoModel?, _ editItem: Item?)
}

class PortfolioViewController: UIViewController {
Expand Down Expand Up @@ -79,9 +79,14 @@ class PortfolioViewController: UIViewController {
guard let self = self else { return }
if self.myBudiCoordinator != nil {
let send = self.viewModel.state.writedInfoData.value
self.delegate?.getPortfolio(send)
if self.viewModel.state.editData.value != nil {
self.delegate?.getPortfolio(send, self.viewModel.state.editData.value)
} else {
self.delegate?.getPortfolio(send, nil)
}
} else {
self.viewModel.action.fetchSignupInfoData.send(())
self.viewModel.state.editData.send(nil)
}

NotificationCenter.default.post(name: Notification.Name("Dismiss"), object: self)
Expand Down Expand Up @@ -109,6 +114,12 @@ class PortfolioViewController: UIViewController {
self.saveButton.backgroundColor = data.porflioLink.count >= 1 ? UIColor.primary : UIColor.textDisabled
self.saveButton.setTitleColor(UIColor.white, for: .normal)
self.saveButton.setTitleColor(UIColor.white, for: .disabled)

if self.viewModel.state.editData.value != nil {

self.saveButton.isEnabled = true
self.saveButton.backgroundColor = UIColor.primary
}
}
.store(in: &cancellables)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class PersonalInformationViewController: UIViewController {
.receive(on: DispatchQueue.main)
.sink { [weak self] flag in
guard let self = self else { return }
guard let flag = flag else { return }
//guard let flag = flag else { return }
self.nickNameView.checkID(flag: flag)
}
.store(in: &cancellables)
Expand Down Expand Up @@ -138,11 +138,12 @@ class PersonalInformationViewController: UIViewController {
var changeData = self.viewModel.state.signUpPersonalInfoData.value
guard let text = text else { return }
changeData.nickName = text
if text == "" {
self.nickNameView.emptyText()
if text == "" || text.count < 3 {
self.nickNameView.emptyText(text: text)
} else {
self.viewModel.action.checkSameId.send(text)
self.viewModel.state.signUpPersonalInfoData.send(changeData)
}
self.viewModel.action.checkSameId.send(text)
self.viewModel.state.signUpPersonalInfoData.send(changeData)
}
.store(in: &cancellables)

Expand Down
1 change: 1 addition & 0 deletions Budi/Budi/Source/Login/ViewModel/SignupViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ final class SignupViewModel: ViewModel {

let param = CreateInfo(
basePosition: self.state.selectedPosition.value.integerValue,
imgUrl: "https://budi.s3.ap-northeast-2.amazonaws.com/post_image/default/dating.jpg",
careerList: uploadCareerList,
description: self.state.signUpPersonalInfoData.value.description,
memberAddress: self.state.signUpPersonalInfoData.value.location,
Expand Down
2 changes: 2 additions & 0 deletions Budi/Budi/Source/Models/CreateInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Foundation
// MARK: - CreateInfo
struct CreateInfo: Codable {
let basePosition: Int
let imgUrl: String
let careerList: [CareerList]
let description, memberAddress, nickName: String
let portfolioLink, positionList: [String]
Expand All @@ -17,6 +18,7 @@ struct CreateInfo: Codable {
case basePosition, careerList
case description
case memberAddress, nickName, portfolioLink, positionList, projectList
case imgUrl
}
}

Expand Down
3 changes: 2 additions & 1 deletion Budi/Budi/Source/Models/LoginUserDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import Foundation

struct LoginUserDetail: Codable {
let id: Int
var imageUrl: String?
var imgUrl: String
var nickName: String
var address: String
var description: String
let level: String
var basePosition: Int
var positions: [String]
let likeCount: Int
var projectList: [ProjectList]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class NormalTextFieldTableViewCell: UITableViewCell {
var cancellables = Set<AnyCancellable>()
@IBOutlet weak var normalTextField: UITextField!
@IBOutlet weak var normalTitleLabel: UILabel!

override func prepareForReuse() {
super.prepareForReuse()
cancellables.removeAll()
Expand Down
11 changes: 6 additions & 5 deletions Budi/Budi/Source/MyBudi/Edit/Cells/PositionTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ class PositionTableViewCell: UITableViewCell {
}

func configurePosition(position: [String]) {
var positionText = ""
for position in position {
positionText += "#\(position) "
if position.count != 0 {
var positionText = ""
for position in position {
positionText += "#\(position) "
}
positionTextField.text = positionText
}
positionTextField.text = positionText
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ProjectTableViewCell: UITableViewCell {

override func prepareForReuse() {
super.prepareForReuse()
selectView.isHidden = true
cancellables.removeAll()
}

Expand Down
Loading

0 comments on commit ab40412

Please sign in to comment.