메인 - 회원정보 가져오기, 푸시토큰 업데이트, 이벤트 팝업 추가
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user