-
Notifications
You must be signed in to change notification settings - Fork 0
[FIX] CardShredView 네비게이션 화면전환 적용 및 MainTabView 개선 #44
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
67c87c4
[CHORE] CardShredView 모달 -> 네비게이션 로직 수정
dlrjswns c972339
[FIX] 카드 단일 삭제 후 발생하는 alert 문제 해결
dlrjswns 4c79ac7
[FEAT] CardDetailView띄워질때 애니메이션 추가
dlrjswns 701ead6
[FIX] 네비게이션 및 탭바 중복코드 개선
dlrjswns a792002
[FIX] 화면 전환 시 탭바만큼 간격 생기는 문제 해결
dlrjswns b0ba324
[FIX] EmptyView움찔거리는 문제 해결
dlrjswns 9440e41
[FIX] refreshToken만료시 MainTabView갇히는 문제 해결
dlrjswns ecf05a1
[CHORE] 공용 NavigationBarView적용에 따른 코드 수정
dlrjswns 6ebf726
[FEAT] 검색화면관련 페이징 처리 추가
dlrjswns a5fc328
[CHORE] NetworkManager 구조 개선
dlrjswns 16c7641
Merge branch 'fix/trashList' of https://github.com/Nexters/GAMMS-iOS …
dlrjswns e505f34
[FEAT] 대화창 검색 시 텍스트 폰트 및 색상 적용
dlrjswns File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
99 changes: 99 additions & 0 deletions
99
GAMSS/Sources/Core/Components/Navigation/NavigationBarHider.swift
This file contains hidden or 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,99 @@ | ||
| // | ||
| // NavigationBarHider.swift | ||
| // GAMSS | ||
| // | ||
| // Created by 이건준 on 8/24/26. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| /// NavigationStack 안의 시스템 네비게이션 바를 항상 숨긴다. | ||
| /// 탭 바는 SwiftUI `.toolbar(.hidden, for: .tabBar)`로 처리해야 레이아웃이 전체 높이로 확장된다. | ||
| struct NavigationBarHider: UIViewControllerRepresentable { | ||
| func makeCoordinator() -> Coordinator { | ||
| Coordinator() | ||
| } | ||
|
|
||
| func makeUIViewController(context: Context) -> UIViewController { | ||
| let controller = HostViewController() | ||
| controller.onAppear = { [weak coordinator = context.coordinator, weak controller] in | ||
| guard let controller else { return } | ||
| coordinator?.bind(from: controller) | ||
| } | ||
| context.coordinator.bind(from: controller) | ||
| return controller | ||
| } | ||
|
|
||
| func updateUIViewController(_ uiViewController: UIViewController, context: Context) { | ||
| context.coordinator.bind(from: uiViewController) | ||
| } | ||
|
|
||
| final class HostViewController: UIViewController { | ||
| var onAppear: (() -> Void)? | ||
|
|
||
| override func viewWillAppear(_ animated: Bool) { | ||
| super.viewWillAppear(animated) | ||
| onAppear?() | ||
| } | ||
| } | ||
|
|
||
| final class Coordinator: NSObject, UINavigationControllerDelegate { | ||
| private weak var navigationController: UINavigationController? | ||
| private weak var originalDelegate: UINavigationControllerDelegate? | ||
|
|
||
| func bind(from controller: UIViewController) { | ||
| DispatchQueue.main.async { [weak self, weak controller] in | ||
| guard let self, let navigationController = controller?.navigationController else { return } | ||
|
|
||
| if self.navigationController !== navigationController { | ||
| self.originalDelegate = navigationController.delegate | ||
| self.navigationController = navigationController | ||
| navigationController.delegate = self | ||
| } | ||
|
|
||
| self.hideNavigationBar(on: navigationController) | ||
| } | ||
| } | ||
|
|
||
| func navigationController( | ||
| _ navigationController: UINavigationController, | ||
| willShow viewController: UIViewController, | ||
| animated: Bool | ||
| ) { | ||
| hideNavigationBar(on: navigationController) | ||
| originalDelegate?.navigationController?( | ||
| navigationController, | ||
| willShow: viewController, | ||
| animated: animated | ||
| ) | ||
| } | ||
|
|
||
| func navigationController( | ||
| _ navigationController: UINavigationController, | ||
| didShow viewController: UIViewController, | ||
| animated: Bool | ||
| ) { | ||
| hideNavigationBar(on: navigationController) | ||
| originalDelegate?.navigationController?( | ||
| navigationController, | ||
| didShow: viewController, | ||
| animated: animated | ||
| ) | ||
| } | ||
|
|
||
| private func hideNavigationBar(on navigationController: UINavigationController) { | ||
| navigationController.setNavigationBarHidden(true, animated: false) | ||
| // UIKit으로 탭바를 숨기면 하단 여백이 남을 수 있어, 탭바는 SwiftUI toolbar로만 제어한다. | ||
| if navigationController.viewControllers.count <= 1 { | ||
| navigationController.tabBarController?.tabBar.isHidden = false | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| extension View { | ||
| /// push된 화면에서 탭바를 숨기고 콘텐츠가 전체 높이를 쓰도록 한다. | ||
| func hidesTabBar() -> some View { | ||
| toolbar(.hidden, for: .tabBar) | ||
| } | ||
| } |
181 changes: 181 additions & 0 deletions
181
GAMSS/Sources/Core/Components/Navigation/NavigationBarView.swift
This file contains hidden or 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,181 @@ | ||
| // | ||
| // NavigationBarView.swift | ||
| // GAMSS | ||
| // | ||
| // Created by 이건준 on 8/31/26. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| enum NavigationBarMetrics { | ||
| static let height: CGFloat = 64 | ||
| static let horizontalPadding: CGFloat = Spacing.spacing350 | ||
| } | ||
|
|
||
| /// 시스템 NavigationBar 대신 쓰는 공용 상단 바. | ||
| struct NavigationBarView<Trailing: View>: View { | ||
| enum TitlePlacement { | ||
| case leading | ||
| case center | ||
| } | ||
|
|
||
| enum LeadingContent { | ||
| case backButton | ||
| case logo | ||
| case none | ||
| } | ||
|
|
||
| private let title: String? | ||
| private let titlePlacement: TitlePlacement | ||
| private let titleStyle: Typography | ||
| private let titleColor: Color | ||
| private let leadingContent: LeadingContent | ||
| private let onBack: () -> Void | ||
| private let horizontalPadding: CGFloat | ||
| private let trailing: Trailing | ||
|
|
||
| init( | ||
| title: String? = nil, | ||
| titlePlacement: TitlePlacement = .leading, | ||
| titleStyle: Typography = .subtitle2, | ||
| titleColor: Color = .colorGray900, | ||
| leading: LeadingContent = .backButton, | ||
| onBack: @escaping () -> Void = {}, | ||
| horizontalPadding: CGFloat = NavigationBarMetrics.horizontalPadding, | ||
| @ViewBuilder trailing: () -> Trailing = { EmptyView() } | ||
| ) { | ||
| self.title = title | ||
| self.titlePlacement = titlePlacement | ||
| self.titleStyle = titleStyle | ||
| self.titleColor = titleColor | ||
| self.leadingContent = leading | ||
| self.onBack = onBack | ||
| self.horizontalPadding = horizontalPadding | ||
| self.trailing = trailing() | ||
| } | ||
|
|
||
| init( | ||
| title: String? = nil, | ||
| titlePlacement: TitlePlacement = .leading, | ||
| titleStyle: Typography = .subtitle2, | ||
| titleColor: Color = .colorGray900, | ||
| showsBackButton: Bool, | ||
| onBack: @escaping () -> Void = {}, | ||
| horizontalPadding: CGFloat = NavigationBarMetrics.horizontalPadding, | ||
| @ViewBuilder trailing: () -> Trailing = { EmptyView() } | ||
| ) { | ||
| self.init( | ||
| title: title, | ||
| titlePlacement: titlePlacement, | ||
| titleStyle: titleStyle, | ||
| titleColor: titleColor, | ||
| leading: showsBackButton ? .backButton : .none, | ||
| onBack: onBack, | ||
| horizontalPadding: horizontalPadding, | ||
| trailing: trailing | ||
| ) | ||
| } | ||
|
|
||
| var body: some View { | ||
| Group { | ||
| switch titlePlacement { | ||
| case .leading: | ||
| leadingLayout | ||
| case .center: | ||
| centerLayout | ||
| } | ||
| } | ||
| .frame(height: NavigationBarMetrics.height) | ||
| .padding(.horizontal, horizontalPadding) | ||
| } | ||
|
|
||
| private var leadingLayout: some View { | ||
| HStack(spacing: Spacing.spacing200) { | ||
| leadingView | ||
|
|
||
| if let title { | ||
| Text(title) | ||
| .typography(titleStyle) | ||
| .foregroundStyle(titleColor) | ||
| } | ||
|
|
||
| Spacer(minLength: 0) | ||
|
|
||
| trailing | ||
| } | ||
| } | ||
|
|
||
| private var centerLayout: some View { | ||
| ZStack { | ||
| if let title { | ||
| Text(title) | ||
| .typography(titleStyle) | ||
| .foregroundStyle(titleColor) | ||
| } | ||
|
|
||
| HStack(spacing: Spacing.spacing200) { | ||
| leadingView | ||
|
|
||
| Spacer(minLength: 0) | ||
|
|
||
| trailing | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @ViewBuilder | ||
| private var leadingView: some View { | ||
| switch leadingContent { | ||
| case .backButton: | ||
| Button(action: onBack) { | ||
| Image(systemName: "chevron.left") | ||
| .foregroundStyle(Color.colorGray900) | ||
| } | ||
| .accessibilityLabel("뒤로가기") | ||
|
|
||
| case .logo: | ||
| Image("logoGamss") | ||
| .resizable() | ||
| .scaledToFit() | ||
| .frame(height: 24) | ||
|
|
||
| case .none: | ||
| EmptyView() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #Preview("Push") { | ||
| VStack { | ||
| NavigationBarView(title: "설정", onBack: {}) | ||
| NavigationBarView(title: "보관함", onBack: {}) { | ||
| Text("비우기") | ||
| .typography(.body5Medium) | ||
| .foregroundStyle(Color.colorGray900) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #Preview("Tab logo") { | ||
| NavigationBarView(leading: .logo) { | ||
| Image("gear") | ||
| .resizable() | ||
| .scaledToFit() | ||
| .frame(width: 24, height: 24) | ||
| } | ||
| } | ||
|
|
||
| #Preview("Center") { | ||
| NavigationBarView( | ||
| title: "2026.08.31", | ||
| titlePlacement: .center, | ||
| titleStyle: .subtitle3, | ||
| titleColor: .colorGray950, | ||
| onBack: {} | ||
| ) { | ||
| HStack(spacing: Spacing.spacing400) { | ||
| Image("iconCardGenerate") | ||
| Image("iconTokenUsage") | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,22 @@ | ||
| // | ||
| // LoginSession.swift | ||
| // GAMSS | ||
| // | ||
| // Created by 이건준 on 8/12/26. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| @Observable | ||
| @MainActor | ||
| final class LoginSession { | ||
| static let shared = LoginSession() | ||
|
|
||
| var value: LoginState = .current | ||
|
|
||
| private init() {} | ||
|
|
||
| func updateFromStorage() { | ||
| value = .current | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p1
reissue 실패 → autoLogin 폴백 로직이 핵심 수정사항인 것 같은데 관련 테스트 코드가 있으면 좋을 것 같아요
성공/실패(missingFirebaseUser, firebaseSignInFailed) 케이스만이라도 커버되면 좋을 것 같고... 아니면 따로 검증할 방법 있을까요?