푸시, 딥링크 - 라이브 탭으로 이동하지 않아도 실행되도록 수정
This commit is contained in:
@@ -13,6 +13,7 @@ import Kingfisher
|
||||
struct HomeView: View {
|
||||
|
||||
@StateObject var viewModel = HomeViewModel()
|
||||
@StateObject var liveViewModel = LiveViewModel()
|
||||
@StateObject var appState = AppState.shared
|
||||
@StateObject var contentPlayManager = ContentPlayManager.shared
|
||||
|
||||
@@ -142,6 +143,59 @@ struct HomeView: View {
|
||||
}
|
||||
}
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
.valueChanged(value: appState.pushRoomId) { value in
|
||||
DispatchQueue.main.async {
|
||||
appState.setAppStep(step: .main)
|
||||
|
||||
if value > 0 {
|
||||
liveViewModel.enterRoom(roomId: value)
|
||||
}
|
||||
}
|
||||
}
|
||||
.valueChanged(value: appState.pushChannelId) { value in
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
if value > 0 {
|
||||
appState.setAppStep(step: .main)
|
||||
appState.setAppStep(step: .creatorDetail(userId: value))
|
||||
}
|
||||
}
|
||||
}
|
||||
.valueChanged(value: appState.pushMessageId) { value in
|
||||
DispatchQueue.main.async {
|
||||
appState.setAppStep(step: .main)
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
if value > 0 {
|
||||
viewModel.currentTab = .message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.valueChanged(value: appState.pushAudioContentId) { value in
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
if value > 0 {
|
||||
appState.setAppStep(step: .main)
|
||||
appState.setAppStep(step: .contentDetail(contentId: value))
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if appState.pushRoomId > 0 {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
||||
liveViewModel.enterRoom(roomId: appState.pushRoomId)
|
||||
}
|
||||
} else if appState.pushChannelId > 0 {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
||||
appState.setAppStep(step: .creatorDetail(userId: appState.pushChannelId))
|
||||
}
|
||||
} else if appState.pushAudioContentId > 0 {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
||||
appState.setAppStep(step: .contentDetail(contentId: appState.pushAudioContentId))
|
||||
}
|
||||
} else if appState.pushMessageId > 0 {
|
||||
viewModel.currentTab = .message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user