-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [WEAV-116] Signup Domain 모델 생성 * [WEAV-116] Model 모듈 구조 변경, API 연결 * [WEAV-116] OAS subrepo 최신화: * [WEAV-116] Auth Info Debug 뷰 추가 * [WEAV-116] DebugView push event 추가
- Loading branch information
1 parent
4d5bf26
commit 9e8ab1e
Showing
51 changed files
with
746 additions
and
246 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,150 @@ | ||
// | ||
// AuthInfoView.swift | ||
// three-days-dev | ||
// | ||
// Created by 김지수 on 10/27/24. | ||
// Copyright © 2024 com.weave. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import DesignCore | ||
import CoreKit | ||
|
||
#if DEBUG || STAGING | ||
struct TableInfoModel: Identifiable { | ||
let id = UUID() | ||
let title: String | ||
let value: String | ||
} | ||
|
||
enum Sections: CaseIterable { | ||
case authInfo | ||
case userInfo | ||
case userProfile | ||
case dreamPartnerInfo | ||
|
||
var sectionTitle: String { | ||
switch self { | ||
case .authInfo: "토큰 정보" | ||
case .userInfo: "유저 정보(TEMP)" | ||
case .userProfile: "프로필 정보(TEMP)" | ||
case .dreamPartnerInfo: "이상형 정보(TEMP)" | ||
} | ||
} | ||
|
||
var dataSources: [TableInfoModel] { | ||
switch self { | ||
case .authInfo: | ||
[ | ||
TableInfoModel( | ||
title: "accessToken", | ||
value: TokenManager.accessToken ?? "null" | ||
), | ||
TableInfoModel( | ||
title: "refreshToken", | ||
value: TokenManager.refreshToken ?? "null" | ||
), | ||
TableInfoModel( | ||
title: "registerToken", | ||
value: TokenManager.registerToken ?? "null" | ||
) | ||
] | ||
case .userInfo: | ||
[ | ||
TableInfoModel( | ||
title: "ID", | ||
value: UUID().uuidString | ||
), | ||
TableInfoModel( | ||
title: "이름", | ||
value: "홍길동" | ||
), | ||
TableInfoModel( | ||
title: "휴대폰 번호", | ||
value: "010-1234-1234" | ||
) | ||
] | ||
case .userProfile: | ||
[ | ||
TableInfoModel( | ||
title: "출생년도", | ||
value: "1996" | ||
), | ||
TableInfoModel( | ||
title: "회사 ID", | ||
value: UUID().uuidString | ||
), | ||
TableInfoModel( | ||
title: "성별", | ||
value: "MALE" | ||
), | ||
TableInfoModel( | ||
title: "직군정보", | ||
value: UUID().uuidString | ||
), | ||
TableInfoModel( | ||
title: "활동지역 ID", | ||
value: [UUID(), UUID(), UUID()] | ||
.map { $0.uuidString } | ||
.joined(separator: "\n") | ||
) | ||
] | ||
case .dreamPartnerInfo: | ||
[] | ||
} | ||
} | ||
} | ||
|
||
struct AuthDebugInfoView: View { | ||
@State private var showingAlert = false | ||
@State private var copiedText = "" | ||
|
||
var body: some View { | ||
List { | ||
ForEach(Sections.allCases, id: \.self) { section in | ||
Section(header: Text(section.sectionTitle)) { | ||
ForEach(section.dataSources) { info in | ||
Button(action: { | ||
copyToClipboard(info.value) | ||
copiedText = info.title | ||
showingAlert = true | ||
}) { | ||
VStack(alignment: .leading) { | ||
Text(info.title) | ||
.pretendard( | ||
weight: ._600, | ||
size: 16 | ||
) | ||
.foregroundStyle(.black) | ||
Text(info.value) | ||
.pretendard( | ||
weight: ._400, | ||
size: 14 | ||
) | ||
.foregroundColor(.gray) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
.alert(isPresented: $showingAlert) { | ||
Alert( | ||
title: Text("복사 완료"), | ||
message: Text("[\(copiedText)] 정보가 클립보드에 복사되었습니다."), | ||
dismissButton: .default(Text("확인")) | ||
) | ||
} | ||
} | ||
|
||
// 클립보드에 복사하는 함수 | ||
func copyToClipboard(_ text: String) { | ||
UIPasteboard.general.string = text | ||
} | ||
} | ||
|
||
#Preview { | ||
AuthDebugInfoView() | ||
} | ||
|
||
#endif |
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
Oops, something went wrong.