Михаил Капелько 11 months ago
parent
commit
496c34a89f
3 changed files with 21 additions and 9 deletions
  1. +3
    -3
      Modules/MicX/MicItem/src/MicItem.V.swift
  2. +4
    -4
      Modules/MicX/MicItem/src/MicItem.WillBe.swift
  3. +14
    -2
      src/App.swift

+ 3
- 3
Modules/MicX/MicItem/src/MicItem.V.swift View File

@@ -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)
]
}


+ 4
- 4
Modules/MicX/MicItem/src/MicItem.WillBe.swift View File

@@ -15,7 +15,7 @@ extension MicItem {

extension MicItem {
final class Controller: MPAK.Controller<MicItem.Model> {
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 }
)


+ 14
- 2
src/App.swift View File

@@ -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)
}
}
}

Loading…
Cancel
Save