From 9e941f01a5de740cf99ef039beec0cae7794af81 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: Wed, 17 Jan 2024 18:46:57 +0300 Subject: [PATCH] d --- Modules/MicX/MicItem/src/MicItem.Shoulds.swift | 6 +++++- Modules/MicX/MicItem/src/MicItem.WillBe.swift | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Modules/MicX/MicItem/src/MicItem.Shoulds.swift b/Modules/MicX/MicItem/src/MicItem.Shoulds.swift index d979201..90cbfad 100644 --- a/Modules/MicX/MicItem/src/MicItem.Shoulds.swift +++ b/Modules/MicX/MicItem/src/MicItem.Shoulds.swift @@ -8,6 +8,10 @@ public extension MicItem { return now < end } + if timeout { + return false + } + return nil } @@ -18,7 +22,7 @@ public extension MicItem { { let timeout = end.timeIntervalSinceNow /**/print("ИГР MicIS.shouldRT timeout: '\(timeout)'") - return nil + return timeout > 0 ? timeout : nil } return nil diff --git a/Modules/MicX/MicItem/src/MicItem.WillBe.swift b/Modules/MicX/MicItem/src/MicItem.WillBe.swift index 3594b08..4be06f8 100644 --- a/Modules/MicX/MicItem/src/MicItem.WillBe.swift +++ b/Modules/MicX/MicItem/src/MicItem.WillBe.swift @@ -3,11 +3,13 @@ import MPAKX public protocol MicItemContext { var activityDate: MPAK.Recent { get } + var timeout: Bool { get } } extension MicItem { public struct Model: MicItemContext { public var activityDate: MPAK.Recent = .init(nil) + public var timeout: Bool = false } } @@ -37,6 +39,15 @@ extension MicItem { }, { m, _ in m.activityDate.isRecent = false } ) + + ctrl.pipe( + dbg: "timeout", + sub: nil, + Bus.events.compactMap { Bus.convertKeyValue(K.timeout, $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(), + { $0.timeout = true }, + { $0.timeout = false } + ) + } } }