From 496c34a89f2a768bec1e274f1cc615cdd42e7a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Thu, 18 Jan 2024 18:46:09 +0300 Subject: [PATCH] d --- Modules/MicX/MicItem/src/MicItem.V.swift | 6 +++--- Modules/MicX/MicItem/src/MicItem.WillBe.swift | 8 ++++---- src/App.swift | 16 ++++++++++++++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Modules/MicX/MicItem/src/MicItem.V.swift b/Modules/MicX/MicItem/src/MicItem.V.swift index c135906..191313a 100644 --- a/Modules/MicX/MicItem/src/MicItem.V.swift +++ b/Modules/MicX/MicItem/src/MicItem.V.swift @@ -10,9 +10,9 @@ extension MicItem { public init(_ id: String? = nil) { self.id = id self.proc = [ - Bus.DelayV(shouldResetTimeout, K.MI, K.timeout), - Bus.Sync(shouldResetActivity, K.MI, K.isActive), - MicItem.Controller() + Bus.DelayV(shouldResetTimeout, K.MI, K.timeout, id), + Bus.Sync(shouldResetActivity, K.MI, K.isActive, id), + MicItem.Controller(id) ] } diff --git a/Modules/MicX/MicItem/src/MicItem.WillBe.swift b/Modules/MicX/MicItem/src/MicItem.WillBe.swift index 2030849..5cb0f3e 100644 --- a/Modules/MicX/MicItem/src/MicItem.WillBe.swift +++ b/Modules/MicX/MicItem/src/MicItem.WillBe.swift @@ -15,7 +15,7 @@ extension MicItem { extension MicItem { final class Controller: MPAK.Controller { - init() { + init(_ id: String? = nil) { /**/print("MicIC.init") super.init( MicItem.Model(), @@ -26,13 +26,13 @@ extension MicItem { // Нижеследующее предстоит сгенерить. m - .sink { v in Bus.send(K.MI, v) } + .sink { v in Bus.send(Bus.keyId(K.MI, id), v) } .store(in: &subscriptions) pipeValue( dbg: "activityD", sub: nil, - Bus.events.compactMap { Bus.convertKeyValue(K.activityDate, $0) }.map { (k: String, v: Date?) in v }.eraseToAnyPublisher(), + Bus.events.compactMap { Bus.convertKeyValue(Bus.keyId(K.activityDate, id), $0) }.map { (k: String, v: Date?) in v }.eraseToAnyPublisher(), { $0.activityDate.value = $1 $0.activityDate.isRecent = true @@ -43,7 +43,7 @@ extension MicItem { pipe( dbg: "timeout", sub: nil, - Bus.events.compactMap { Bus.convertKeyValue(K.timeout, $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(), + Bus.events.compactMap { Bus.convertKeyValue(Bus.keyId(K.timeout, id), $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(), { $0.timeout = true }, { $0.timeout = false } ) diff --git a/src/App.swift b/src/App.swift index a18e6ab..932edbd 100644 --- a/src/App.swift +++ b/src/App.swift @@ -33,7 +33,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate /**/print("ИГР App.didFLWO") //testMic1() - testMic2() + //testMic2() + testMic2_id("1") return true } @@ -57,7 +58,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate DispatchQueue.main.asyncAfter(deadline: .now() + 6) { Bus.send(Mic.K.activityDate, Date() + 7) } + } + + func testMic2_id(_ id: String) { + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + Bus.send(Bus.keyId(Mic.K.activityDate, id), Date() + 2) + } - // "1" + DispatchQueue.main.asyncAfter(deadline: .now() + 5) { + Bus.send(Bus.keyId(Mic.K.activityDate, id), Date() + 2) + } + DispatchQueue.main.asyncAfter(deadline: .now() + 6) { + Bus.send(Bus.keyId(Mic.K.activityDate, id), Date() + 3) + } } }