feat(home): 홈 탭 shell을 연결한다
This commit is contained in:
@@ -153,7 +153,16 @@ struct MainView: View {
|
||||
private var contentView: some View {
|
||||
switch viewModel.currentTab {
|
||||
case .home:
|
||||
MainPlaceholderTabView(title: MainTab.home.title)
|
||||
MainHomeView(
|
||||
onTapCanCharge: handleHomeCanChargeTap,
|
||||
onTapSearch: handleHomeSearchTap,
|
||||
onTapNotificationList: handleHomeNotificationListTap,
|
||||
onTapLive: handleRecommendationLiveTap,
|
||||
onTapCreator: handleRecommendationCreatorTap,
|
||||
onTapContent: handleRecommendationContentTap,
|
||||
onTapCharacter: handleRecommendationCharacterTap,
|
||||
onTapCommunity: handleRecommendationCommunityTap
|
||||
)
|
||||
case .content:
|
||||
MainPlaceholderTabView(title: MainTab.content.title)
|
||||
case .chat:
|
||||
@@ -416,6 +425,106 @@ struct MainView: View {
|
||||
navigationAction()
|
||||
}
|
||||
|
||||
private func handleHomeCanChargeTap() {
|
||||
appState.setAppStep(step: .canCharge(refresh: {}))
|
||||
}
|
||||
|
||||
private func handleHomeSearchTap() {
|
||||
appState.setAppStep(step: .search)
|
||||
}
|
||||
|
||||
private func handleHomeNotificationListTap() {
|
||||
appState.setAppStep(step: .notificationList)
|
||||
}
|
||||
|
||||
private func handleRecommendationLiveTap(roomId: Int) {
|
||||
guard roomId > 0 else { return }
|
||||
performRecommendationDetailAction {
|
||||
openLiveDetail(roomId: roomId)
|
||||
}
|
||||
}
|
||||
|
||||
private func handleRecommendationCreatorTap(creatorId: Int) {
|
||||
guard creatorId > 0 else { return }
|
||||
performRecommendationDetailAction {
|
||||
appState.setAppStep(step: .creatorDetail(userId: creatorId))
|
||||
}
|
||||
}
|
||||
|
||||
private func handleRecommendationContentTap(contentId: Int) {
|
||||
guard contentId > 0 else { return }
|
||||
performRecommendationDetailAction {
|
||||
appState.setAppStep(step: .contentDetail(contentId: contentId))
|
||||
}
|
||||
}
|
||||
|
||||
private func handleRecommendationCharacterTap(characterId: Int) {
|
||||
guard characterId > 0 else { return }
|
||||
performRecommendationDetailAction {
|
||||
appState.setAppStep(step: .characterDetail(characterId: characterId))
|
||||
}
|
||||
}
|
||||
|
||||
private func handleRecommendationCommunityTap(creatorId: Int) {
|
||||
guard creatorId > 0 else { return }
|
||||
performRecommendationDetailAction {
|
||||
appState.setAppStep(step: .creatorCommunityAll(creatorId: creatorId))
|
||||
}
|
||||
}
|
||||
|
||||
private func performRecommendationDetailAction(
|
||||
requiresAdultContent: Bool = false,
|
||||
action: @escaping () -> Void
|
||||
) {
|
||||
let trimmed = token.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !trimmed.isEmpty else {
|
||||
AppState.shared.setAppStep(step: .login)
|
||||
return
|
||||
}
|
||||
|
||||
if requiresAdultContent {
|
||||
let normalizedCountryCode = UserDefaults
|
||||
.string(forKey: .countryCode)
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
.uppercased()
|
||||
let isKoreanCountry = normalizedCountryCode.isEmpty || normalizedCountryCode == "KR"
|
||||
|
||||
if isKoreanCountry && auth == false {
|
||||
pendingAction = action
|
||||
isShowAuthConfirmView = true
|
||||
return
|
||||
}
|
||||
|
||||
if !UserDefaults.isAdultContentVisible() {
|
||||
pendingAction = nil
|
||||
moveToContentSettingsWithGuideToast()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
action()
|
||||
}
|
||||
|
||||
private func openLiveDetail(roomId: Int) {
|
||||
appState.setAppStep(
|
||||
step: .liveDetail(
|
||||
roomId: roomId,
|
||||
onClickParticipant: {
|
||||
appState.isShowPlayer = false
|
||||
liveViewModel.enterLiveRoom(roomId: roomId)
|
||||
},
|
||||
onClickReservation: {},
|
||||
onClickStart: {},
|
||||
onClickCancel: {}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private func moveToContentSettingsWithGuideToast() {
|
||||
AppState.shared.setPendingContentSettingsGuideMessage(I18n.Settings.adultContentEnableGuide)
|
||||
AppState.shared.setAppStep(step: .contentViewSettings)
|
||||
}
|
||||
|
||||
private func confirmExternalNavigation() {
|
||||
guard pendingExternalNavigationAction != nil else {
|
||||
isShowLeaveLiveNavigationDialog = false
|
||||
|
||||
Reference in New Issue
Block a user