Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 프로필 VIP 로직 구현, 네트워크 연결 #216

Merged
merged 12 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 11 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
18 changes: 12 additions & 6 deletions iOS/Layover/Layover.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
194C21CC2B1DF39200C62645 /* MockHomeWorker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 194C21CB2B1DF39200C62645 /* MockHomeWorker.swift */; };
194C21D02B1DF65200C62645 /* PostList.json in Resources */ = {isa = PBXBuildFile; fileRef = 194C21CF2B1DF65200C62645 /* PostList.json */; };
194C21D42B1EEE3700C62645 /* sample.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 194C21D32B1EEE3700C62645 /* sample.jpeg */; };
194C21DC2B1F3ECA00C62645 /* GetMember.json in Resources */ = {isa = PBXBuildFile; fileRef = 194C21DB2B1F3ECA00C62645 /* GetMember.json */; };
194C21E62B1F7B5100C62645 /* PostListMore.json in Resources */ = {isa = PBXBuildFile; fileRef = 194C21E52B1F7B5100C62645 /* PostListMore.json */; };
194C21EA2B1F7C1600C62645 /* PostListEnd.json in Resources */ = {isa = PBXBuildFile; fileRef = 194C21E92B1F7C1600C62645 /* PostListEnd.json */; };
1972CCCF2B12438900C3C762 /* LoginEndPointFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1972CCCE2B12438900C3C762 /* LoginEndPointFactory.swift */; };
1972CCD22B125ED700C3C762 /* UserDefaultStored.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1972CCD12B125ED700C3C762 /* UserDefaultStored.swift */; };
1972CCD42B138E6B00C3C762 /* SignUpRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1972CCD32B138E6B00C3C762 /* SignUpRouter.swift */; };
Expand Down Expand Up @@ -90,8 +93,6 @@
835A61A92B0B5A31002F22A5 /* LoginConfigurator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 835A61A82B0B5A31002F22A5 /* LoginConfigurator.swift */; };
836C33872B15A29600ECAFB0 /* Toast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836C33862B15A29600ECAFB0 /* Toast.swift */; };
836C338B2B15D22C00ECAFB0 /* PlaybackConfigurator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836C338A2B15D22C00ECAFB0 /* PlaybackConfigurator.swift */; };
836C338D2B15D91F00ECAFB0 /* VideoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836C338C2B15D91F00ECAFB0 /* VideoDTO.swift */; };
836C338F2B160CC700ECAFB0 /* MemberDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836C338E2B160CC700ECAFB0 /* MemberDTO.swift */; };
836C33912B17629400ECAFB0 /* MapRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836C33902B17629400ECAFB0 /* MapRouter.swift */; };
836C33992B1843BE00ECAFB0 /* SettingScenePresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836C33932B1843BE00ECAFB0 /* SettingScenePresenter.swift */; };
836C339A2B1843BE00ECAFB0 /* SettingSceneWorker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836C33942B1843BE00ECAFB0 /* SettingSceneWorker.swift */; };
Expand Down Expand Up @@ -231,6 +232,9 @@
194C21CB2B1DF39200C62645 /* MockHomeWorker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockHomeWorker.swift; sourceTree = "<group>"; };
194C21CF2B1DF65200C62645 /* PostList.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = PostList.json; sourceTree = "<group>"; };
194C21D32B1EEE3700C62645 /* sample.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = sample.jpeg; sourceTree = "<group>"; };
194C21DB2B1F3ECA00C62645 /* GetMember.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = GetMember.json; sourceTree = "<group>"; };
194C21E52B1F7B5100C62645 /* PostListMore.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = PostListMore.json; sourceTree = "<group>"; };
194C21E92B1F7C1600C62645 /* PostListEnd.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = PostListEnd.json; sourceTree = "<group>"; };
1972CCCE2B12438900C3C762 /* LoginEndPointFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginEndPointFactory.swift; sourceTree = "<group>"; };
1972CCD12B125ED700C3C762 /* UserDefaultStored.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStored.swift; sourceTree = "<group>"; };
1972CCD32B138E6B00C3C762 /* SignUpRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpRouter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -281,8 +285,6 @@
835A61AA2B0B85FD002F22A5 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
836C33862B15A29600ECAFB0 /* Toast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toast.swift; sourceTree = "<group>"; };
836C338A2B15D22C00ECAFB0 /* PlaybackConfigurator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaybackConfigurator.swift; sourceTree = "<group>"; };
836C338C2B15D91F00ECAFB0 /* VideoDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoDTO.swift; sourceTree = "<group>"; };
836C338E2B160CC700ECAFB0 /* MemberDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemberDTO.swift; sourceTree = "<group>"; };
836C33902B17629400ECAFB0 /* MapRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapRouter.swift; sourceTree = "<group>"; };
836C33932B1843BE00ECAFB0 /* SettingScenePresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingScenePresenter.swift; sourceTree = "<group>"; };
836C33942B1843BE00ECAFB0 /* SettingSceneWorker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingSceneWorker.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -770,6 +772,9 @@
FC767F9A2B12283D0088CF9B /* PatchUserName.json */,
835783C52B14A5C800E7D304 /* LoginData.json */,
19A169352B178EA500DB34C0 /* PostList.json */,
194C21E52B1F7B5100C62645 /* PostListMore.json */,
194C21E92B1F7C1600C62645 /* PostListEnd.json */,
194C21DB2B1F3ECA00C62645 /* GetMember.json */,
1915D6E82B1FBABA00CE1DD0 /* CheckSignUp.json */,
);
path = MockData;
Expand Down Expand Up @@ -1045,18 +1050,21 @@
FC7E456A2AFEC06E004F155A /* .swiftlint.yml in Resources */,
FC767FA22B12283D0088CF9B /* PatchIntroduce.json in Resources */,
FC767FA32B12283D0088CF9B /* PatchProfileImage.json in Resources */,
194C21E62B1F7B5100C62645 /* PostListMore.json in Resources */,
FC4975942B03432800D8627F /* Pretendard-Regular.ttf in Resources */,
19A1694D2B18327E00DB34C0 /* sample.jpeg in Resources */,
FC767F9F2B12283D0088CF9B /* PatchUserName.json in Resources */,
FC49758F2B03432800D8627F /* Pretendard-SemiBold.ttf in Resources */,
835A61A62B0B4DDD002F22A5 /* Dashboard-Regular.ttf in Resources */,
194C21EA2B1F7C1600C62645 /* PostListEnd.json in Resources */,
835783C62B14A5C800E7D304 /* LoginData.json in Resources */,
FC767FA12B12283D0088CF9B /* DeleteUser.json in Resources */,
FC7E45462AFEB62B004F155A /* LaunchScreen.storyboard in Resources */,
19A169362B178EA500DB34C0 /* PostList.json in Resources */,
1915D6E92B1FBABA00CE1DD0 /* CheckSignUp.json in Resources */,
FC767FA02B12283D0088CF9B /* CheckUserName.json in Resources */,
FC4975932B03432800D8627F /* Pretendard-Bold.ttf in Resources */,
194C21DC2B1F3ECA00C62645 /* GetMember.json in Resources */,
FC7E45432AFEB62B004F155A /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1146,7 +1154,6 @@
836C33992B1843BE00ECAFB0 /* SettingScenePresenter.swift in Sources */,
FC2511A62B049020004717BC /* SignUpConfigurator.swift in Sources */,
194552392B05230E00299768 /* HomeCarouselCollectionViewCell.swift in Sources */,
836C338F2B160CC700ECAFB0 /* MemberDTO.swift in Sources */,
FC767FAA2B126D080088CF9B /* LOAnnotation.swift in Sources */,
19A169472B17D12500DB34C0 /* MockTagPlayListWorker.swift in Sources */,
193686722B15BCA7008902CD /* UserEndPointFactory.swift in Sources */,
Expand Down Expand Up @@ -1199,7 +1206,6 @@
FC68E29D2B02326A001AABFF /* Responsable.swift in Sources */,
FC2511A02B045C0A004717BC /* SignUpInteractor.swift in Sources */,
FC767F862B1214C10088CF9B /* CheckUserNameDTO.swift in Sources */,
836C338D2B15D91F00ECAFB0 /* VideoDTO.swift in Sources */,
FC5BE1232B1490660036366D /* EditProfileConfigurator.swift in Sources */,
1945522A2B04883800299768 /* UIView+.swift in Sources */,
FCE52FFA2B0FCB0A002CDB75 /* URLSession+.swift in Sources */,
Expand Down
1 change: 0 additions & 1 deletion iOS/Layover/Layover/Models/Member.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ struct Member {
let username: String
let introduce: String?
let profileImageURL: URL?
// board
}
2 changes: 1 addition & 1 deletion iOS/Layover/Layover/Network/DTOs/MemberDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

