From 0309ab67b4a22f0d65623ae890d077d675f65dfe 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: Mon, 8 Jan 2024 18:33:54 +0300 Subject: [PATCH] d --- .../MeetupIdX/src/MeetupId.SectionBus.swift | 14 +++++--- Modules/MeetupIdX/src/MeetupId.Shoulds.swift | 34 ++++++++++++++++--- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/Modules/MeetupIdX/src/MeetupId.SectionBus.swift b/Modules/MeetupIdX/src/MeetupId.SectionBus.swift index 825dcfb..fd31783 100644 --- a/Modules/MeetupIdX/src/MeetupId.SectionBus.swift +++ b/Modules/MeetupIdX/src/MeetupId.SectionBus.swift @@ -8,12 +8,16 @@ extension MeetupId { _ world: World ) { service.any.append(contentsOf: [ - Bus.Debounce(shouldResetText, 0.2, K.M, K.textApp), - Bus.Delay(shouldFinishLoading, 5, K.M, K.finishLoading), - Bus.Sync(shouldEnableJoin, K.M, K.isJoinAvailable), - Bus.Sync(shouldResetLoading, K.M, K.isLoading), + //Bus.Debounce(shouldResetText, 0.2, K.M, K.textApp), + Bus.Debounce(shouldManyResetText, 0.2, K.M, K.textApp), + //Bus.Delay(shouldFinishLoading, 5, K.M, K.finishLoading), + Bus.Delay(shouldManyFinishLoading, 5, K.M, K.finishLoading), + //Bus.Sync(shouldEnableJoin, K.M, K.isJoinAvailable), + Bus.Sync(shouldManyJoin, K.M, K.isJoinAvailable), + //Bus.Sync(shouldResetLoading, K.M, K.isLoading), + Bus.Sync(shouldManyResetLoading, K.M, K.isLoading), - Bus.Debounce(shouldManyResetText, 0.2, K.M, K.testTextApp), + Bus.Debounce(shouldManyTestResetText, 0.2, K.M, K.testTextApp), ]) } } diff --git a/Modules/MeetupIdX/src/MeetupId.Shoulds.swift b/Modules/MeetupIdX/src/MeetupId.Shoulds.swift index 4a8138e..a273269 100644 --- a/Modules/MeetupIdX/src/MeetupId.Shoulds.swift +++ b/Modules/MeetupIdX/src/MeetupId.Shoulds.swift @@ -26,6 +26,7 @@ public extension MeetupId { return nil } +/* static func shouldFinishLoading(_ c: MeetupIdContext) -> Bool? { guard c.isLoading.isRecent, @@ -35,6 +36,7 @@ public extension MeetupId { } return true } + */ static func shouldResetLoading(_ c: MeetupIdContext) -> Bool? { if @@ -54,25 +56,47 @@ public extension MeetupId { return nil } +/* static func shouldResetText(_ c: MeetupIdContext) -> String? { guard c.textUI.isRecent else { return nil } return formatId(c.textUI.value) } + */ // MARK: - Many + static func shouldManyFinishLoading(_ c: MeetupIdContext) -> MPAK.Many? { + guard !c.isLoading.keys.isEmpty else { return nil } + var keys = Set() + var d = [String: Bool]() + for id in c.isLoading.keys { + if + let isLoading = c.isLoading.dict[id], + isLoading + { + keys.insert(id) + } + } + return MPAK.Many(keys, d) + } static func shouldManyResetText(_ c: MeetupIdContext) -> MPAK.Many? { - /**/print("ИГР MeetupIS.shouldMRT-1") + guard !c.textUI.keys.isEmpty else { return nil } + var d = [String: String]() + for id in c.textUI.keys { + let text = c.textUI.dict[id] ?? "" + d[id] = formatId(text) + } + return MPAK.Many(c.textUI.keys, d) + } + + static func shouldManyTestResetText(_ c: MeetupIdContext) -> MPAK.Many? { guard !c.testTextUI.keys.isEmpty else { return nil } - /**/print("ИГР MeetupIS.shouldMRT-2") var d = [String: String]() for id in c.testTextUI.keys { let text = c.testTextUI.dict[id] ?? "" d[id] = formatId(text) } - let r = MPAK.Many(c.testTextUI.keys, d) - /**/print("ИГР MeetupIS.shouldMRT-3 r: '\(r)'") - return r + return MPAK.Many(c.testTextUI.keys, d) } }