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

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

@@ -0,0 +1,35 @@
//
// NotificationSettingsDialogViewModel.swift
// SodaLive
//
// Created by klaus on 2023/08/11.
//
import Foundation
import Combine
final class NotificationSettingsDialogViewModel: ObservableObject {
private let userRepository = UserRepository()
private var subscription = Set<AnyCancellable>()
@Published var live = true
@Published var uploadContent = true
@Published var message = true
func submit() {
userRepository
.updateNotificationSettings(live: live, uploadContent: uploadContent, message: message)
.sink { result in
switch result {
case .finished:
DEBUG_LOG("finish")
case .failure(let error):
ERROR_LOG(error.localizedDescription)
}
} receiveValue: { _ in
AppState.shared.isShowNotificationSettingsDialog = false
}
.store(in: &subscription)
}
}