-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'iOS/dev' of https://github.com/boostcampwm2023/iOS09-La…
…yover into iOS/feat#209
- Loading branch information
Showing
54 changed files
with
1,594 additions
and
83 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,90 @@ | ||
// | ||
// LOPopUpView.swift | ||
// Layover | ||
// | ||
// Created by 황지웅 on 12/4/23. | ||
// Copyright © 2023 CodeBomber. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
final class LOPopUpView: UIView { | ||
private let titleLabel: UILabel = { | ||
let label: UILabel = UILabel() | ||
label.text = "콘텐츠 신고" | ||
label.font = .loFont(type: .subtitle) | ||
return label | ||
}() | ||
|
||
private let reportStackView: LOReportStackView = LOReportStackView() | ||
|
||
private let cancelButton: UIButton = { | ||
let button: UIButton = UIButton() | ||
button.setTitle("취소", for: .normal) | ||
button.setTitleColor(.grey200, for: .normal) | ||
return button | ||
}() | ||
|
||
private let reportButton: UIButton = { | ||
let button: UIButton = UIButton() | ||
button.setTitle("신고", for: .normal) | ||
button.setTitleColor(.error, for: .normal) | ||
return button | ||
}() | ||
|
||
weak var delegate: ReportViewControllerDelegate? | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
setConstraints() | ||
cancelButton.addTarget(self, action: #selector(cancelButtonDidTap), for: .touchUpInside) | ||
reportButton.addTarget(self, action: #selector(reportButtonDidTap), for: .touchUpInside) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
super.init(coder: coder) | ||
setConstraints() | ||
cancelButton.addTarget(self, action: #selector(cancelButtonDidTap), for: .touchUpInside) | ||
reportButton.addTarget(self, action: #selector(reportButtonDidTap), for: .touchUpInside) | ||
} | ||
|
||
func getReportContent() -> String { | ||
reportStackView.reportContent | ||
} | ||
|
||
private func setConstraints() { | ||
addSubviews(titleLabel, reportStackView, cancelButton, reportButton) | ||
subviews.forEach { subView in | ||
subView.translatesAutoresizingMaskIntoConstraints = false | ||
} | ||
|
||
NSLayoutConstraint.activate([ | ||
titleLabel.topAnchor.constraint(equalTo: self.topAnchor, constant: 28), | ||
titleLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 28), | ||
titleLabel.bottomAnchor.constraint(equalTo: reportStackView.topAnchor, constant: -5), | ||
reportStackView.widthAnchor.constraint(equalTo: self.widthAnchor, multiplier: 0.8), | ||
reportStackView.heightAnchor.constraint(equalToConstant: 336), | ||
reportStackView.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 5), | ||
reportStackView.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 13.5), | ||
cancelButton.leadingAnchor.constraint(equalTo: self.leadingAnchor), | ||
cancelButton.trailingAnchor.constraint(equalTo: reportButton.leadingAnchor), | ||
cancelButton.widthAnchor.constraint(equalToConstant: 175), | ||
cancelButton.heightAnchor.constraint(equalToConstant: 56), | ||
cancelButton.topAnchor.constraint(equalTo: reportStackView.bottomAnchor), | ||
reportButton.leadingAnchor.constraint(equalTo: cancelButton.trailingAnchor), | ||
reportButton.trailingAnchor.constraint(equalTo: self.trailingAnchor), | ||
reportButton.widthAnchor.constraint(equalToConstant: 175), | ||
reportButton.heightAnchor.constraint(equalToConstant: 56), | ||
reportButton.topAnchor.constraint(equalTo: reportStackView.bottomAnchor) | ||
]) | ||
|
||
} | ||
|
||
@objc private func cancelButtonDidTap() { | ||
delegate?.dismissReportView() | ||
} | ||
|
||
@objc private func reportButtonDidTap() { | ||
delegate?.reportPlaybackVideo(reportContent: getReportContent()) | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
iOS/Layover/Layover/DesignSystem/LOReportContentView.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,93 @@ | ||
// | ||
// LOReportContentView.swift | ||
// Layover | ||
// | ||
// Created by 황지웅 on 12/4/23. | ||
// Copyright © 2023 CodeBomber. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
final class LOReportContentView: UIView { | ||
|
||
// MARK: - UI Components | ||
|
||
var index: Int = 0 | ||
|
||
private let whiteCircle: UIView = { | ||
let view: UIView = UIView() | ||
view.backgroundColor = .layoverWhite | ||
view.clipsToBounds = true | ||
view.layer.cornerRadius = 4 | ||
view.isHidden = true | ||
view.isUserInteractionEnabled = false | ||
return view | ||
}() | ||
|
||
private let radioView: UIView = { | ||
let view: UIView = UIView() | ||
view.layer.borderColor = UIColor.grey100.cgColor | ||
view.layer.borderWidth = 0.1 | ||
view.backgroundColor = .clear | ||
view.layer.cornerRadius = 10 | ||
view.clipsToBounds = true | ||
view.isUserInteractionEnabled = false | ||
return view | ||
}() | ||
|
||
let contentLabel: UILabel = { | ||
let label: UILabel = UILabel() | ||
label.text = "스팸 / 홍보 도배글이에요" | ||
label.font = .loFont(type: .body2) | ||
label.textAlignment = .left | ||
label.textColor = .layoverWhite | ||
return label | ||
}() | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
setConstraints() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
super.init(coder: coder) | ||
setConstraints() | ||
} | ||
|
||
func onRadio() { | ||
whiteCircle.isHidden = false | ||
radioView.backgroundColor = .primaryPurple | ||
} | ||
|
||
func offRadio() { | ||
whiteCircle.isHidden = true | ||
radioView.backgroundColor = .clear | ||
} | ||
|
||
func setText(_ content: String) { | ||
contentLabel.text = content | ||
} | ||
|
||
// MARK: - UI Methods | ||
|
||
private func setConstraints() { | ||
radioView.addSubview(whiteCircle) | ||
whiteCircle.translatesAutoresizingMaskIntoConstraints = false | ||
addSubviews(radioView, contentLabel) | ||
subviews.forEach { subView in | ||
subView.translatesAutoresizingMaskIntoConstraints = false | ||
} | ||
NSLayoutConstraint.activate([ | ||
whiteCircle.centerXAnchor.constraint(equalTo: radioView.centerXAnchor), | ||
whiteCircle.centerYAnchor.constraint(equalTo: radioView.centerYAnchor), | ||
whiteCircle.widthAnchor.constraint(equalToConstant: 8), | ||
whiteCircle.heightAnchor.constraint(equalToConstant: 8), | ||
radioView.widthAnchor.constraint(equalToConstant: 20), | ||
radioView.heightAnchor.constraint(equalToConstant: 20), | ||
radioView.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 10), | ||
radioView.centerYAnchor.constraint(equalTo: self.centerYAnchor), | ||
radioView.trailingAnchor.constraint(equalTo: contentLabel.leadingAnchor, constant: -12), | ||
contentLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor) | ||
]) | ||
} | ||
} |
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,66 @@ | ||
// | ||
// LOReportStackView.swift | ||
// Layover | ||
// | ||
// Created by 황지웅 on 12/4/23. | ||
// Copyright © 2023 CodeBomber. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
final class LOReportStackView: UIStackView { | ||
|
||
var reportViews: [LOReportContentView] = { | ||
let contentArray: [String] = ["스팸 홍보 / 도배글이에요", "부적절한 사진이에요", "청소년에게 유해한 내용이에요", "욕설 / 혐오 / 차별적 표현을 담고있어요", "거짓 정보를 담고있어요", "기타"] | ||
return contentArray.enumerated().map { index, content in | ||
let loReportContentView: LOReportContentView = LOReportContentView() | ||
loReportContentView.setText(content) | ||
loReportContentView.index = index | ||
return loReportContentView | ||
} | ||
}() | ||
|
||
var reportContent: String = "스팸 홍보 / 도배글이에요" | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
setUI() | ||
addContent() | ||
} | ||
|
||
required init(coder: NSCoder) { | ||
super.init(coder: coder) | ||
setUI() | ||
addContent() | ||
} | ||
|
||
private func setUI() { | ||
self.alignment = .fill | ||
self.distribution = .fillProportionally | ||
self.axis = .vertical | ||
self.spacing = 8 | ||
guard let firstReportView: LOReportContentView = reportViews.first else { return } | ||
firstReportView.onRadio() | ||
} | ||
|
||
private func addContent() { | ||
reportViews.forEach { reportView in | ||
let addGesutre: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(reportViewDidTap(_:))) | ||
reportView.addGestureRecognizer(addGesutre) | ||
addArrangedSubview(reportView) | ||
} | ||
} | ||
|
||
@objc private func reportViewDidTap(_ sender: UITapGestureRecognizer) { | ||
guard let tempView: LOReportContentView = sender.view as? LOReportContentView else { return } | ||
self.reportViews.forEach { reportView in | ||
if reportView.index == tempView.index { | ||
reportView.onRadio() | ||
guard let reportContentText: String = reportView.contentLabel.text else { return } | ||
reportContent = reportContentText | ||
} else { | ||
reportView.offRadio() | ||
} | ||
} | ||
} | ||
} |
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
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
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,17 @@ | ||
// | ||
// UploadPost.swift | ||
// Layover | ||
// | ||
// Created by kong on 2023/12/05. | ||
// Copyright © 2023 CodeBomber. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct UploadPost { | ||
let title: String | ||
let content: String? | ||
let latitude, longitude: Double | ||
let tag: [String] | ||
let videoURL: URL | ||
} |
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 |
---|---|---|
|
@@ -9,5 +9,5 @@ | |
import Foundation | ||
|
||
struct CheckSignUpDTO: Decodable { | ||
let isValid: Bool | ||
let isAlreadyExist: Bool | ||
} |
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,15 @@ | ||
// | ||
// ReportDTO.swift | ||
// Layover | ||
// | ||
// Created by 황지웅 on 12/5/23. | ||
// Copyright © 2023 CodeBomber. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct ReportDTO: Codable { | ||
let memberId: Int? | ||
let boardID: Int | ||
let reportType: String | ||
} |
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,24 @@ | ||
// | ||
// UploadPostDTO.swift | ||
// Layover | ||
// | ||
// Created by kong on 2023/12/05. | ||
// Copyright © 2023 CodeBomber. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct UploadPostDTO: Decodable { | ||
let id: Int | ||
let title: String | ||
let content: String? | ||
let latitude, longitude: Double | ||
let tag: [String] | ||
} | ||
|
||
struct UploadPostRequestDTO: Encodable { | ||
let title: String | ||
let content: String? | ||
let latitude, longitude: Double | ||
let tag: [String] | ||
} |
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,27 @@ | ||
// | ||
// UploadVideoDTO.swift | ||
// Layover | ||
// | ||
// Created by kong on 2023/12/05. | ||
// Copyright © 2023 CodeBomber. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct UploadVideoDTO: Decodable { | ||
let preSignedURL: String | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case preSignedURL = "preSignedUrl" | ||
} | ||
} | ||
|
||
struct UploadVideoRequestDTO: Encodable { | ||
let boardID: Int | ||
let filetype: String | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case boardID = "boardId" | ||
case filetype | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
iOS/Layover/Layover/Network/EndPoint/Factories/ReportEndPointFactory.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,27 @@ | ||
// | ||
// ReportEndPointFactory.swift | ||
// Layover | ||
// | ||
// Created by 황지웅 on 12/5/23. | ||
// Copyright © 2023 CodeBomber. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol ReportEndPointFactory { | ||
func reportPlaybackVideoEndpoint(boardID: Int, reportType: String) -> EndPoint<Response<ReportDTO>> | ||
} | ||
|
||
struct DefaultReportEndPointFactory: ReportEndPointFactory { | ||
func reportPlaybackVideoEndpoint(boardID: Int, reportType: String) -> EndPoint<Response<ReportDTO>> { | ||
var bodyParmeters: ReportDTO = ReportDTO( | ||
memberId: nil, | ||
boardID: boardID, | ||
reportType: reportType) | ||
|
||
return EndPoint( | ||
path: "/report", | ||
method: .POST, | ||
bodyParameters: bodyParmeters) | ||
} | ||
} |
Oops, something went wrong.