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