From b63dbd4aabb9c8174772463b964f21e5a3f88af1 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: Fri, 9 Feb 2024 08:23:45 +0300 Subject: [PATCH] d --- ...m.Generated.swift => MicItem.WillBe.swift} | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) rename Modules/MicX/MicItem/src/{MicItem.Generated.swift => MicItem.WillBe.swift} (71%) diff --git a/Modules/MicX/MicItem/src/MicItem.Generated.swift b/Modules/MicX/MicItem/src/MicItem.WillBe.swift similarity index 71% rename from Modules/MicX/MicItem/src/MicItem.Generated.swift rename to Modules/MicX/MicItem/src/MicItem.WillBe.swift index 99b1bf7..0efe274 100644 --- a/Modules/MicX/MicItem/src/MicItem.Generated.swift +++ b/Modules/MicX/MicItem/src/MicItem.WillBe.swift @@ -1,14 +1,5 @@ -// ВНИМАНИЕ Сгенерировано автоматом из файла MicItem.yml -// ВНИМАНИЕ Не менять руками! - -import AELog import BusX -import Combine -import Foundation import MPAKX -import UIKit - -// MARK: - Context public protocol MicItemContext { var activityDate: MPAK.Recent { get } @@ -16,16 +7,13 @@ public protocol MicItemContext { } extension MicItem { - - // MARK: - Model - public struct Model: MicItemContext { public var activityDate: MPAK.Recent = .init(nil) public var timeout: Bool = false } +} - // MARK: - Controller - +extension MicItem { final class Controller: MPAK.Controller { init(_ id: String? = nil) { var sid = "" @@ -34,17 +22,19 @@ extension MicItem { } super.init( MicItem.Model(), - debugClassName: "MicItemCtrl", - debugLog: { aelog("\($0)\(sid)") } + debugClassName: "MicICtrl", + debugLog: { print("\($0)\(sid)") } ) - // Отправляем модель в Шину. + + // Нижеследующее предстоит сгенерить. m - .sink { v in Bus.send(Bus.keyId("MicItem", id), 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(Bus.keyId(K.activityDate, id), $0) }.map { (k: String, v: Date?) in v }.eraseToAnyPublisher(), { $0.activityDate.value = $1 @@ -52,8 +42,10 @@ extension MicItem { }, { m, _ in m.activityDate.isRecent = false } ) + pipe( dbg: "timeout", + sub: nil, 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 }