-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from tukcomCD2024/Feat/#154_ios_fixdebatepush…
…error Feat/#154 ios fixdebatepusherror
- Loading branch information
Showing
11 changed files
with
257 additions
and
13 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,6 @@ enum PathType: Hashable { | |
case mypageView // 마이페이지뷰 | ||
|
||
case webView(url: String) | ||
|
||
case createdebateroom //토론방 생성 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
iOS/RollTheDice/RollTheDice/Source/View/Debate/ChatGPT/Service/ChatService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// ChatService.swift | ||
// RollTheDice | ||
// | ||
// Created by 신예진 on 6/19/24. | ||
// | ||
|
||
import Foundation | ||
import Moya | ||
|
||
enum ChatService { | ||
case sendMessageToAI(roomId: Int, message: String) | ||
case sendMessageToHuman(roomId: Int, message: String) | ||
} | ||
|
||
extension ChatService: TargetType { | ||
var baseURL: URL { | ||
return URL(string: "http://roll-the-dice.store:8080")! | ||
} | ||
|
||
var path: String { | ||
switch self { | ||
case .sendMessageToAI(let roomId, _): | ||
return "/debates/\(roomId)/ai" | ||
case .sendMessageToHuman(let roomId, _): | ||
return "/debates/\(roomId)/human" | ||
} | ||
} | ||
|
||
var method: Moya.Method { | ||
return .post | ||
} | ||
|
||
var task: Task { | ||
switch self { | ||
case .sendMessageToAI(_, let message), .sendMessageToHuman(_, let message): | ||
return .requestParameters(parameters: ["message": message], encoding: JSONEncoding.default) | ||
} | ||
} | ||
|
||
var headers: [String: String]? { | ||
guard let token = TokenManager.shared.accessToken else { return nil } | ||
return ["Authorization": "Bearer \(token)"] | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
iOS/RollTheDice/RollTheDice/Source/View/Debate/ChatList/Model/News.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// News.swift | ||
// RollTheDice | ||
// | ||
// Created by 신예진 on 6/19/24. | ||
// | ||
|
||
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...RollTheDice/RollTheDice/Source/View/Debate/ChatList/Service/CreateDebateRoomService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// CreateDebateRoomService.swift | ||
// RollTheDice | ||
// | ||
// Created by 신예진 on 6/19/24. | ||
// | ||
|
||
import Foundation | ||
import Moya | ||
|
||
enum CreateDebateRoomService { | ||
case createDebate(topic: String) | ||
} | ||
|
||
extension CreateDebateRoomService: TargetType { | ||
var baseURL: URL { | ||
return URL(string: "http://roll-the-dice.store:8080")! | ||
} | ||
|
||
var path: String { | ||
switch self { | ||
case .createDebate: | ||
return "/debates" | ||
} | ||
} | ||
|
||
var method: Moya.Method { | ||
switch self { | ||
case .createDebate: | ||
return .post | ||
} | ||
} | ||
|
||
var task: Task { | ||
switch self { | ||
case .createDebate(let topic): | ||
let parameters: [String: Any] = ["topic": topic] | ||
return .requestParameters(parameters: parameters, encoding: JSONEncoding.default) | ||
} | ||
} | ||
|
||
var headers: [String: String]? { | ||
guard let token = TokenManager.shared.accessToken else { return nil } | ||
return ["Authorization": "Bearer \(token)"] | ||
} | ||
|
||
var sampleData: Data { | ||
return Data() | ||
} | ||
} |
Oops, something went wrong.