forked from AcaMate/AcaMate_iOS
[✨] 개발자 우회 로그인 기능 추가
This commit is contained in:
parent
b226ad8050
commit
c2f540abd8
Binary file not shown.
|
@ -3,4 +3,114 @@
|
||||||
uuid = "800DD51A-C089-4DC4-AE55-7F5ABD5C0AE7"
|
uuid = "800DD51A-C089-4DC4-AE55-7F5ABD5C0AE7"
|
||||||
type = "1"
|
type = "1"
|
||||||
version = "2.0">
|
version = "2.0">
|
||||||
|
<Breakpoints>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "EF02BBC2-AF83-4307-9043-6A5F28034993"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "AcaMate/3. ViewModel/LoginViewModel.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "60"
|
||||||
|
endingLineNumber = "60"
|
||||||
|
landmarkName = "loginAction(type:)"
|
||||||
|
landmarkType = "7">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "D0EC0AF1-892F-452E-B364-908485B238C8"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "AcaMate/3. ViewModel/LoginViewModel.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "76"
|
||||||
|
endingLineNumber = "76"
|
||||||
|
landmarkName = "loginAction(type:)"
|
||||||
|
landmarkType = "7">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "EE4B8BD1-834C-4489-857D-C4892550A974"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "AcaMate/3. ViewModel/LoginViewModel.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "59"
|
||||||
|
endingLineNumber = "59"
|
||||||
|
landmarkName = "loginAction(type:)"
|
||||||
|
landmarkType = "7">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "541FB419-BE81-4999-93CD-C37FEB9BDDA4"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "AcaMate/3. ViewModel/LoginViewModel.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "58"
|
||||||
|
endingLineNumber = "58"
|
||||||
|
landmarkName = "loginAction(type:)"
|
||||||
|
landmarkType = "7">
|
||||||
|
<Locations>
|
||||||
|
<Location
|
||||||
|
uuid = "541FB419-BE81-4999-93CD-C37FEB9BDDA4 - fec6a76745ade7a4"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
symbolName = "AcaMate.LoginViewModel.loginAction(type: AcaMate.SNSLoginType) -> ()"
|
||||||
|
moduleName = "AcaMate.debug.dylib"
|
||||||
|
usesParentBreakpointCondition = "Yes"
|
||||||
|
urlString = "file:///Library/TAnine/KimSeonKyu/ACA/APP/AcaMate_iOS/AcaMate/3.%20ViewModel/LoginViewModel.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "58"
|
||||||
|
endingLineNumber = "58">
|
||||||
|
</Location>
|
||||||
|
<Location
|
||||||
|
uuid = "541FB419-BE81-4999-93CD-C37FEB9BDDA4 - 8a2a7067165bc08f"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
symbolName = "closure #2 (Combine.Subscribers.Completion<Swift.Error>) -> () in AcaMate.LoginViewModel.loginAction(type: AcaMate.SNSLoginType) -> ()"
|
||||||
|
moduleName = "AcaMate.debug.dylib"
|
||||||
|
usesParentBreakpointCondition = "Yes"
|
||||||
|
urlString = "file:///Library/TAnine/KimSeonKyu/ACA/APP/AcaMate_iOS/AcaMate/3.%20ViewModel/LoginViewModel.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "58"
|
||||||
|
endingLineNumber = "58">
|
||||||
|
</Location>
|
||||||
|
<Location
|
||||||
|
uuid = "541FB419-BE81-4999-93CD-C37FEB9BDDA4 - 67e85eea66ec8076"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
symbolName = "closure #3 ((snsId: Swift.String, response: AcaMate.APIResponse<AcaMate.User_Token>)) -> () in AcaMate.LoginViewModel.loginAction(type: AcaMate.SNSLoginType) -> ()"
|
||||||
|
moduleName = "AcaMate.debug.dylib"
|
||||||
|
usesParentBreakpointCondition = "Yes"
|
||||||
|
urlString = "file:///Library/TAnine/KimSeonKyu/ACA/APP/AcaMate_iOS/AcaMate/3.%20ViewModel/LoginViewModel.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "58"
|
||||||
|
endingLineNumber = "58">
|
||||||
|
</Location>
|
||||||
|
</Locations>
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
</Breakpoints>
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
|
|
@ -49,6 +49,25 @@ struct LoginView: View {
|
||||||
} label: {
|
} label: {
|
||||||
makeButton(image: Image(.Logo.appleIcon), color: Color(.Text.black), "애플 계정으로 시작하기")
|
makeButton(image: Image(.Logo.appleIcon), color: Color(.Text.black), "애플 계정으로 시작하기")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CustomTxfView(placeholder: "id",
|
||||||
|
text: $loginVM.devId,
|
||||||
|
alignment: .center,
|
||||||
|
font: .nps(size: 12))
|
||||||
|
.frame(maxWidth: .infinity,maxHeight: 48)
|
||||||
|
.padding(EdgeInsets(top: 4, leading: 8, bottom: 4, trailing: 8))
|
||||||
|
.background {
|
||||||
|
RoundedRectangle(cornerRadius: 24)
|
||||||
|
.foregroundStyle(Color(.Normal.light))
|
||||||
|
}.clipped()
|
||||||
|
Button {
|
||||||
|
// loginVM.toggleLoading = true
|
||||||
|
loginVM.loginAction(type: .Dev)
|
||||||
|
|
||||||
|
} label: {
|
||||||
|
makeButton(image: Image(.Logo.logo),
|
||||||
|
color: Color(.Text.black), "계정으로 시작하기")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.padding([.leading,.trailing], 28)
|
.padding([.leading,.trailing], 28)
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import Foundation
|
||||||
enum SNSLoginType: String{
|
enum SNSLoginType: String{
|
||||||
case Apple = "ST00"
|
case Apple = "ST00"
|
||||||
case Kakao = "ST01"
|
case Kakao = "ST01"
|
||||||
|
case Dev = "ST02"
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SNSID: Codable {
|
struct SNSID: Codable {
|
||||||
|
|
|
@ -20,6 +20,8 @@ class LoginViewModel: ObservableObject {
|
||||||
@UserDefault(key: "refresh", defaultValue: "refreshToken") var refresh
|
@UserDefault(key: "refresh", defaultValue: "refreshToken") var refresh
|
||||||
@UserDefault(key: "header", defaultValue: "headerValue") var headerValue
|
@UserDefault(key: "header", defaultValue: "headerValue") var headerValue
|
||||||
|
|
||||||
|
@Published var devId: String = ""
|
||||||
|
|
||||||
var bidArray: [String] = []
|
var bidArray: [String] = []
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,12 +31,13 @@ class LoginViewModel: ObservableObject {
|
||||||
|
|
||||||
func loginAction(type: SNSLoginType) {
|
func loginAction(type: SNSLoginType) {
|
||||||
appVM.isLoading = true
|
appVM.isLoading = true
|
||||||
LoginController().login(type)
|
let acctype: String = type == .Apple ? "ST00": (type == .Kakao ? "ST01" : "ST02")
|
||||||
|
LoginController().login(type, devId)
|
||||||
.flatMap{ snsId in
|
.flatMap{ snsId in
|
||||||
self.appVM.apiManager.loadAPIData(APIRequest(path: "/api/v1/in/user/login",
|
self.appVM.apiManager.loadAPIData(APIRequest(path: "/api/v1/in/user/login",
|
||||||
headers: [API_HEADER : self.headerValue],
|
headers: [API_HEADER : self.headerValue],
|
||||||
parameters: [
|
parameters: [
|
||||||
"acctype": "\(type == .Apple ? "ST00": "ST01")",
|
"acctype": acctype,
|
||||||
"snsId": "\(snsId.snsId)"
|
"snsId": "\(snsId.snsId)"
|
||||||
],
|
],
|
||||||
decoding: APIResponse<User_Token>.self))
|
decoding: APIResponse<User_Token>.self))
|
||||||
|
|
|
@ -16,7 +16,7 @@ import Foundation
|
||||||
class LoginController {
|
class LoginController {
|
||||||
private var cancellables = Set<AnyCancellable>()
|
private var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
func login(_ type: SNSLoginType) -> AnyPublisher<SNSID,Error> {
|
func login(_ type: SNSLoginType, _ id: String = "") -> AnyPublisher<SNSID,Error> {
|
||||||
switch type {
|
switch type {
|
||||||
case .Kakao:
|
case .Kakao:
|
||||||
return self.checkKakaoToken()
|
return self.checkKakaoToken()
|
||||||
|
@ -32,8 +32,17 @@ class LoginController {
|
||||||
case .Apple:
|
case .Apple:
|
||||||
return Fail(error: NSError(domain: "Apple login not implemented", code: 1, userInfo: nil))
|
return Fail(error: NSError(domain: "Apple login not implemented", code: 1, userInfo: nil))
|
||||||
.eraseToAnyPublisher()
|
.eraseToAnyPublisher()
|
||||||
|
case .Dev:
|
||||||
|
return Future<SNSID, Error> { promise in
|
||||||
|
var snsId = SNSID()
|
||||||
|
snsId.acctType = "dev"
|
||||||
|
snsId.snsId = "\(id)"
|
||||||
|
snsId.snsToken = "devToken"
|
||||||
|
promise(.success(snsId))
|
||||||
}
|
}
|
||||||
|
.eraseToAnyPublisher()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +58,7 @@ class LoginController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case .Apple: break
|
case .Apple: break
|
||||||
|
case .Dev: break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,25 @@ class WebSocketManager: ObservableObject ,WebSocketDelegate {
|
||||||
printLog("🆘 SOCKET ERROR: \(error?.localizedDescription ?? "unknown")")
|
printLog("🆘 SOCKET ERROR: \(error?.localizedDescription ?? "unknown")")
|
||||||
|
|
||||||
case .text(let text):
|
case .text(let text):
|
||||||
|
// 서버에서 메세지를 보내면 여기로 들어올거고
|
||||||
|
// 받아온 텍스트의 앞은 target, [sendet, message] 순서로 들어온다.
|
||||||
printLog("📩 SERVER SENT: \(text)")
|
printLog("📩 SERVER SENT: \(text)")
|
||||||
receivedMessage.append(text)
|
|
||||||
|
if let data = try? JSONSerialization.jsonObject(with: Data(text.utf8)) as? [String: Any],
|
||||||
|
let target = data["target"] as? String,
|
||||||
|
let args = data["arguments"] as? [String] {
|
||||||
|
|
||||||
|
if target == "ReceiveMessage" {
|
||||||
|
let sender = args[0]
|
||||||
|
let message = args[1]
|
||||||
|
receivedMessage.append(message)
|
||||||
|
print("💬 [\(sender)] \(message)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case .binary(let binary):
|
case .binary(let binary):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user