메인 - 회원정보 가져오기, 푸시토큰 업데이트, 이벤트 팝업 추가

This commit is contained in:
Yu Sung
2023-08-11 04:16:16 +09:00
parent cb644f745e
commit af43d14f18
11 changed files with 384 additions and 1 deletions

View File

@@ -58,12 +58,49 @@ struct HomeView: View {
}
}
.onAppear {
pushTokenUpdate()
viewModel.getMemberInfo()
viewModel.getEventPopup()
}
if appState.isShowNotificationSettingsDialog {
NotificationSettingsDialog()
}
if let eventItem = appState.eventPopup {
VStack(spacing: 0) {
Spacer()
EventPopupDialogView(eventPopup: eventItem)
if proxy.safeAreaInsets.bottom > 0 {
Rectangle()
.foregroundColor(Color(hex: "222222"))
.frame(width: proxy.size.width, height: 15.3)
}
}
.background(Color(hex: "222222").opacity(0.7))
.onTapGesture {
AppState.shared.eventPopup = nil
}
}
}
.edgesIgnoringSafeArea(.bottom)
}
}
private func pushTokenUpdate() {
Messaging.messaging().token { token, error in
if let error = error {
DEBUG_LOG(error.localizedDescription)
} else {
if let token = token {
UserDefaults.set(token, forKey: .pushToken)
self.viewModel.pushTokenUpdate(pushToken: token)
}
}
}
}
}
struct HomeView_Previews: PreviewProvider {