This commit is contained in:
Justin Mazzocchi 2020-09-09 20:04:45 -07:00
parent 649a146e8f
commit c3ca23d736
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
2 changed files with 7 additions and 7 deletions

View file

@ -5,7 +5,7 @@ import UIKit
final class AppDelegate: NSObject {
@Published private var application: UIApplication?
private let remoteNotificationDeviceTokens = PassthroughSubject<Data, Error>()
private let deviceTokenSubject = PassthroughSubject<Data, Error>()
}
extension AppDelegate {
@ -14,7 +14,7 @@ extension AppDelegate {
.compactMap { $0 }
.handleEvents(receiveOutput: { $0.registerForRemoteNotifications() })
.setFailureType(to: Error.self)
.zip(remoteNotificationDeviceTokens)
.zip(deviceTokenSubject)
.first()
.map { $1 }
.eraseToAnyPublisher()
@ -32,11 +32,11 @@ extension AppDelegate: UIApplicationDelegate {
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
remoteNotificationDeviceTokens.send(deviceToken)
deviceTokenSubject.send(deviceToken)
}
func application(_ application: UIApplication,
didFailToRegisterForRemoteNotificationsWithError error: Error) {
remoteNotificationDeviceTokens.send(completion: .failure(error))
deviceTokenSubject.send(completion: .failure(error))
}
}

View file

@ -16,14 +16,14 @@ public final class EditFilterViewModel: ObservableObject {
}
private let identification: Identification
private let saveCompletedInput = PassthroughSubject<Void, Never>()
private let saveCompletedSubject = PassthroughSubject<Void, Never>()
private var cancellables = Set<AnyCancellable>()
public init(filter: Filter, identification: Identification) {
self.filter = filter
self.identification = identification
date = filter.expiresAt ?? Date()
saveCompleted = saveCompletedInput.eraseToAnyPublisher()
saveCompleted = saveCompletedSubject.eraseToAnyPublisher()
}
}
@ -51,7 +51,7 @@ public extension EditFilterViewModel {
self.saving = false
if case .finished = $0 {
self.saveCompletedInput.send(())
self.saveCompletedSubject.send()
}
})
.sink { _ in }