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

[Design&Network] #233 - MyPageProfileVisibilityView UI 및 API 연결 #235

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 19 additions & 7 deletions WSSiOS/WSSiOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,17 @@
2C9A196D2C5692370043044A /* MyPageSettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9A196C2C5692360043044A /* MyPageSettingView.swift */; };
2C9A196F2C56923B0043044A /* MyPageSettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9A196E2C56923B0043044A /* MyPageSettingViewController.swift */; };
2C9A19712C56925F0043044A /* MyPageInfoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9A19702C56925F0043044A /* MyPageInfoViewModel.swift */; };
2C9BDDA42CA79BCA0026D038 /* Then in Frameworks */ = {isa = PBXBuildFile; productRef = 2C9BDDA32CA79BCA0026D038 /* Then */; };
2C9CBDB12C5BB4340084481F /* BlocksService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C9CBDB02C5BB4340084481F /* BlocksService.swift */; };
2CA2F6522B527B590045B4C2 /* MyPageModalAvatarFeatureLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA2F6512B527B590045B4C2 /* MyPageModalAvatarFeatureLabelView.swift */; };
2CA2F65B2B53041E0045B4C2 /* LibraryBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA2F65A2B53041E0045B4C2 /* LibraryBaseViewController.swift */; };
2CA2F6602B530B660045B4C2 /* LibraryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA2F65F2B530B650045B4C2 /* LibraryView.swift */; };
2CA2F6622B530BBF0045B4C2 /* LibraryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA2F6612B530BBF0045B4C2 /* LibraryCollectionViewCell.swift */; };
2CB613F32B575E4500FC3F89 /* MyPageInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB613F22B575E4500FC3F89 /* MyPageInfoViewController.swift */; };
2CB613F52B575E6A00FC3F89 /* MyPageInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB613F42B575E6A00FC3F89 /* MyPageInfoView.swift */; };
2CC4CCCB2C9AF8B000FB863B /* Then in Frameworks */ = {isa = PBXBuildFile; productRef = 2CC4CCCA2C9AF8B000FB863B /* Then */; };
2CC4CCD82C9B340900FB863B /* MyPageProfileVisibilityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC4CCD72C9B340800FB863B /* MyPageProfileVisibilityView.swift */; };
2CC4CCDA2C9B341300FB863B /* MyPageProfileVisibilityViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC4CCD92C9B341200FB863B /* MyPageProfileVisibilityViewModel.swift */; };
2CC4CCDC2C9B341900FB863B /* MyPageProfileVisibilityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC4CCDB2C9B341900FB863B /* MyPageProfileVisibilityViewController.swift */; };
2CCBF9EE2B4C1FC500D787C2 /* MyPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCBF9ED2B4C1FC500D787C2 /* MyPageViewController.swift */; };
2CCBF9F02B4C1FD800D787C2 /* MyPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCBF9EF2B4C1FD800D787C2 /* MyPageView.swift */; };
2CCBF9F22B4D347B00D787C2 /* WSSMainButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCBF9F12B4D347B00D787C2 /* WSSMainButton.swift */; };
Expand Down Expand Up @@ -384,6 +387,9 @@
2CA2F6612B530BBF0045B4C2 /* LibraryCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibraryCollectionViewCell.swift; sourceTree = "<group>"; };
2CB613F22B575E4500FC3F89 /* MyPageInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageInfoViewController.swift; sourceTree = "<group>"; };
2CB613F42B575E6A00FC3F89 /* MyPageInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageInfoView.swift; sourceTree = "<group>"; };
2CC4CCD72C9B340800FB863B /* MyPageProfileVisibilityView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyPageProfileVisibilityView.swift; sourceTree = "<group>"; };
2CC4CCD92C9B341200FB863B /* MyPageProfileVisibilityViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyPageProfileVisibilityViewModel.swift; sourceTree = "<group>"; };
2CC4CCDB2C9B341900FB863B /* MyPageProfileVisibilityViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyPageProfileVisibilityViewController.swift; sourceTree = "<group>"; };
2CCBF9ED2B4C1FC500D787C2 /* MyPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageViewController.swift; sourceTree = "<group>"; };
2CCBF9EF2B4C1FD800D787C2 /* MyPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageView.swift; sourceTree = "<group>"; };
2CCBF9F12B4D347B00D787C2 /* WSSMainButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSSMainButton.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -649,7 +655,7 @@
files = (
3999BFEE2B4E6CA000984832 /* UIImageViewAlignedSwift in Frameworks */,
CD3E5A852B54254F00C0A659 /* RxKeyboard in Frameworks */,
2CC4CCCB2C9AF8B000FB863B /* Then in Frameworks */,
2C9BDDA42CA79BCA0026D038 /* Then in Frameworks */,
2CD229442B42E7A2005400BE /* RxRelay in Frameworks */,
2CD229392B42E77F005400BE /* Kingfisher in Frameworks */,
2CD229342B42E771005400BE /* SnapKit in Frameworks */,
Expand Down Expand Up @@ -813,6 +819,7 @@
2CCBF9EA2B4C1E3700D787C2 /* MyPageViewController */ = {
isa = PBXGroup;
children = (
2CC4CCDB2C9B341900FB863B /* MyPageProfileVisibilityViewController.swift */,
2CCBF9ED2B4C1FC500D787C2 /* MyPageViewController.swift */,
2C5D0F5E2B50523B00C76D3C /* MyPageChangeNicknameViewController.swift */,
2C9A196E2C56923B0043044A /* MyPageSettingViewController.swift */,
Expand All @@ -827,6 +834,7 @@
2CCBF9EB2B4C1E4600D787C2 /* MyPageView */ = {
isa = PBXGroup;
children = (
2CC4CCD72C9B340800FB863B /* MyPageProfileVisibilityView.swift */,
2CCBF9EF2B4C1FD800D787C2 /* MyPageView.swift */,
2C5D0F602B50525700C76D3C /* MyPageChangeNicknameView.swift */,
2CB613F42B575E6A00FC3F89 /* MyPageInfoView.swift */,
Expand All @@ -843,6 +851,7 @@
2CCBF9FD2B4DBF4200D787C2 /* MyPageViewModel */ = {
isa = PBXGroup;
children = (
2CC4CCD92C9B341200FB863B /* MyPageProfileVisibilityViewModel.swift */,
2C9A19702C56925F0043044A /* MyPageInfoViewModel.swift */,
2CCBF9FF2B4DBFD200D787C2 /* MyPageChangeNickNameViewModel.swift */,
2C9A19682C567D6B0043044A /* MyPageViewModel.swift */,
Expand Down Expand Up @@ -2120,7 +2129,7 @@
39EF97AB2B53E43800D2148B /* Lottie */,
CD3E5A842B54254F00C0A659 /* RxKeyboard */,
3916EC852B89B42C007835B5 /* RxGesture */,
2CC4CCCA2C9AF8B000FB863B /* Then */,
2C9BDDA32CA79BCA0026D038 /* Then */,
);
productName = WSSiOS;
productReference = 2CD229182B42E685005400BE /* WSSiOS.app */;
Expand Down Expand Up @@ -2158,7 +2167,7 @@
3999BFEC2B4E6CA000984832 /* XCRemoteSwiftPackageReference "UIImageViewAlignedSwift" */,
CD3E5A832B54254F00C0A659 /* XCRemoteSwiftPackageReference "RxKeyboard" */,
3916EC842B89B42C007835B5 /* XCRemoteSwiftPackageReference "RxGesture" */,
2CC4CCC92C9AF8B000FB863B /* XCRemoteSwiftPackageReference "Then" */,
2C9BDDA22CA79BCA0026D038 /* XCRemoteSwiftPackageReference "Then" */,
);
productRefGroup = 2CD229192B42E685005400BE /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -2228,6 +2237,7 @@
CD3E5A822B54253E00C0A659 /* MemoEditViewController.swift in Sources */,
B9AC1BD22BF0B485006EDE92 /* HomeNoticeView.swift in Sources */,
C9063A972BD3F868006AD8F9 /* HomeRealtimePopularView.swift in Sources */,
2CC4CCDC2C9B341900FB863B /* MyPageProfileVisibilityViewController.swift in Sources */,
A1708F182B4D8E2F00E35E50 /* HomeView.swift in Sources */,
2C19A4FD2BBA90E700D4D151 /* WSSDropDownTableView.swift in Sources */,
2C9A19672C567CC20043044A /* MyPageProfileHeaderView.swift in Sources */,
Expand Down Expand Up @@ -2276,6 +2286,7 @@
CD6F49552C705B22005AD392 /* FeedNovelConnectCollectionViewCell.swift in Sources */,
2C9A19692C567D6B0043044A /* MyPageViewModel.swift in Sources */,
C9AF1AE22BCC234300208BC9 /* HomeTodayPopularView.swift in Sources */,
2CC4CCD82C9B340900FB863B /* MyPageProfileVisibilityView.swift in Sources */,
2CD9115E2C0D8A28006B8D72 /* FeedGenreViewController.swift in Sources */,
39F687002C6F60400065999F /* ReadStatus.swift in Sources */,
39CC16902B529AB6003F56AE /* RegisterNormalReadStatusView.swift in Sources */,
Expand Down Expand Up @@ -2375,6 +2386,7 @@
CD39F2DA2B50DDBF00B73A5C /* TrashNovelDetailInfoGenreView.swift in Sources */,
39F686FE2C6F5D5C0065999F /* NovelDetailInfoReviewGraphStackView.swift in Sources */,
2CD9114A2C0D8948006B8D72 /* FeedContentView.swift in Sources */,
2CC4CCDA2C9B341300FB863B /* MyPageProfileVisibilityViewModel.swift in Sources */,
B9A0FD6E2BFCF16F0004252E /* HomeRealtimePopularContentTableViewCell.swift in Sources */,
C99DDFDF2C8613C900EDC0C4 /* SearchViewController.swift in Sources */,
2CD9114A2C0D8948006B8D72 /* FeedContentView.swift in Sources */,
Expand Down Expand Up @@ -2716,7 +2728,7 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
2CC4CCC92C9AF8B000FB863B /* XCRemoteSwiftPackageReference "Then" */ = {
2C9BDDA22CA79BCA0026D038 /* XCRemoteSwiftPackageReference "Then" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/devxoul/Then";
requirement = {
Expand Down Expand Up @@ -2783,9 +2795,9 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
2CC4CCCA2C9AF8B000FB863B /* Then */ = {
2C9BDDA32CA79BCA0026D038 /* Then */ = {
isa = XCSwiftPackageProductDependency;
package = 2CC4CCC92C9AF8B000FB863B /* XCRemoteSwiftPackageReference "Then" */;
package = 2C9BDDA22CA79BCA0026D038 /* XCRemoteSwiftPackageReference "Then" */;
productName = Then;
};
2CD229332B42E771005400BE /* SnapKit */ = {
Expand Down
2 changes: 1 addition & 1 deletion WSSiOS/WSSiOS/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }

let navigationController = UINavigationController(rootViewController: WSSTabBarController())
let navigationController = UINavigationController(rootViewController: MyPageSettingViewController())
Copy link
Contributor

Choose a reason for hiding this comment

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

W3
메인 당겨와서 브랜치 최신화 할 때 까먹지말기~~

navigationController.isNavigationBarHidden = true

self.window = UIWindow(windowScene: windowScene)
Expand Down
48 changes: 48 additions & 0 deletions WSSiOS/WSSiOS/Network/User/UserService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ protocol UserService {
func getUserData() -> Single<UserResult>
func patchUserName(userNickName: String) -> Single<Void>
func getUserCharacterData() -> Single<UserCharacter>
func getUserProfileVisibility() -> Single<UserProfileVisibility>
func patchUserProfileVisibility(isProfilePublic: Bool) -> Single<Void>
}

final class DefaultUserService: NSObject, Networking {
private let userNickNameQueryItems: [URLQueryItem] = [URLQueryItem(name: "userNickname",
value: String(describing: 10))]

func makeUserProfileVisibilityQueryItems(isProfilePublic: Bool) -> [URLQueryItem] {
return [ URLQueryItem(name: "isProfilePublic",
value: String(isProfilePublic))]
}

private var urlSession: URLSession = URLSession(configuration: URLSessionConfiguration.default,
delegate: nil,
delegateQueue: nil)
Expand Down Expand Up @@ -84,6 +92,46 @@ extension DefaultUserService: UserService {
return Single.error(error)
}
}

func getUserProfileVisibility() -> RxSwift.Single<UserProfileVisibility> {
do {
let request = try makeHTTPRequest(method: .get,
path: URLs.MyPage.ProfileVisibility.isProfileVisibility,
headers: APIConstants.testTokenHeader,
body: nil)
NetworkLogger.log(request: request)

return urlSession.rx.data(request: request)
.map {
try self.decode(data: $0,
to: UserProfileVisibility.self)
}
.asSingle()
} catch {
return Single.error(error)
}
}

func patchUserProfileVisibility(isProfilePublic: Bool) -> RxSwift.Single<Void> {
guard let userProfileVisibility = try? JSONEncoder().encode(UserProfileVisibility(isProfilePublic: isProfilePublic)) else {
return .error(NetworkServiceError.invalidRequestError)
}

do {
let request = try makeHTTPRequest(method: .patch,
path: URLs.MyPage.ProfileVisibility.isProfileVisibility,
queryItems: makeUserProfileVisibilityQueryItems(isProfilePublic: isProfilePublic),
headers: APIConstants.testTokenHeader,
body: nil)
NetworkLogger.log(request: request)

return urlSession.rx.data(request: request)
.map { _ in }
.asSingle()
} catch {
return Single.error(error)
}
}
}


This file was deleted.

This file was deleted.

6 changes: 6 additions & 0 deletions WSSiOS/WSSiOS/Resource/Constants/Strings/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum StringLiterals {
static let myPageSetting = "설정"
static let myPageInfo = "계정설정"
static let myPageBlockUser = "차단유저 목록"
static let isVisibleProfile = "프로필 공개 설정"
}
}

Expand Down Expand Up @@ -209,6 +210,11 @@ enum StringLiterals {
case second = "리뷰, 피드 게시글, 댓글은 탈퇴 시 자동으로 삭제되지 않아요. 탈퇴 전 개별적으로 삭제해 주세요."
case third = "계정 정보는 탈퇴 즉시 삭제되어 바로 재가입 가능하지만, 회원가입부터 작품 평가를 다시 해야 해요."
}

enum isVisiableProfile {
static let completeTitle = "완료"
static let isPrivateProfile = "비공개"
}
}

enum Library {
Expand Down
3 changes: 3 additions & 0 deletions WSSiOS/WSSiOS/Resource/Constants/URLs/URLs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ enum URLs {
return "/blocks/\(blockID)"
}
}
enum ProfileVisibility {
static let isProfileVisibility = "/users/profile-status"
}
}

enum Recommend {
Expand Down
13 changes: 13 additions & 0 deletions WSSiOS/WSSiOS/Resource/Extensions/UIViewController+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,19 @@ extension UIViewController {

self.dismiss(animated: true)
}

func pushToMyPageProfileVisibilityViewController() {
let viewController = MyPageProfileVisibilityViewController(
viewModel: MyPageProfileVisibilityViewModel(
userRepository: DefaultUserRepository(
userService: DefaultUserService(),
blocksService: DefaultBlocksService()
)
)
)

self.navigationController?.pushViewController(viewController, animated: true)
}
}

extension UIViewController: UIGestureRecognizerDelegate {
Expand Down
4 changes: 4 additions & 0 deletions WSSiOS/WSSiOS/Source/Data/DTO/MyProfileResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ struct UserAvatar: Codable {
struct UserNickNameResult: Codable {
let userNickname: String
}

struct UserProfileVisibility: Codable {
let isProfilePublic: Bool
}
12 changes: 12 additions & 0 deletions WSSiOS/WSSiOS/Source/Data/Repository/UserRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ protocol UserRepository {
func getUserCharacter() -> Observable<UserCharacter>
func getBlocksList() -> Observable<BlockUserResult>
func deleteBlockUser(blockID: Int) -> Observable<Void>
func getUserProfileVisibility() -> Observable<UserProfileVisibility>
func patchUserProfileVisibility(isProfilePublic: Bool) -> Observable<Void>
}

struct DefaultUserRepository: UserRepository {
Expand Down Expand Up @@ -63,4 +65,14 @@ struct DefaultUserRepository: UserRepository {
return blocksService.deleteBlockUser(blockID: blockID)
.asObservable()
}

func getUserProfileVisibility() -> Observable<UserProfileVisibility> {
return userService.getUserProfileVisibility()
.asObservable()
}

func patchUserProfileVisibility(isProfilePublic: Bool) -> Observable<Void> {
return userService.patchUserProfileVisibility(isProfilePublic: isProfilePublic)
.asObservable()
}
}
Loading