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/#169 Api Success Response 설정 #170

Merged
merged 69 commits into from
Jun 30, 2024
Merged
Changes from 18 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
305f9e7
chore: Bookmark -> Bookmarks
realhsb Jun 18, 2024
8a92c41
feat: Bookmark API
realhsb Jun 18, 2024
7141ef7
feat: Bookmarks Service
realhsb Jun 18, 2024
e9b2248
chore: Macro 적용 후 @StateObject 제거
realhsb Jun 18, 2024
b5a7f59
chore: NewsList 뷰 spacing 삭제
realhsb Jun 18, 2024
67e45ef
feat: 북마크뷰 수정
realhsb Jun 18, 2024
82c53db
chore: News 폴더 수정
realhsb Jun 18, 2024
ec8031e
Merge pull request #152 from tukcomCD2024/Dev-backend
yeonjy Jun 18, 2024
93999e1
feat: AuthAPI -> LoginService 이름 수정
realhsb Jun 18, 2024
f0fc24f
feat: baseURL 수정
realhsb Jun 18, 2024
1c20dff
feat: Auth (서버 토큰 response) 모델 생성
realhsb Jun 18, 2024
34027cd
feat: login API 추가
realhsb Jun 18, 2024
b078e14
chore: AuthVM 수정
realhsb Jun 18, 2024
3b45212
chore: 로그인 버튼 로직 수정
realhsb Jun 18, 2024
2ee803c
chore: auth 모델 변수명 수정
realhsb Jun 18, 2024
fbca176
feat: auth request 모델 추가
realhsb Jun 18, 2024
6f74dce
chore: auth request 모델 적용
realhsb Jun 18, 2024
2e2914d
chore: auth VM 수정
realhsb Jun 18, 2024
2290a33
Merge pull request #153 from tukcomCD2024/feat/#149-ios-bookmarks-api
realhsb Jun 18, 2024
ad8fc2d
fix & feat : 토론방 생성 API 연동 완료
yeahzxnn Jun 19, 2024
8bec2de
fix & feat : ChatGPT와유저간의 토론 API 구현 완료
yeahzxnn Jun 19, 2024
fb88f32
feat : 최근 본 뉴스 API 연동하기
yeahzxnn Jun 19, 2024
0c05871
Merge pull request #155 from tukcomCD2024/Feat/#154_ios_fixdebatepush…
yeahzxnn Jun 19, 2024
330776f
feat : 최근 읽은 뉴스 조회 API 연동 완료
yeahzxnn Jun 19, 2024
f69c2b5
fix : ChatGPT가 채팅 시작하는 로직으로 변경
yeahzxnn Jun 19, 2024
fbfb1eb
feat: 토론 종료 API 연결 및 토론 요약 화면 넘어가기 구현
yeahzxnn Jun 19, 2024
8b3e2a9
fix : 토론 종료 후 다시 이전화면으로 돌아오는 것으로 로직 수정
yeahzxnn Jun 19, 2024
e168c18
feat: 통계 API
realhsb Jun 19, 2024
2b41196
chore: Daily Report (일별 조회수 조회) Model 수정
realhsb Jun 19, 2024
c2a16b1
chore: Daily Report (일별 조회수 조회) View & ViewModel 수정
realhsb Jun 19, 2024
e2b1c8b
feat: Statistics Service
realhsb Jun 19, 2024
ee8349b
feat: Type Report Model (카테고리별 조회수)
realhsb Jun 19, 2024
ae15c2f
feat: Type Report View & ViewModel (카테고리별 조회수)
realhsb Jun 19, 2024
7abdbc6
chore: NewsType enum 수정
realhsb Jun 19, 2024
73b1ee0
chore: Statistics Service 수정
realhsb Jun 19, 2024
93509c5
chore: Bookmark api Token 수정
realhsb Jun 19, 2024
7ecaf76
chore: 주석 제거
realhsb Jun 19, 2024
003da6c
chore: Bookmark Service의 task 수정
realhsb Jun 19, 2024
d009b63
feat: NewsListView에 BookmarksListViewModel 연결
realhsb Jun 20, 2024
6449801
chore: 주석 제거
realhsb Jun 20, 2024
85f03cd
feat: 북마크 여부 확인 함수 및 주석 제거
realhsb Jun 20, 2024
3ec8334
chore: 주석 제거
realhsb Jun 20, 2024
3b01916
feat: 북마크 저장
realhsb Jun 20, 2024
4667af8
chore: BookmarksViewModel 연결
realhsb Jun 20, 2024
0c5d600
feat: 북마크 삭제
realhsb Jun 20, 2024
1110c4a
chore: 주석 제거
realhsb Jun 20, 2024
4acbcab
Merge pull request #158 from tukcomCD2024/feat/#157-ios-statistics
realhsb Jun 20, 2024
0f82def
feat: 채팅방 조회API 연동 완료
yeahzxnn Jun 20, 2024
7681269
Merge pull request #159 from tukcomCD2024/Feat/#156_ios_modifydebatel…
yeahzxnn Jun 20, 2024
00b86b4
fix : 최근 본 뉴스 조회하기 API 연결
yeahzxnn Jun 20, 2024
4b68972
fix : ChatGPT가 먼저 토론 시작하는 로직으로 수정
yeahzxnn Jun 20, 2024
d984017
fix : 토론 종료 API 연동 및 토론 종료 후 토론 탭 메인 화면으로 돌아오는 것으로 로직 수정 완료
yeahzxnn Jun 20, 2024
12865a8
fix : 채팅방 목록 불러오기 API 연동 완료
yeahzxnn Jun 20, 2024
b2f412c
Merge pull request #162 from tukcomCD2024/Feat/#161_ios_branchmergeissue
yeahzxnn Jun 20, 2024
032455c
Merge branch 'DeviOS' into Dev
realhsb Jun 20, 2024
0417379
Merge remote-tracking branch 'origin/Dev-backend' into feat/#169-back…
yeonjy Jun 29, 2024
2a702cb
feat: success response
yeonjy Jun 30, 2024
3308737
refactor: directory config -> common
yeonjy Jun 30, 2024
7f57204
feat: BookmarkApi에 success response 적용
yeonjy Jun 30, 2024
b43489d
refactor: BaseTimeEntity directory 이동 적용
yeonjy Jun 30, 2024
dc2bca4
feat: Debate API 에 Success Response 적용
yeonjy Jun 30, 2024
cebd6bf
feat: Member API에 Success Response 적용
yeonjy Jun 30, 2024
107726b
feat: News API에 Success Response 적용
yeonjy Jun 30, 2024
d94fb91
feat: ReadNews API에 Success Response 적용
yeonjy Jun 30, 2024
e33a25e
feat: Statistics API에 Success Response 적용
yeonjy Jun 30, 2024
7c4567d
feat: Auth API에 Success Response 적용
yeonjy Jun 30, 2024
86c8b0a
feat: success message 수정
yeonjy Jun 30, 2024
79686b8
refactor: swagger tags -> @Tag
yeonjy Jun 30, 2024
43f0208
refactor: 필요없는 log 삭제
yeonjy Jun 30, 2024
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
72 changes: 44 additions & 28 deletions iOS/RollTheDice/RollTheDice.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion iOS/RollTheDice/RollTheDice/RollTheDiceApp.swift
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ struct RollTheDiceApp: App {
var signUpViewModel = SignUpViewModel()

var newsListViewModel = NewsListViewModel()
@StateObject var bookmarkListViewModel = BookmarkListViewModel()
var bookmarkListViewModel = BookmarksListViewModel()

init() {
KakaoSDK.initSDK(appKey: "ff09b3d83873ed4e320f0d6bc90759d6")
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@ public class APIHeaderManager {
static let shared = APIHeaderManager()

let contentType: String = "application/json"
let scoopHost: String = "ec2-13-124-191-244.ap-northeast-2.compute.amazonaws.com:8080"
// let scoopHost: String = "ec2-13-124-191-244.ap-northeast-2.compute.amazonaws.com:8080"
let scoopHost: String = "roll-the-dice.store:8080"
}


// http://ec2-13-124-191-244.ap-northeast-2.compute.amazonaws.com:8080/swagger-ui/index.html
Original file line number Diff line number Diff line change
@@ -8,5 +8,6 @@
import Foundation

enum ScoopAPI {
static let baseURL = "http://ec2-13-124-191-244.ap-northeast-2.compute.amazonaws.com:8080"
// static let baseURL = "http://ec2-13-124-191-244.ap-northeast-2.compute.amazonaws.com:8080"
static let baseURL = "http://roll-the-dice.store:8080"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// ScoopAPIBookmark.swift
// RollTheDice
//
// Created by Subeen on 6/14/24.
//

import Foundation

public enum ScoopAPIBookmarks {
public static let bookmarks = String("/bookmarks")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// ScoopAPILogin.swift
// RollTheDice
//
// Created by Subeen on 6/18/24.
//

import Foundation

public enum ScoopAPILogin {
public static let login = String("/login")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//
// BookmarksService.swift
// RollTheDice
//
// Created by Subeen on 6/14/24.
//

import Foundation
import Moya

enum BookmarksService {
case bookmarksIsChecked(newsId: Int, accessToken: String) ///뉴스 북마크 여부 조회
case saveBookmarks(newsId: Int, accessToken: String) ///북마크 저장
case deleteBookmarks(newsId: Int, accessToken: String) ///북마크 삭제
case allBookmarks(page: Int, size: Int, accessToken: String) ///북마크 전체 조회/
}

extension BookmarksService: BaseTargetType {

var baseURL: URL {
return URL(string: ScoopAPI.baseURL)!
}

var path: String {
switch self {
case .bookmarksIsChecked(let newsId, _),
.saveBookmarks(let newsId, _),
.deleteBookmarks(let newsId, _)
:
return "\(ScoopAPIBookmarks.bookmarks)/\(newsId)"

case .allBookmarks:
return ScoopAPIBookmarks.bookmarks
}
}

var method: Moya.Method {
switch self {
case .bookmarksIsChecked:
return .get
case .saveBookmarks:
return .post
case .deleteBookmarks:
return .delete
case .allBookmarks:
return .get
}
}

var task: Moya.Task {
switch self {
case .bookmarksIsChecked(let newsId, _),
.saveBookmarks(let newsId, _),
.deleteBookmarks(let newsId, _):
let parameters : [String : Any] = [:]
return .requestParameters(parameters: parameters, encoding: URLEncoding.default)

case .allBookmarks(let page, let size, _):
let parameters : [String : Any] = [
"page" : page,
"size" : size,
]
return .requestParameters(parameters: parameters,
encoding: URLEncoding.queryString)
}
}

var headers: [String : String]? {
let accessToken: String
switch self {
case .bookmarksIsChecked(_, let accessToken),
.saveBookmarks(_, let accessToken),
.deleteBookmarks(_, let accessToken),
.allBookmarks(_, _, let accessToken):
return [
"Authorization": "Bearer \(accessToken)",
"X-Content-Type_Options" : "nosniff"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// AuthAPI.swift
// RollTheDice
//
// Created by 신예진 on 5/31/24.
//

import Foundation
import Moya

enum LoginService {
case login(request: AuthRequestModel)
}

//struct LoginService {
// static let provider = MoyaProvider<AuthTarget>()
//}

extension LoginService: BaseTargetType {

var baseURL: URL {
return URL(string: ScoopAPI.baseURL)!
}

var path: String {
switch self {
case .login:
return ScoopAPILogin.login
}
}

var method: Moya.Method {
switch self {
case .login:
return .post
}
}

var task: Moya.Task {
switch self {
case .login(let request):
// let parameters : [String : Any] = [
// "token" : token,
// "socialType" : socialType,
// ]
// return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
return .requestJSONEncodable(request)
}
}

var headers: [String: String]? {
return [
"X-Content-Type_Options" : "nosniff"
]
}
}
23 changes: 23 additions & 0 deletions iOS/RollTheDice/RollTheDice/Source/View/Authentication/Auth.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Auth.swift
// RollTheDice
//
// Created by Subeen on 6/18/24.
//

import Foundation

struct AuthModel: Codable {
let accessToken: String?
let refreshToken: String?

// enum CodingKeys: String, CodingKey {
// case Authorization
// case AuthorizationRefresh = "Authorization-refresh"
// }
}

struct AuthRequestModel: Codable {
let token: String?
let socialType: String?
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -122,45 +122,8 @@ struct AuthenticatedView: View {
.frame(height: 50)
}

// Button {
// if (UserApi.isKakaoTalkLoginAvailable()) {
// UserApi.shared.loginWithKakaoTalk {(oauthToken, error) in
// print(oauthToken)
// print(error)
// }
// } else {
// UserApi.shared.loginWithKakaoAccount {(oauthToken, error) in
// print(oauthToken)
// print(error)
// }
// }
//
// } label: {
// Image(.kakaoSignInBtn01)
// .resizable()
// .aspectRatio(contentMode: .fit)
// .frame(height: 50)
// }
Button {
if UserApi.isKakaoTalkLoginAvailable() {
UserApi.shared.loginWithKakaoTalk { (oauthToken, error) in
if let error = error {
print("Kakao Login Error: \(error)")
} else if let oauthToken = oauthToken {
print("Kakao Login Success: \(oauthToken)")
TokenManager.shared.accessToken = oauthToken.accessToken
authViewModel.authenticationState = .completedSignUp }
}
} else {
UserApi.shared.loginWithKakaoAccount { (oauthToken, error) in
if let error = error {
print("Kakao Login Error: \(error)")
} else if let oauthToken = oauthToken {
print("Kakao Login Success: \(oauthToken)")
TokenManager.shared.accessToken = oauthToken.accessToken
authViewModel.authenticationState = .completedSignUp }
}
}
authViewModel.loginWithKakao()
} label: {
Image(.kakaoSignInBtn01)
.resizable()
Loading