struct MemberDTO: Codable {
struct MemberDTO: Decodable {
let id: Int
let username, introduce: String
let profileImageURL: String
Expand Down
2 changes: 1 addition & 1 deletion iOS/Layover/Layover/Network/DTOs/ProfileImageDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

struct ProfileImageDTO: Codable {
struct ProfileImageDTO: Decodable {
let profileImage: URL

enum CodingKeys: String, CodingKey {
Expand Down
26 changes: 0 additions & 26 deletions iOS/Layover/Layover/Network/DTOs/VideoDTO.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
import Foundation

protocol UserEndPointFactory {
func makeUserNameIsDuplicateEndPoint(of userName: String) -> EndPoint<Response<CheckUserNameDTO>>
func makeUserNameIsNotDuplicateEndPoint(of userName: String) -> EndPoint<Response<CheckUserNameDTO>>
Copy link
Member

Choose a reason for hiding this comment

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

..valid의 부정의 부정의 부정의 부정의.. ㅎㅎ

func makeUserNameModifyEndPoint(userName: String) -> EndPoint<Response<NicknameDTO>>
func makeIntroduceModifyEndPoint(introduce: String) -> EndPoint<Response<IntroduceDTO>>
func makeUserWithDrawEndPoint() -> EndPoint<Response<NicknameDTO>>
func makeUserInformationEndPoint(with id: Int?) -> EndPoint<Response<MemberDTO>>
func makeUserPostsEndPoint(at page: Int, of id: Int?) -> EndPoint<Response<[PostDTO]>>
}

final class DefaultUserEndPointFactory: UserEndPointFactory {
func makeUserNameIsDuplicateEndPoint(of userName: String) -> EndPoint<Response<CheckUserNameDTO>> {
func makeUserNameIsNotDuplicateEndPoint(of userName: String) -> EndPoint<Response<CheckUserNameDTO>> {
var bodyParameters = [String: String]()
bodyParameters.updateValue(userName, forKey: "username")

Expand Down Expand Up @@ -55,4 +57,36 @@ final class DefaultUserEndPointFactory: UserEndPointFactory {
method: .DELETE
)
}

func makeUserInformationEndPoint(with id: Int? = nil) -> EndPoint<Response<MemberDTO>> {
if let id {
let queryParameters = ["id": id]
return EndPoint(
path: "/member",
method: .GET,
queryParameters: queryParameters
)
}

return EndPoint(
path: "/member",
method: .GET
)
}

func makeUserPostsEndPoint(at page: Int, of id: Int? = nil) -> EndPoint<Response<[PostDTO]>> {

var queryParameters = [String: String]()
queryParameters.updateValue(String(page), forKey: "page")

if let id {
queryParameters.updateValue(String(id), forKey: "id")
}

return EndPoint(
path: "/board/profile",
method: .GET,
queryParameters: queryParameters
)
}
}
11 changes: 11 additions & 0 deletions iOS/Layover/Layover/Network/Mock/MockData/GetMember.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"customCode": "SUCCESS",
"message": "성공",
"statusCode": 200,
"data": {
"id": 221,
"username": "hwani",
"introduce": "Hi, my name is hwani",
"profile_image_url": "https://qi-o.qoo10cdn.com/goods_image_big/3/3/1/6/8645113316_l.jpg"
}
}
8 changes: 8 additions & 0 deletions iOS/Layover/Layover/Network/Mock/MockData/PostListEnd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"customCode": "SUCCESS",
"message": "요청이 성공적으로 처리되었습니다.",
"statusCode": 200,
"data": [

]
}
79 changes: 79 additions & 0 deletions iOS/Layover/Layover/Network/Mock/MockData/PostListMore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"customCode": "SUCCESS",
"message": "요청이 성공적으로 처리되었습니다.",
"statusCode": 200,
"data": [
{
"member" : {
"id" : 5,
"username" : "loinsir",
"introduce" : "Hi, my name is hwani",
"profile_image_url" : "https://i.namu.wiki/i/HPFgEkrlX8wtU-agoxsqlzllzfJrcFkDSJYFQxdBHUNyjyZtUpS9zy-7-6lfz4ngzB-1wbLRyhIP4TmnwPwKJ0mUec5403r5TJnI3NZpsYJL6GEVQTmR52YoFGLMbaIe4aGSzh4B4InI9r2g0VV74g.svg"
},
"board" : {
"id" : 5,
"encoded_video_url" : "https://assets.afcdn.com/video49/20210722/v_645516.m3u8",
"video_thumbnail_url" : "https://think-note.com/wp-content/uploads/2023/07/eta_3.jpg",
"longitude" : "37.0532156213",
"latitude" : "127.060123123",
"title" : "최강 아이돌",
"content" : "게시글 설명"
},
"tag" : ["나도몰라요", "너도몰라요"]
},
{
"member" : {
"id" : 6,
"username" : "chopmozzi",
"introduce" : "Hi, my name is hwani",
"profile_image_url" : "https://m.segye.com/content/image/2023/03/15/20230315514234.jpg"
},
"board" : {
"id" : 6,
"encoded_video_url" : "https://qc66zhsq1708.edge.naverncp.com/hls/fMG98EEU8c1UirV-awtm4qKJyhaHRcnDymRFlPLZbTs_/layover-station/IMG_0136_AVC_,HD,SD,_1Pass_30fps.mp4.smil/master.m3u8",
"video_thumbnail_url" : "video_thumbnail_link",
"longitude" : "37.0532156213",
"latitude" : "127.060123123",
"title" : "프로듀스 101",
"content" : "게시글 설명"
},
"tag" : ["해시태그", "해시태그2"]
},
{
"member" : {
"id" : 7,
"username" : "anyukyung",
"introduce" : "Hi, my name is hwani",
"profile_image_url" : "https://images.khan.co.kr/article/2021/11/15/l_2021111502000877900178361.jpg"
},
"board" : {
"id" : 7,
"encoded_video_url" : "https://sample.vodobox.net/skate_phantom_flex_4k/skate_phantom_flex_4k.m3u8",
"video_thumbnail_url" : "https://cdnimg.melon.co.kr/resource/image/cds/musicstory/imgUrl20210831030133473.jpg/melon/quality/90/optimize",
"longitude" : "37.0532156213",
"latitude" : "127.060123123",
"title" : "프로미스 나인",
"content" : "게시글 설명"
},
"tag" : ["해시태그1", "해시태그2"]
},
{
"member" : {
"id" : 8,
"username" : "layover",
"introduce" : "Hi, my name is hwani",
"profile_image_url" : "profile_image_link"
},
"board" : {
"id" : 8,
"encoded_video_url" : "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"video_thumbnail_url" : "https://res.heraldm.com/content/image/2023/04/16/20230416000040_0.jpg",
"longitude" : "37.0532156213",
"latitude" : "127.060123123",
"title" : "아이즈원",
"content" : "게시글 설명2"
},
"tag" : ["해시태그1", "해시태그6"]
}
]
}
23 changes: 11 additions & 12 deletions iOS/Layover/Layover/Scenes/EditProfile/EditProfileInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// Copyright © 2023 CodeBomber. All rights reserved.
//

import UIKit
import Foundation
import OSLog

protocol EditProfileBusinessLogic {
func fetchProfile()
Expand All @@ -18,7 +19,7 @@ protocol EditProfileBusinessLogic {
protocol EditProfileDataStore {
var nickname: String? { get set }
var introduce: String? { get set }
var profileImage: UIImage? { get set }
var profileImageData: Data? { get set }
}

final class EditProfileInteractor: EditProfileBusinessLogic, EditProfileDataStore {
Expand All @@ -34,14 +35,14 @@ final class EditProfileInteractor: EditProfileBusinessLogic, EditProfileDataStor

var nickname: String?
var introduce: String?
var profileImage: UIImage?
var profileImageData: Data?

// MARK: - Use Case

func fetchProfile() {
presenter?.presentProfile(with: EditProfileModels.FetchProfile.Reponse(nickname: nickname,
introduce: introduce,
profileImage: profileImage))
profileImageData: profileImageData))
}

func validateProfileInfo(with request: Models.ValidateProfileInfo.Request) {
Expand All @@ -56,14 +57,12 @@ final class EditProfileInteractor: EditProfileBusinessLogic, EditProfileDataStor

func checkDuplication(with request: Models.CheckNicknameDuplication.Request) {
Task {
do {
let response = try await userWorker?.checkDuplication(for: request.nickname)
await MainActor.run {
presenter?.presentNicknameDuplication(with: Models.CheckNicknameDuplication.Response(isDuplicate: response ?? true))
}
} catch let error {
// TODO: present toast
print(error.localizedDescription)
guard let response = await userWorker?.checkNotDuplication(for: request.nickname) else {
os_log(.error, log: .data, "checkDuplication Server Error")
return
}
await MainActor.run {
presenter?.presentNicknameDuplication(with: Models.CheckNicknameDuplication.Response(isValid: response))
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions iOS/Layover/Layover/Scenes/EditProfile/EditProfileModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2023 CodeBomber. All rights reserved.
//

import UIKit
import Foundation

enum EditProfileModels {

Expand All @@ -18,13 +18,13 @@ enum EditProfileModels {
struct Reponse {
var nickname: String?
var introduce: String?
var profileImage: UIImage?
var profileImageData: Data?
}

struct ViewModel {
var nickname: String?
var introduce: String?
var profileImage: UIImage?
var profileImageData: Data?
}
}

Expand All @@ -51,7 +51,7 @@ enum EditProfileModels {
var nickname: String
}
struct Response {
var isDuplicate: Bool
var isValid: Bool
}
struct ViewModel {
var isValidNickname: Bool
Expand All @@ -65,7 +65,7 @@ enum EditProfileModels {
struct Request {
var nickname: String
var introduce: String?
var profileImage: UIImage?
var profileImage: Data?
}

struct Response {
Expand Down
Loading