feat(notification): 알림함 진입 및 딥링크 라우팅을 추가한다
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
import SwiftUI
|
||||
|
||||
struct PushNotificationListView: View {
|
||||
@StateObject var viewModel = PushNotificationListViewModel()
|
||||
@State private var isInitialized = false
|
||||
|
||||
var body: some View {
|
||||
BaseView(isLoading: $viewModel.isLoading) {
|
||||
VStack(alignment: .leading, spacing: 13.3) {
|
||||
titleBar
|
||||
|
||||
ContentMainContentThemeView(
|
||||
themeList: viewModel.categories,
|
||||
selectTheme: {
|
||||
viewModel.selectedCategory = $0
|
||||
},
|
||||
selectedTheme: $viewModel.selectedCategory
|
||||
)
|
||||
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
LazyVStack(spacing: 0) {
|
||||
ForEach(0..<viewModel.items.count, id: \.self) { index in
|
||||
let item = viewModel.items[index]
|
||||
PushNotificationListItemView(item: item)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
viewModel.onTapItem(item)
|
||||
}
|
||||
.onAppear {
|
||||
if index == viewModel.items.count - 1 {
|
||||
viewModel.getPushNotificationList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if viewModel.items.isEmpty && !viewModel.isLoading {
|
||||
VStack(spacing: 8) {
|
||||
Image("ic_no_item")
|
||||
.resizable()
|
||||
.frame(width: 60, height: 60)
|
||||
|
||||
Text("알림이 없습니다.")
|
||||
.appFont(size: 10.7, weight: .medium)
|
||||
.foregroundColor(Color(hex: "bbbbbb"))
|
||||
}
|
||||
.frame(width: screenSize().width, height: screenSize().height / 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if !isInitialized {
|
||||
viewModel.initialize()
|
||||
isInitialized = true
|
||||
}
|
||||
}
|
||||
}
|
||||
.popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) {
|
||||
GeometryReader { geo in
|
||||
HStack {
|
||||
Spacer()
|
||||
Text(viewModel.errorMessage)
|
||||
.padding(.vertical, 13.3)
|
||||
.padding(.horizontal, 6.7)
|
||||
.frame(width: geo.size.width - 66.7, alignment: .center)
|
||||
.appFont(size: 12, weight: .medium)
|
||||
.background(Color(hex: "3bb9f1"))
|
||||
.foregroundColor(Color.white)
|
||||
.multilineTextAlignment(.leading)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(20)
|
||||
.padding(.top, 66.7)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationBarHidden(true)
|
||||
}
|
||||
|
||||
private var titleBar: some View {
|
||||
ZStack {
|
||||
DetailNavigationBar(title: "알림")
|
||||
|
||||
HStack(spacing: 0) {
|
||||
Spacer()
|
||||
|
||||
Image("ic_bell_settings")
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
AppState.shared.setAppStep(step: .notificationSettings)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 13.3)
|
||||
.frame(height: 50)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user