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