Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public struct I18N {
public static let receiveTodaysFortuneCard = "오늘의 부적 받기"
public static let receiveTodayFortune = "오늘의 운세가 도착했어요!"
public static let checkTodayFortune = "오늘의 운세 확인하기"
public static let goHome = "홈으로 돌아가기"
public static let goHome = "돌아가기"
public static let dateErrorToastMessage = "앗, 오늘의 솝마디만 볼 수 있어요."
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import UIKit
import Combine

import Core
import DSKit
Expand All @@ -17,6 +18,13 @@ final class SoptlogMenuCVC: UICollectionViewCell {
// MARK: - Properties

private var rightStackViewTrailingConstraint: Constraint?
public private(set) lazy var toolTipButtonTapped = tooltipButton.publisher(for: .touchUpInside)
.withUnretained(self)
.map { owner, _ in
owner.tooltipButton.convert(owner.tooltipButton.bounds, to: nil)
}.asDriver()

private(set) var cancelBag = CancelBag()

// MARK: - UI Components

Expand Down Expand Up @@ -89,6 +97,12 @@ final class SoptlogMenuCVC: UICollectionViewCell {
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

// MARK: - override

override func prepareForReuse() {
cancelBag.cancel()
}
}

// MARK: - UI & Layout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extension SoptlogVC {
func createLayout() -> UICollectionViewLayout {
let layout = UICollectionViewCompositionalLayout(sectionProvider: { [weak self] sectionIndex, _ in
guard let self,
let sectionType = SoptlogSectionLayoutKind(rawValue: sectionIndex) else {
let sectionType = self.sectionType(for: sectionIndex) else {
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,23 @@ enum SoptlogSectionLayoutKind: Int, CaseIterable {
default: return ""
}
}

/// 활동 상태에 따라 표시할 섹션 목록
static func visibleSections(isActiveUser: Bool) -> [SoptlogSectionLayoutKind] {
var sections: [SoptlogSectionLayoutKind] = [.logo]

if isActiveUser {
sections.append(.soptampLog)
}

sections.append(.pokeLog)
sections.append(.banner)

return sections
}
}

struct SoptlogCellTapInfo {
let section: SoptlogSectionLayoutKind
let row: Int
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,20 @@ final class SoptlogVC: UIViewController, SoptlogViewControllable {

public let viewModel: SoptlogViewModel
private let cancelBag = CancelBag()
private var cellTap = PassthroughSubject<IndexPath, Never>()
private var cellTap = PassthroughSubject<SoptlogCellTapInfo, Never>()
private var toolTipTap = PassthroughSubject<CGRect, Never>()
private var viewWillAppear = PassthroughSubject<Void, Never>()
private var soptlogInfo: SoptlogPresentationModel?
internal var isPokeEmpty: Bool = true

private var isActiveUser: Bool {
UserDefaultKeyList.Auth.isActiveUser ?? false
}

private var visibleSections: [SoptlogSectionLayoutKind] {
SoptlogSectionLayoutKind.visibleSections(isActiveUser: isActiveUser)
}

// MARK: - UI Components

private lazy var naviBar = OPNavigationBar(self, type: .none)
Expand Down Expand Up @@ -137,27 +145,35 @@ extension SoptlogVC {
}
.store(in: cancelBag)
}

/// 섹션 인덱스를 실제 섹션 타입으로 변환
func sectionType(for index: Int) -> SoptlogSectionLayoutKind? {
guard index >= 0 && index < visibleSections.count else { return nil }
return visibleSections[index]
}
}

// MARK: - UICollectionViewDelegate

extension SoptlogVC: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
cellTap.send(indexPath)
guard let sectionType = sectionType(for: indexPath.section) else { return }
let tapInfo = SoptlogCellTapInfo(section: sectionType, row: indexPath.row)
cellTap.send(tapInfo)
}
}

// MARK: - UICollectionViewDataSource

extension SoptlogVC: UICollectionViewDataSource {
func numberOfSections(in collectionView: UICollectionView) -> Int {
return SoptlogSectionLayoutKind.allCases.count
return visibleSections.count
}

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
guard let sectionType = SoptlogSectionLayoutKind(rawValue: section),
guard let sectionType = sectionType(for: section),
let info = soptlogInfo else { return 0 }

switch sectionType {
case .logo:
return 1
Expand All @@ -171,7 +187,7 @@ extension SoptlogVC: UICollectionViewDataSource {
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let section = SoptlogSectionLayoutKind(rawValue: indexPath.section) else {
guard let section = sectionType(for: indexPath.section) else {
return UICollectionViewCell()
}
guard let info = soptlogInfo else { return UICollectionViewCell() }
Expand All @@ -196,7 +212,7 @@ extension SoptlogVC: UICollectionViewDataSource {
}

func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
guard let sectionType = SoptlogSectionLayoutKind(rawValue: indexPath.section) else {
guard let sectionType = sectionType(for: indexPath.section) else {
return UICollectionReusableView()
}

Expand Down Expand Up @@ -262,6 +278,10 @@ extension SoptlogVC: UICollectionViewDataSource {
showSeparator: showSeparator
)

cell.toolTipButtonTapped
.subscribe(toolTipTap)
.store(in: cell.cancelBag)

return cell
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class SoptlogViewModel: SoptlogViewModelType {

public struct Input {
let viewWillAppear: Driver<Void>
let cellTap: Driver<IndexPath>
let cellTap: Driver<SoptlogCellTapInfo>
let toolTipButtonTap: Driver<CGRect>
}

Expand Down Expand Up @@ -76,19 +76,20 @@ extension SoptlogViewModel {
}.store(in: cancelBag)

input.cellTap
.filter{ $0.section == 1 }
.filter{ $0.section == .soptampLog }
.withUnretained(self)
.sink { owner, indexPath in
if indexPath.row == 0 {
.sink { owner, tapInfo in
if tapInfo.row == 0 {
owner.onSoptampHomeTapped?()
}
}.store(in: cancelBag)

// MARK: - 서버 500 에러 해결 후 false filter 제거
input.cellTap
.filter{ $0.section == 2 }
.filter{ $0.section == .pokeLog && false }
.withUnretained(self)
.sink { owner, indexPath in
switch indexPath.row {
.sink { owner, tapInfo in
switch tapInfo.row {
case 0:
owner.onPokeHomeTapped?()
case 1:
Expand All @@ -103,7 +104,7 @@ extension SoptlogViewModel {
}.store(in: cancelBag)

input.cellTap
.filter{ $0.section == 3 }
.filter{ $0.section == .banner }
.withUnretained(self)
.sink { owner, _ in
owner.onSoptuneTapped?()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,6 @@ public final class TabBarCoordinator: BaseCoordinator {
}
}

tabBar.vm.showTabBarAlert = { [weak self] in
AlertUtils.presentAlertVC(
type: .titleDescription,
title: I18N.Home.PopUp.needToLogin,
description: I18N.Home.PopUp.needToLoginDetail,
customButtonTitle: I18N.Home.PopUp.login,
customAction: { [weak self] in
guard let self else { return }
self.delegate?.tabBarCoordinator(self, to: .signIn)
}
)
}

self.tabBarController = tabBar.vc
self.navigationController?.setViewControllers([tabBar.vc], animated: false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,8 @@ extension TabBarViewModel {
input.isTabSelectedIndex
.withUnretained(self)
.sink { owner, index in
if index == 1, owner.userType == .visitor {
owner.showTabBarAlert?()
output.selectedIndex.send(0)
} else {
owner.onTabBarItemTapped?(index)
owner.trackAmplitude(itemIndex: index)
}
owner.onTabBarItemTapped?(index)
owner.trackAmplitude(itemIndex: index)
}.store(in: cancelBag)
Comment on lines 54 to 57
Copy link

@coderabbitai coderabbitai bot Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

find . -type f -name "*TabBarCoordinator*" | head -20

Repository: sopt-makers/SOPT-iOS

Length of output: 430


🏁 Script executed:

cat -n ./SOPT-iOS/Projects/Features/TabBarFeature/Sources/Coordinator/TabBarCoordinator.swift

Repository: sopt-makers/SOPT-iOS

Length of output: 3477


🏁 Script executed:

cat -n ./SOPT-iOS/Projects/Features/TabBarFeature/Interface/Sources/TabBarCoordinatorDestination.swift

Repository: sopt-makers/SOPT-iOS

Length of output: 491


🏁 Script executed:

# Check the previous version of TabBarViewModel to see what the visitor handling logic looked like
git show HEAD:SOPT-iOS/Projects/Features/TabBarFeature/Sources/ViewModel/TabBarViewModel.swift | head -100

Repository: sopt-makers/SOPT-iOS

Length of output: 1754


🏁 Script executed:

# Search for any visitor-related logic in TabBarViewModel across git history
git log -p --all -- SOPT-iOS/Projects/Features/TabBarFeature/Sources/ViewModel/TabBarViewModel.swift | grep -A 10 -B 10 "visitor\|userType\|index.*==.*1" | head -100

Repository: sopt-makers/SOPT-iOS

Length of output: 46


🏁 Script executed:

# Check if there's any commit that added the showTabBarAlert property
git log --all --oneline -- SOPT-iOS/Projects/Features/TabBarFeature/Sources/ViewModel/TabBarViewModel.swift

Repository: sopt-makers/SOPT-iOS

Length of output: 850


🏁 Script executed:

# Check the specific commit that added user type handling
git show 0e39c0d2:SOPT-iOS/Projects/Features/TabBarFeature/Sources/ViewModel/TabBarViewModel.swift | cat -n

Repository: sopt-makers/SOPT-iOS

Length of output: 1787


🏁 Script executed:

# Check what changed between commit 0e39c0d2 and current HEAD
git log --oneline 0e39c0d2..HEAD -- SOPT-iOS/Projects/Features/TabBarFeature/Sources/ViewModel/TabBarViewModel.swift

Repository: sopt-makers/SOPT-iOS

Length of output: 97


🏁 Script executed:

# Check the conflict resolution commit to see what changed
git show 44e13877:SOPT-iOS/Projects/Features/TabBarFeature/Sources/ViewModel/TabBarViewModel.swift | head -60

Repository: sopt-makers/SOPT-iOS

Length of output: 1486


TabBarCoordinator에 방문자 탭 제한 로직을 구현하세요.

방문자가 탭 인덱스 1을 선택할 때 표시되던 알림 분기 로직이 ViewModel에서 제거되었습니다. 이 로직이 TabBarCoordinator에 구현되어야 하는데, 현재 코디네이터의 onTabBarItemTapped 핸들러(70-84줄)에는 userType 확인이 없습니다.

다음을 추가하세요:

  • index == 1일 때 userType == .visitor 여부를 확인
  • 방문자인 경우 .signIn 네비게이션 호출
  • 아니면 기존처럼 해당 탭으로 네비게이션

현재 상태에서는 방문자도 모든 탭에 접근 가능합니다.

🤖 Prompt for AI Agents
In
SOPT-iOS/Projects/Features/TabBarFeature/Sources/ViewModel/TabBarViewModel.swift
around lines 70–84, the TabBarCoordinator's onTabBarItemTapped handler is
missing a visitor check for index == 1; update the handler so that if index == 1
you first check coordinator.userType (or provided userType) and if it equals
.visitor call the navigation to .signIn, otherwise proceed with the existing tab
navigation flow for that index; ensure other indices keep current behavior
(including any tracking) and that the sign-in navigation replaces the tab
selection when visitor.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이제 사용자 구분 없이 모두 솝트로그 탭을 사용할 수 있도록 정책이 변경됐어.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yungu0010, 정책 변경에 대해 알려주셔서 감사합니다! 이제 방문자를 포함한 모든 사용자가 솝트로그 탭에 접근할 수 있다는 점을 이해했습니다. 기존의 방문자 제한 로직을 제거한 것이 의도된 변경이었네요.

٩(◕‿◕。)۶


✏️ Learnings added
Learnt from: yungu0010
Repo: sopt-makers/SOPT-iOS PR: 777
File: SOPT-iOS/Projects/Features/TabBarFeature/Sources/ViewModel/TabBarViewModel.swift:54-57
Timestamp: 2025-12-12T15:53:28.704Z
Learning: SOPT-iOS TabBarFeature에서 솝트로그 탭(인덱스 1)은 이제 방문자(visitor)를 포함한 모든 사용자 유형이 접근 가능하도록 정책이 변경되었으며, 이전에 존재했던 방문자 제한 로직은 의도적으로 제거되었음.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: dlwogus0128
Repo: sopt-makers/SOPT-iOS PR: 696
File: SOPT-iOS/Projects/Features/HomeFeature/Sources/HomeScene/ViewModel/HomeForMemberViewModel.swift:220-233
Timestamp: 2025-09-07T04:10:50.872Z
Learning: SOPT-iOS 홈 화면에서 userID가 없는 경우는 익명 사용자를 의미하며, 익명 사용자의 프로필 이미지 클릭은 사용자 상세 정보 페이지로 이동할 수 없고 트래킹도 무의미하므로 수행하지 않는 것이 올바름.


return output
Expand Down