d
This commit is contained in:
@@ -11,6 +11,7 @@ import UIKit
|
||||
// MARK: - Context
|
||||
|
||||
public protocol MicContext {
|
||||
var activeIds: MPAK.Recent<[String]> { get }
|
||||
var activityDates: MPAK.Recent<[String:Date]> { get }
|
||||
}
|
||||
|
||||
@@ -32,6 +33,7 @@ extension Mic {
|
||||
// MARK: - Model
|
||||
|
||||
public struct Model: MicContext {
|
||||
public var activeIds: MPAK.Recent<[String]> = .init([])
|
||||
public var activityDates: MPAK.Recent<[String:Date]> = .init([:])
|
||||
}
|
||||
|
||||
@@ -76,10 +78,28 @@ extension Mic {
|
||||
) {
|
||||
// MARK: - SectionGenerated Service Actions
|
||||
|
||||
ctrl.m
|
||||
.compactMap { shouldResetActivityDates($0) }
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { v in Bus.send(K.activityDates, v) }
|
||||
.store(in: &service.subscriptions)
|
||||
|
||||
|
||||
// MARK: - SectionGenerated Service Pipes
|
||||
|
||||
ctrl.pipeValue(
|
||||
dbg: "activeI",
|
||||
sub: nil,
|
||||
Bus.events.compactMap { Bus.convertKeyValue(K.activeIds, $0) }.map { (k: String, v: [String]) in v }.eraseToAnyPublisher(),
|
||||
{
|
||||
$0.activeIds.value = $1
|
||||
$0.activeIds.isRecent = true
|
||||
},
|
||||
{ m, _ in m.activeIds.isRecent = false }
|
||||
)
|
||||
|
||||
|
||||
|
||||
ctrl.pipeValue(
|
||||
dbg: "activityD",
|
||||
sub: nil,
|
||||
|
||||
Reference in New Issue
Block a user