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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protocol ProfileEditInteractable: AnyObject {
size: String,
keywords: [String],
imageData: Data?
)
) async throws
}

final class ProfileEditInteractor: ProfileEditInteractable {
Expand Down Expand Up @@ -59,26 +59,19 @@ final class ProfileEditInteractor: ProfileEditInteractable {
size: String,
keywords: [String],
imageData: Data?
) {
Task {
do {
try await updateUserInfo(
name: name,
age: age,
size: size,
keywords: keywords
)
guard let imageData else {
presenter?.didSaveUserInfo()
return
}
try await saveProfile(imageData: imageData)
presenter?.didSaveUserInfo()
} catch let error {
SNMLogger.error(error.localizedDescription)
}
) async throws {
try await updateUserInfo(
name: name,
age: age,
size: size,
keywords: keywords
)
if let imageData {
try await saveProfile(imageData: imageData)
}
presenter?.didSaveUserInfo()
}

private func saveProfile(imageData: Data) async throws {
let _ = try await saveProfileImageUsecase.execute(imageData: imageData)
}
Expand All @@ -91,7 +84,7 @@ final class ProfileEditInteractor: ProfileEditInteractable {
do {
try await updateUserInfoUsecase.execute(
with: [
"name": name,
"dog_name": name,
"age": age,
"size": size,
"keywords": keywords
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,19 @@ final class ProfileEditPresenter: ProfileEditPresentable {
let keywords else {
return
}
interactor?.editUserInfo(
name: nameText,
age: age,
size: size.rawValue,
keywords: keywords.map { $0.rawValue },
imageData: profileImage?.jpegData(compressionQuality: 0.7)
)
Task {
do {
try await interactor?.editUserInfo(
name: nameText,
age: age,
size: size.rawValue,
keywords: keywords.map { $0.rawValue },
imageData: profileImage?.jpegData(compressionQuality: 0.7)
)
} catch {
SNMLogger.error(error.localizedDescription)
Copy link
Copy Markdown
Contributor Author

@kelly-chui kelly-chui Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SNMErrorHandler로 하려 했는데, 이건 일괄 처리하는게 좋을 것 같아서 Logger로 냅뒀습니다. 이 소스 파일 내부에서도 현재 이슈랑 맞지 않는 변경사항들이 늘어나는 것 같아서요.

}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ final class ProfileEditViewController: BaseViewController, ProfileEditViewable {
completeEditButton.publisher(event: .touchUpInside)
.sink { [weak self] _ in
self?.completeEditButton.isEnabled = false
self?.snmProgressToast.show(in: self?.view, isDim: true)
self?.handleCompleteButtonAction()
self?.snmProgressToast.show(in: self?.view, isDim: true)
}
.store(in: &cancellables)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct UpdateUserInfoUsecaseImpl: UpdateUserInfoUsecase {
from oldProfileInfo: ProfileInfo
) throws {
let newProfileInfo = ProfileInfo(
name: updatedProperty["name"] as? String ?? oldProfileInfo.name,
name: updatedProperty["dog_name"] as? String ?? oldProfileInfo.name,
age: updatedProperty["age"] as? UInt8 ?? oldProfileInfo.age,
sex: oldProfileInfo.sex,
sexUponIntake: updatedProperty["sexUponIntake"] as? Bool ?? oldProfileInfo.sexUponIntake,
Expand Down