Skip to content

Commit

Permalink
Merge pull request #191 from OMZigak/feat/#187-nicknameAp
Browse files Browse the repository at this point in the history
[Feat] 닉네임 api 연결
  • Loading branch information
hooni0918 authored Jul 16, 2024
2 parents 917f8bb + e20c7c6 commit ebacf86
Show file tree
Hide file tree
Showing 18 changed files with 537 additions and 227 deletions.
46 changes: 28 additions & 18 deletions KkuMulKum.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
789873342C3D1A7B00435E96 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789873312C3D1A7B00435E96 /* LoginView.swift */; };
789AD4B32C3C0093002E2688 /* SocialLoginResponseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789AD4B22C3C0093002E2688 /* SocialLoginResponseModel.swift */; };
789AD4B52C3C0147002E2688 /* ResissueResponseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789AD4B42C3C0147002E2688 /* ResissueResponseModel.swift */; };
789D73A72C46AF4900C7077D /* KeychainService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789D73A62C46AF4900C7077D /* KeychainService.swift */; };
789D73A92C46BBB000C7077D /* PagePromiseSegmentedControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789D73A82C46BBB000C7077D /* PagePromiseSegmentedControl.swift */; };
789D73AB2C46BEFF00C7077D /* ProfileTargetType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789D73AA2C46BEFF00C7077D /* ProfileTargetType.swift */; };
789D73AD2C46C19500C7077D /* ProfileModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 789D73AC2C46C19500C7077D /* ProfileModel.swift */; };
78AED1342C3D951F000AD80A /* NicknameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78AED1332C3D951F000AD80A /* NicknameViewController.swift */; };
78AED1372C3D98D1000AD80A /* NicknameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78AED1362C3D98D1000AD80A /* NicknameView.swift */; };
78B9286C2C29402C006D9942 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78B9286B2C29402C006D9942 /* AppDelegate.swift */; };
Expand All @@ -62,8 +66,9 @@
78BD61272C446A97005752FD /* LoginTargetType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78BD61262C446A97005752FD /* LoginTargetType.swift */; };
78BD612B2C4550A6005752FD /* Bundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78BD612A2C4550A6005752FD /* Bundle.swift */; };
78BD612F2C4561B9005752FD /* KeychainAccessible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78BD612E2C4561B9005752FD /* KeychainAccessible.swift */; };
78BD61312C456799005752FD /* KeychainService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78BD61302C456799005752FD /* KeychainService.swift */; };
78BD61342C45B4A7005752FD /* AuthService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78BD61332C45B4A7005752FD /* AuthService.swift */; };
78BD61362C463B82005752FD /* NicknameTargetType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78BD61352C463B82005752FD /* NicknameTargetType.swift */; };
78BD61382C463C8C005752FD /* NicknameModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78BD61372C463C8C005752FD /* NicknameModel.swift */; };
A3DD9C3D2C41BAD000E58A13 /* MeetingTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C322C41BAD000E58A13 /* MeetingTableViewCell.swift */; };
A3DD9C3F2C41BAD000E58A13 /* MeetingListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C362C41BAD000E58A13 /* MeetingListView.swift */; };
A3DD9C402C41BAD000E58A13 /* MeetingListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C382C41BAD000E58A13 /* MeetingListViewController.swift */; };
Expand Down Expand Up @@ -202,6 +207,10 @@
789873312C3D1A7B00435E96 /* LoginView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = "<group>"; };
789AD4B22C3C0093002E2688 /* SocialLoginResponseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocialLoginResponseModel.swift; sourceTree = "<group>"; };
789AD4B42C3C0147002E2688 /* ResissueResponseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResissueResponseModel.swift; sourceTree = "<group>"; };
789D73A62C46AF4900C7077D /* KeychainService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainService.swift; sourceTree = "<group>"; };
789D73A82C46BBB000C7077D /* PagePromiseSegmentedControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PagePromiseSegmentedControl.swift; sourceTree = "<group>"; };
789D73AA2C46BEFF00C7077D /* ProfileTargetType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileTargetType.swift; sourceTree = "<group>"; };
789D73AC2C46C19500C7077D /* ProfileModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileModel.swift; sourceTree = "<group>"; };
78AED1312C3D94F2000AD80A /* KkuMulKum.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = KkuMulKum.entitlements; sourceTree = "<group>"; };
78AED1332C3D951F000AD80A /* NicknameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameViewController.swift; sourceTree = "<group>"; };
78AED1362C3D98D1000AD80A /* NicknameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameView.swift; sourceTree = "<group>"; };
Expand All @@ -214,8 +223,9 @@
78BD61262C446A97005752FD /* LoginTargetType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginTargetType.swift; sourceTree = "<group>"; };
78BD612A2C4550A6005752FD /* Bundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = "<group>"; };
78BD612E2C4561B9005752FD /* KeychainAccessible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainAccessible.swift; sourceTree = "<group>"; };
78BD61302C456799005752FD /* KeychainService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainService.swift; sourceTree = "<group>"; };
78BD61332C45B4A7005752FD /* AuthService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthService.swift; sourceTree = "<group>"; };
78BD61352C463B82005752FD /* NicknameTargetType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameTargetType.swift; sourceTree = "<group>"; };
78BD61372C463C8C005752FD /* NicknameModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameModel.swift; sourceTree = "<group>"; };
A3DD9C322C41BAD000E58A13 /* MeetingTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingTableViewCell.swift; sourceTree = "<group>"; };
A3DD9C362C41BAD000E58A13 /* MeetingListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingListView.swift; sourceTree = "<group>"; };
A3DD9C382C41BAD000E58A13 /* MeetingListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingListViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -280,7 +290,6 @@
DD931B752C3DC16100526452 /* PromiseInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromiseInfoView.swift; sourceTree = "<group>"; };
DDA2EE722C385EB9007C6059 /* MainTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabBarController.swift; sourceTree = "<group>"; };
DDAF1C832C3D5D19008A37D3 /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = "<group>"; };
DDAF1C892C3D6E3D008A37D3 /* PagePromiseSegmentedControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PagePromiseSegmentedControl.swift; sourceTree = "<group>"; };
DDAF1C8A2C3D6E3D008A37D3 /* PagePromiseViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PagePromiseViewModel.swift; sourceTree = "<group>"; };
DDAF1C8B2C3D6E3D008A37D3 /* TardyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TardyViewController.swift; sourceTree = "<group>"; };
DDAF1C8C2C3D6E3D008A37D3 /* PromiseInfoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PromiseInfoViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -515,6 +524,8 @@
isa = PBXGroup;
children = (
78BD61262C446A97005752FD /* LoginTargetType.swift */,
78BD61352C463B82005752FD /* NicknameTargetType.swift */,
789D73AA2C46BEFF00C7077D /* ProfileTargetType.swift */,
);
path = TargetType;
sourceTree = "<group>";
Expand All @@ -531,19 +542,11 @@
isa = PBXGroup;
children = (
78BD612E2C4561B9005752FD /* KeychainAccessible.swift */,
78BD61302C456799005752FD /* KeychainService.swift */,
789D73A62C46AF4900C7077D /* KeychainService.swift */,
);
path = KeyChain;
sourceTree = "<group>";
};
78BD61322C45B4A7005752FD /* Service */ = {
isa = PBXGroup;
children = (
78BD61332C45B4A7005752FD /* AuthService.swift */,
);
path = Service;
sourceTree = "<group>";
};
A3DD9C372C41BAD000E58A13 /* View */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -582,6 +585,7 @@
A3DD9C642C45B30600E58A13 /* Service */ = {
isa = PBXGroup;
children = (
78BD61332C45B4A7005752FD /* AuthService.swift */,
A3DD9C612C455E3300E58A13 /* MeetingListService.swift */,
);
path = Service;
Expand Down Expand Up @@ -703,7 +707,7 @@
DD3976902C41CACF00E2A4C4 /* View */ = {
isa = PBXGroup;
children = (
DDAF1C892C3D6E3D008A37D3 /* PagePromiseSegmentedControl.swift */,
789D73A82C46BBB000C7077D /* PagePromiseSegmentedControl.swift */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -947,8 +951,8 @@
DD865B652C3920F600C351A2 /* Onboarding */ = {
isa = PBXGroup;
children = (
DDFA50782C4693BD000A62E2 /* Profile */,
782B40762C3E389F008B0CA7 /* Welcome */,
DDFA50782C4693BD000A62E2 /* Profile */,
78AED1322C3D9514000AD80A /* Nickname */,
DD865B662C39210E00C351A2 /* Login */,
);
Expand All @@ -958,7 +962,6 @@
DD865B662C39210E00C351A2 /* Login */ = {
isa = PBXGroup;
children = (
78BD61322C45B4A7005752FD /* Service */,
789873372C3D1B4800435E96 /* ViewController */,
789873362C3D1B3900435E96 /* VIewModel */,
789873352C3D1B3000435E96 /* View */,
Expand Down Expand Up @@ -1008,8 +1011,8 @@
DDFA50782C4693BD000A62E2 /* Profile */ = {
isa = PBXGroup;
children = (
DDFA50792C4693BD000A62E2 /* ViewModel */,
DDFA507B2C4693BD000A62E2 /* View */,
DDFA50792C4693BD000A62E2 /* ViewModel */,
DDFA507D2C4693BD000A62E2 /* VIewController */,
);
path = Profile;
Expand Down Expand Up @@ -1275,6 +1278,8 @@
DE9E18912C3BCC9D00DB76B4 /* SocialLoginRequestModel.swift */,
789AD4B22C3C0093002E2688 /* SocialLoginResponseModel.swift */,
789AD4B42C3C0147002E2688 /* ResissueResponseModel.swift */,
78BD61372C463C8C005752FD /* NicknameModel.swift */,
789D73AC2C46C19500C7077D /* ProfileModel.swift */,
);
path = Auth;
sourceTree = "<group>";
Expand Down Expand Up @@ -1482,6 +1487,7 @@
DED5DBEC2C345210006ECE7E /* BaseViewController.swift in Sources */,
DE6D4D142C3F14D80005584B /* MeetingPromiseCell.swift in Sources */,
DD3976892C41C2AD00E2A4C4 /* TodayEmptyView.swift in Sources */,
789D73A72C46AF4900C7077D /* KeychainService.swift in Sources */,
DD43937C2C412F4500EC1799 /* InviteCodeViewController.swift in Sources */,
DD4393782C412F4500EC1799 /* CheckInviteCodeView.swift in Sources */,
DD8626622C4606A300E4F980 /* ReadyStatusViewModel.swift in Sources */,
Expand All @@ -1505,6 +1511,7 @@
DEBA03312C3C2972002ED8F2 /* ViewController.swift in Sources */,
DD43937D2C412F4500EC1799 /* CheckInviteCodeViewController.swift in Sources */,
DD4393772C412F4500EC1799 /* CreateMeetingView.swift in Sources */,
78BD61362C463B82005752FD /* NicknameTargetType.swift in Sources */,
789873342C3D1A7B00435E96 /* LoginView.swift in Sources */,
782B40822C3E4925008B0CA7 /* NicknameViewModel.swift in Sources */,
A3FB18592C3BF77D001483E5 /* MeetingInfoResponseModel.swift in Sources */,
Expand All @@ -1523,9 +1530,11 @@
DDAF1C922C3D6E3D008A37D3 /* PromiseInfoViewController.swift in Sources */,
78AED1342C3D951F000AD80A /* NicknameViewController.swift in Sources */,
DE254AB42C31199B00A4015E /* UITextField+.swift in Sources */,
78BD61382C463C8C005752FD /* NicknameModel.swift in Sources */,
DDAF1C912C3D6E3D008A37D3 /* TardyViewController.swift in Sources */,
782B407D2C3E3984008B0CA7 /* WelcomeViewController.swift in Sources */,
DE8248002C36E857000601BC /* ObservablePattern.swift in Sources */,
789D73A92C46BBB000C7077D /* PagePromiseSegmentedControl.swift in Sources */,
DDAF1C902C3D6E3D008A37D3 /* PagePromiseViewModel.swift in Sources */,
DE254AAA2C31190E00A4015E /* UIStackView+.swift in Sources */,
DE159D362C406E1600425101 /* MyPageViewController.swift in Sources */,
Expand Down Expand Up @@ -1564,6 +1573,7 @@
78B9286E2C29402C006D9942 /* SceneDelegate.swift in Sources */,
DD39766F2C41B54400E2A4C4 /* InviteCodeService.swift in Sources */,
DE6D4D172C3F14D80005584B /* MeetingInfoViewModel.swift in Sources */,
789D73AD2C46C19500C7077D /* ProfileModel.swift in Sources */,
78AED1372C3D98D1000AD80A /* NicknameView.swift in Sources */,
A3FB185B2C3BF7DF001483E5 /* MeetingMembersResponseModel.swift in Sources */,
DD3072222C3C0DA300416D9F /* PromiseParticipantListResponseModel.swift in Sources */,
Expand All @@ -1584,9 +1594,9 @@
DD39766B2C41995A00E2A4C4 /* FinishCreateNavigationView.swift in Sources */,
DD3072202C3C0D4500416D9F /* MyReadyStatusResponseModel.swift in Sources */,
DD931B6E2C3DA27F00526452 /* ParticipantCollectionViewCell.swift in Sources */,
789D73AB2C46BEFF00C7077D /* ProfileTargetType.swift in Sources */,
DD3976882C41C2AD00E2A4C4 /* UpcomingEmptyView.swift in Sources */,
DD931B762C3DC16100526452 /* PromiseInfoView.swift in Sources */,
78BD61312C456799005752FD /* KeychainService.swift in Sources */,
DD3072242C3C0EB200416D9F /* MyPromiseReadyInfoRequestModel.swift in Sources */,
DD3976872C41C2AD00E2A4C4 /* TodayPromiseView.swift in Sources */,
789873332C3D1A7B00435E96 /* LoginViewModel.swift in Sources */,
Expand Down Expand Up @@ -1751,7 +1761,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = KkuMulKum/KkuMulKum.entitlements;
CODE_SIGN_ENTITLEMENTS = KkuMulKum/KkuMulKumDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
Expand Down
14 changes: 14 additions & 0 deletions KkuMulKum/KkuMulKumDebug.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)KkuMulKum.yizihn</string>
</array>
</dict>
</plist>
12 changes: 12 additions & 0 deletions KkuMulKum/Network/DTO/Model/Auth/NicknameModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// NicknameModel.swift
// KkuMulKum
//
// Created by 이지훈 on 7/16/24.
//

import Foundation

struct NameResponseModel: ResponseModelType {
let name: String
}
12 changes: 12 additions & 0 deletions KkuMulKum/Network/DTO/Model/Auth/ProfileModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// ProfileModel.swift
// KkuMulKum
//
// Created by 이지훈 on 7/16/24.
//

import Foundation

struct ProfileImageResponseModel: ResponseModelType {
// 성공 시 data가 null
}
54 changes: 54 additions & 0 deletions KkuMulKum/Network/DTO/TargetType/NicknameTargetType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// LoginTatgetType.swift
// KkuMulKum
//
// Created by 이지훈 on 7/16/24.
//

import Foundation

import Moya

enum NicknameTargetType {
case updateName(name: String)
}

extension NicknameTargetType: TargetType {

var baseURL: URL {
guard let privacyInfo = Bundle.main.privacyInfo,
let urlString = privacyInfo["BASE_URL"] as? String,
let url = URL(string: urlString) else {
fatalError("Invalid BASE_URL in PrivacyInfo.plist")
}
return url
}

var path: String {
switch self {
case .updateName:
return "/api/v1/users/me/name"
}
}

var method: Moya.Method {
switch self {
case .updateName:
return .patch
}
}

var task: Task {
switch self {
case .updateName(let name):
return .requestParameters(parameters: ["name": name], encoding: JSONEncoding.default)
}
}

var headers: [String : String]? {
guard let token = DefaultKeychainService.shared.accessToken else {
fatalError("No access token available")
}
return ["Content-Type": "application/json", "Authorization": "Bearer \(token)"]
}
}
59 changes: 59 additions & 0 deletions KkuMulKum/Network/DTO/TargetType/ProfileTargetType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// ProfileTargetType.swift
// KkuMulKum
//
// Created by 이지훈 on 7/16/24.
//

import Foundation

import Moya

enum ProfileTargetType {
///jpg 고정이 아닌 jpg, png, webp 같이 받기위함
case updateProfileImage(image: Data, fileName: String, mimeType: String)
}

extension ProfileTargetType: TargetType {
var baseURL: URL {
guard let privacyInfo = Bundle.main.privacyInfo,
let urlString = privacyInfo["BASE_URL"] as? String,
let url = URL(string: urlString) else {
fatalError("Invalid BASE_URL in PrivacyInfo.plist")
}
return url
}

var path: String {
return "/api/v1/users/me/image"
}

var method: Moya.Method {
return .patch
}

var task: Task {
switch self {
case .updateProfileImage(let imageData, let fileName, let mimeType):
let formData: [MultipartFormData] = [
MultipartFormData(
provider: .data(imageData),
name: "image",
fileName: fileName,
mimeType: mimeType
)
]
return .uploadMultipart(formData)
}
}

var headers: [String : String]? {
guard let token = DefaultKeychainService.shared.accessToken else {
return ["Content-Type": "multipart/form-data"]
}
return [
"Authorization": "Bearer \(token)",
"Content-Type": "multipart/form-data"
]
}
}
Loading

0 comments on commit ebacf86

Please sign in to comment.