Skip to content

Commit a41c776

Browse files
authored
Merge pull request #415 from DeveloperAcademy-POSTECH/release/v1.3.0
[CHORE] v1.3.0 출시에 따른 main 브랜치 업데이트
2 parents d0134ae + ba0bd5e commit a41c776

File tree

49 files changed

+3936
-947
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3936
-947
lines changed

Manito/Manito.xcodeproj/project.pbxproj

Lines changed: 78 additions & 16 deletions
Large diffs are not rendered by default.

Manito/Manito/Global/Base/BaseCollectionViewCell.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class BaseCollectionViewCell: UICollectionViewCell {
1313

1414
override init(frame: CGRect) {
1515
super.init(frame: frame)
16-
render()
17-
configUI()
16+
setupLayout()
17+
configureUI()
1818
}
1919

2020
required init?(coder: NSCoder) {
@@ -23,11 +23,11 @@ class BaseCollectionViewCell: UICollectionViewCell {
2323

2424
// MARK: - func
2525

26-
func render() {
26+
func setupLayout() {
2727
// Override Layout
2828
}
2929

30-
func configUI() {
30+
func configureUI() {
3131
// View Configuration
3232
}
3333
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// LetterImageError.swift
3+
// Manito
4+
//
5+
// Created by SHIN YOON AH on 2023/02/21.
6+
//
7+
8+
import Foundation
9+
10+
enum LetterImageError: LocalizedError {
11+
case invalidImage
12+
case invalidPhotoLibrary
13+
}
14+
15+
extension LetterImageError {
16+
var errorDescription: String? {
17+
switch self {
18+
case .invalidImage: return TextLiteral.letterImageViewControllerErrorMessage
19+
case .invalidPhotoLibrary: return TextLiteral.letterImageViewControllerErrorMessage
20+
}
21+
}
22+
}

Manito/Manito/Global/Extension/UIViewController+Extension.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extension UIViewController {
2525
message: String,
2626
okTitle: String = "확인",
2727
cancelTitle: String = "취소",
28+
okStyle: UIAlertAction.Style = .destructive,
2829
okAction: ((UIAlertAction) -> Void)?,
2930
cancelAction: ((UIAlertAction) -> Void)? = nil,
3031
completion : (() -> Void)? = nil) {
@@ -37,7 +38,7 @@ extension UIViewController {
3738
let cancelAction = UIAlertAction(title: cancelTitle, style: .default, handler: cancelAction)
3839
alertViewController.addAction(cancelAction)
3940

40-
let okAction = UIAlertAction(title: okTitle, style: .destructive, handler: okAction)
41+
let okAction = UIAlertAction(title: okTitle, style: okStyle, handler: okAction)
4142
alertViewController.addAction(okAction)
4243

4344
self.present(alertViewController, animated: true, completion: completion)

Manito/Manito/Global/Literal/TextLiteral.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
import Foundation
99

1010
enum TextLiteral {
11+
12+
// MARK: - App Name
13+
static let appName = Bundle.main.infoDictionary?["CFBundleDisplayName"] as? String ?? "애니또"
1114

1215
// MARK: - AnyWhere
1316
static let done: String = "완료"
@@ -62,6 +65,8 @@ enum TextLiteral {
6265
static let mainViewControllerGuideTitle: String = "공통 미션이란?"
6366
static let mainViewControllerGuideDescription: String = "공통 미션이란?\n마니또에 참여한 모두에게 \n수행하는 미션이에요. "
6467
static let mainViewControllerNewRoomAlert: String = "새로운 마니또 시작"
68+
static let mainViewControllerShowIdErrorAlertTitle: String = "해당 마니또 방의 정보를 불러오지 못했습니다."
69+
static let mainViewControllerShowIdErrorAlertMessage: String = "해당 마니또 방으로 이동할 수 없습니다."
6570

6671
// MARK: - OpenManittoViewController
6772
static let openManittoViewController: String = "당신의 마니또는?"
@@ -90,23 +95,27 @@ enum TextLiteral {
9095
static let letterHeaderViewSegmentControlManitti: String = "마니띠에게"
9196
static let letterHeaderViewSegmentControlManitto: String = "마니또로부터"
9297

93-
// MARK: - SendLetterView
98+
// MARK: - BottomSendLetterView
9499
static let sendLetterViewSendLetterButton: String = "쪽지 쓰기"
95100

96101
// MARK: - IndividualMissionView
97102
static let individualMissionViewTitleLabel: String = "오늘의 개별 미션"
98103

99-
// MARK: - LetterTextView
104+
// MARK: - CreateLetterTextView
100105
static let letterTextViewTitleLabel: String = "쪽지 작성"
101106

102-
// MARK: - LetterPhotoView
107+
// MARK: - CreateLetterPhotoView
103108
static let letterPhotoViewTitleLabel: String = "사진 추가"
104109
static let letterPhotoViewTakePhoto: String = "사진 촬영"
105110
static let letterPhotoViewChoosePhoto: String = "사진 보관함에서 선택"
106111
static let letterPhotoViewDeletePhoto: String = "사진 지우기"
107112
static let letterPhotoViewChoosePhotoToManitto: String = "마니또에게 보낼 사진 선택"
108113
static let letterPhotoViewSetting: String = "설정"
109114
static let letterPhotoViewFail: String = "사진을 불러올 수 없습니다."
115+
static let letterPhotoViewErrorTitle: String = "오류"
116+
static let letterPhotoViewSettingFail = "설정 화면을 연결할 수 없습니다."
117+
static let letterPhotoViewDeviceFail = "해당 기기에서 카메라를 사용할 수 없습니다."
118+
static let letterPhotoViewSettingAuthorization = "\(appName)가 카메라에 접근이 허용되어 있지 않습니다. 설정화면으로 가시겠습니까?"
110119

111120
// MARK: - LetterViewController
112121
static let letterViewControllerTitle = "쪽지함"
@@ -130,6 +139,8 @@ enum TextLiteral {
130139
// MARK: - CreateLetterViewController
131140
static let createLetterViewControllerSendButton: String = "보내기"
132141
static let createLetterViewControllerTitle: String = "쪽지 작성하기"
142+
static let createLetterViewControllerErrorTitle = "오류 발생"
143+
static let createLetterViewControllerErrorMessage = "쪽지 전송에 실패했습니다. 다시 시도해주세요."
133144

134145

135146
// MARK: - DetailIngViewController

Manito/Manito/Network/API/LetterAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ struct LetterAPI: LetterProtocol {
2929
}
3030

3131
@discardableResult
32-
func dispatchLetter(roomId: String, image: Data? = nil, letter: LetterDTO) async throws -> Int {
32+
func dispatchLetter(roomId: String, image: Data? = nil, letter: LetterDTO, missionId: String) async throws -> Int {
3333
let request = LetterEndPoint
34-
.dispatchLetter(roomId: roomId, image: image, letter: letter)
34+
.dispatchLetter(roomId: roomId, image: image, letter: letter, missionId: missionId)
3535
.createRequest()
3636
return try await self.apiService.request(request)
3737
}

Manito/Manito/Network/EndPoint/LetterEndPoint.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99

1010
enum LetterEndPoint: EndPointable {
11-
case dispatchLetter(roomId: String, image: Data?, letter: LetterDTO)
11+
case dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String)
1212
case fetchSendLetter(roomId: String)
1313
case fetchReceiveLetter(roomId: String)
1414
case patchReadMessage(roomId: String, status: String)
@@ -32,9 +32,10 @@ enum LetterEndPoint: EndPointable {
3232

3333
var requestBody: Data? {
3434
switch self {
35-
case .dispatchLetter(_, let image, let letter):
35+
case .dispatchLetter(_, let image, let letter, let missionId):
3636
let parameters: [String: String?] = ["manitteeId": letter.manitteeId,
37-
"messageContent": letter.messageContent]
37+
"messageContent": letter.messageContent,
38+
"missionId": missionId]
3839
let dataBody = createDataBody(withParameters: parameters,
3940
media: image ?? nil,
4041
boundary: APIEnvironment.boundary)
@@ -51,12 +52,12 @@ enum LetterEndPoint: EndPointable {
5152

5253
func getURL(baseURL: String) -> String {
5354
switch self {
54-
case .dispatchLetter(let roomId,_,_):
55+
case .dispatchLetter(let roomId, _, _, _):
5556
return "\(baseURL)/rooms/\(roomId)/messages-separate"
5657
case .fetchSendLetter(let roomId):
57-
return "\(baseURL)/rooms/\(roomId)/messages-sent"
58+
return "https://dev.aenitto.shop/api/v2/rooms/\(roomId)/messages-sent"
5859
case .fetchReceiveLetter(let roomId):
59-
return "\(baseURL)/rooms/\(roomId)/messages-received"
60+
return "https://dev.aenitto.shop/api/v2/rooms/\(roomId)/messages-received"
6061
case .patchReadMessage(let roomId, _):
6162
return "\(baseURL)/rooms/\(roomId)/messages/status"
6263
}

Manito/Manito/Network/Foundation/NetworkError.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ enum NetworkError: Error {
1111
case encodingError
1212
case clientError(message: String?)
1313
case serverError
14+
case unknownError
1415
}

Manito/Manito/Network/Models/Letter.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,20 @@ struct Message: Codable {
2323
var content: String?
2424
var imageUrl: String?
2525
var createdDate: String?
26+
var missionInfo: Mission?
27+
28+
var isToday: Bool {
29+
return Date().letterDateToString == createdDate
30+
}
2631

2732
var date: String {
2833
guard let createdDate = createdDate else { return "" }
29-
let isToday = Date().letterDateToString == createdDate
30-
31-
return isToday ? "오늘" : createdDate
34+
return self.isToday ? "오늘" : createdDate
35+
}
36+
37+
var mission: String? {
38+
guard let mission = missionInfo?.content else { return nil }
39+
40+
return "\(date)의 개별미션\n[\(mission)]"
3241
}
3342
}

Manito/Manito/Network/Protocol/LetterProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ import Foundation
1010
protocol LetterProtocol {
1111
func fetchSendLetter(roomId: String) async throws -> Letter?
1212
func fetchReceiveLetter(roomId: String) async throws -> Letter?
13-
func dispatchLetter(roomId: String, image: Data?, letter: LetterDTO) async throws -> Int
13+
func dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) async throws -> Int
1414
}

0 commit comments

Comments
 (0)