Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions ByeBoo-iOS/ByeBoo-iOS/Data/Enum/JourneyType+Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@
//

extension JourneyType {
var key: String {
var responseKey: String {
switch self {
case .recording:
"RECORDING"
case .active:
"ACTIVE"
case .reunion:
"REUNION"
}
}

var requestKey: String {
switch self {
case .recording:
"FACE_EMOTION"
Expand All @@ -17,7 +28,7 @@ extension JourneyType {
}
}

static func keyToEnum(_ key: String) -> Self? {
return Self.allCases.first { $0.key == key }
static func responseKeyToEnum(_ key: String) -> Self? {
return Self.allCases.first { $0.responseKey == key }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ extension JourneyTypeData {
.init(
title: self.journey,
description: nil,
style: JourneyType.keyToEnum(self.style),
questType: QuestType.keyToEnum(self.style)
style: JourneyType.responseKeyToEnum(self.style)
)
}
}
5 changes: 2 additions & 3 deletions ByeBoo-iOS/ByeBoo-iOS/Data/Model/QuestAnswerResponseDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ struct QuestAnswerResponseDTO: Decodable {
let imageUrl: String?
let imageKey: String?
let emotionDescription: String
// TODO: API 변동되면 옵셔널 해제
let aiAnswerExists: Bool?
let aiAnswerExists: Bool
}

extension QuestAnswerResponseDTO {
Expand All @@ -33,7 +32,7 @@ extension QuestAnswerResponseDTO {
imageUrl: imageUrl ?? "",
imageKey: imageKey ?? "",
emotionDescription: emotionDescription,
AIAnswerExists: aiAnswerExists ?? false
AIAnswerExists: aiAnswerExists
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ extension UserJourneyResponseDTO {
return .init(
title: self.journey,
description: self.description,
style: nil,
questType: nil
style: nil
)
}
}
2 changes: 1 addition & 1 deletion ByeBoo-iOS/ByeBoo-iOS/Data/Network/EndPoint/QuestAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ extension QuestAPI: EndPoint {
var queryParameters: [String : String]? {
switch self {
case .postJourney(let journey), .completedQuests(let journey):
return ["journey": journey.key]
return ["journey": journey.requestKey]
default:
return nil
}
Expand Down
14 changes: 1 addition & 13 deletions ByeBoo-iOS/ByeBoo-iOS/Data/Repository/UsersRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ struct DefaultUsersRepository: UsersInterface {
// MARK: Network

func fetchJourney() async throws -> JourneyEntity {
let accessToken = loadAccessToken()
let result = try await network.request(
UsersAPI.journey,
decodingType: UserJourneyResponseDTO.self
Expand All @@ -39,7 +38,6 @@ struct DefaultUsersRepository: UsersInterface {
name: String,
questStyle: String
) async throws -> UserEntity {
let accessToken = loadAccessToken()
let userRequestDTO: UserRequestDTO = .init(
name: name,
questStyle: questStyle
Expand All @@ -62,7 +60,6 @@ struct DefaultUsersRepository: UsersInterface {
}

func fetchCharacterDialogue() async throws -> DialogueEntity {
let accessToken = loadAccessToken()
let result = try await network.request(
UsersAPI.character,
decodingType: DialogueResponseDTO.self
Expand All @@ -72,7 +69,6 @@ struct DefaultUsersRepository: UsersInterface {
}

func fetchQuestStatus() async throws -> UserQuestStatusEntity {
let accessToken = loadAccessToken()
let result = try await network.request(
UsersAPI.count,
decodingType: UserQuestStatusResponseDTO.self
Expand All @@ -82,7 +78,6 @@ struct DefaultUsersRepository: UsersInterface {
}

func startJourney() async throws {
let accessToken = loadAccessToken()
try await network.request(UsersAPI.start)
}

Expand All @@ -109,7 +104,6 @@ struct DefaultUsersRepository: UsersInterface {
}

func modifyUserNickname(name: String) async throws -> String {
let accessToken = loadAccessToken()
let result = try await network.request(
UsersAPI.modifyName(
requestDTO: UserNameRequestDTO(
Expand All @@ -124,11 +118,10 @@ struct DefaultUsersRepository: UsersInterface {

func getLastJourneyType() -> JourneyType {
let journey: String? = userDefaultsService.load(key: .journey)
return JourneyType.keyToEnum(journey ?? "") ?? .recording
return JourneyType.responseKeyToEnum(journey ?? "") ?? .recording
}

func updateNotificationPermission() async throws -> Bool {
let accessToken = loadAccessToken()
let result = try await network.request(
UsersAPI.updateNotificationPermission,
decodingType: AlarmEnabledResponseDTO.self
Expand All @@ -151,7 +144,6 @@ struct DefaultUsersRepository: UsersInterface {
}

func fetchMyCommonQuestAnswers(cursor: Int?) async throws -> CommonQuestMyAnswersEntity {
let accessToken = loadAccessToken()
let result = try await network.request(
UsersAPI.fetchCommonQuestAnswers(cursor: cursor),
decodingType: CommonQuestMyAnswersResponseDTO.self
Expand All @@ -167,10 +159,6 @@ struct DefaultUsersRepository: UsersInterface {
return alarmEnabled
}
}

private func loadAccessToken() -> String {
keychainService.load(key: .accessToken)
}
}

final class MockUserRepository: UsersInterface {
Expand Down
3 changes: 1 addition & 2 deletions ByeBoo-iOS/ByeBoo-iOS/Domain/Entity/JourneyEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ struct JourneyEntity {
let title: String
let description: String?
let style: JourneyType?
let questType: QuestType?
}

extension JourneyEntity: Equatable {
static func stub() -> Self {
return .init(title: "이별 극복", description: "설명", style: .recording, questType: .question)
return .init(title: "이별 극복", description: "설명", style: .recording)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ final class ByeBooButton: UIButton {
}

func updateTitle(_ title: String) {
self.setTitle(titleText, for: .normal)
self.setTitle(title, for: .normal)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@
import Foundation

extension QuestType {
var title: String {
switch self {
case .question:
"질문형"
case .activation:
"행동형"
}
}

var plaeholder: String {
switch self {
case .question:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class LoadingView: BaseView {
textAlignment: .center,
numberOfLines: 2
)
$0.attributedText = "\(nickname)님에게 꼭 맞는\n이별 극복 여정을 찾는 중 ..."
$0.attributedText = "\(nickname)님에게 꼭 맞는\n극복 여정을 찾는 중 ..."
.makeTitle(
rangedText: nickname,
font: FontManager.body1Sb16.font,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import Then
final class QuestCardsView: BaseView {

private(set) var questCards = [
QuestCardView(
title: "재회 준비",
subTitle: "X와의 재회를 위해\n나를 먼저 돌아보고\n상대를 이해해요",
image: .reunion
),
QuestCardView(
title: "이별 극복",
subTitle: "질문과 미션을 통해\n나만의 삶을\n회복해 나가요",
image: .overcomingBreakup
),
QuestCardView(
title: "재회 준비",
subTitle: "X와의 재회를 위해\n나를 먼저 돌아보고\n상대를 이해해요",
image: .reunion
)
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ extension JourneyListView {
journeyList.forEach { journey in
let journeyView = OneLineTextBoxView(
title: journey.title + " 여정",
tagTitle: journey.questType?.title,
tagTitle: journey.style?.title,
tagType: isFinished ? .word3Gray : .word3Purple,
isHighlighted: !isFinished
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ final class ArchiveQuestView: BaseView {

extension ArchiveQuestView {
func updateUI(_ entity: QuestAnswerEntity) {
if entity.AIAnswerExists {
self.AIAnswerButton.updateTitle("보리의 답장 보러 가기")
} else {
self.AIAnswerButton.updateTitle("보리에게 답장 받기")
}

self.headerView.updateUI(
stepNumber: entity.stepNumber,
questNumber: entity.questNumber,
Expand Down
Loading