|
|
@@ -13,6 +13,7 @@ import UIKit |
|
|
|
public protocol MicContext { |
|
|
|
var activeIds: MPAK.Recent<[String]> { get } |
|
|
|
var activityDates: MPAK.Recent<[String:Date]> { get } |
|
|
|
var requestActivityDate: String? { get } |
|
|
|
} |
|
|
|
|
|
|
|
// MARK: - Controller |
|
|
@@ -35,6 +36,7 @@ extension Mic { |
|
|
|
public struct Model: MicContext { |
|
|
|
public var activeIds: MPAK.Recent<[String]> = .init([]) |
|
|
|
public var activityDates: MPAK.Recent<[String:Date]> = .init([:]) |
|
|
|
public var requestActivityDate: String? = nil |
|
|
|
} |
|
|
|
|
|
|
|
// MARK: - Service |
|
|
@@ -78,10 +80,15 @@ extension Mic { |
|
|
|
) { |
|
|
|
// MARK: - SectionGenerated Service Actions |
|
|
|
|
|
|
|
ctrl.m |
|
|
|
.compactMap { shouldDeliverActivityDates($0) } |
|
|
|
.receive(on: DispatchQueue.main) |
|
|
|
.sink { v in Bus.deliver(K.activityDate, v) } |
|
|
|
.store(in: &service.subscriptions) |
|
|
|
ctrl.m |
|
|
|
.compactMap { shouldResetActivityDates($0) } |
|
|
|
.receive(on: DispatchQueue.main) |
|
|
|
.sink { v in Bus.send(K.activityDates, v);Bus.deliver(K.activityDate, v) } |
|
|
|
.sink { v in Bus.send(K.activityDates, v) } |
|
|
|
.store(in: &service.subscriptions) |
|
|
|
|
|
|
|
|
|
|
@@ -113,6 +120,19 @@ extension Mic { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctrl.pipeValue( |
|
|
|
dbg: "requestAD", |
|
|
|
sub: nil, |
|
|
|
Bus.events.compactMap { Bus.convertKeyValue(K.requestActivityDate, $0) }.map { (k: String, v: String?) in v }.eraseToAnyPublisher(), |
|
|
|
{ $0.requestActivityDate = $1 }, |
|
|
|
{ m, _ in m.requestActivityDate = nil } |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|