Михаил Капелько 10 meses atrás
pai
commit
0309ab67b4
2 arquivos alterados com 38 adições e 10 exclusões
  1. +9
    -5
      Modules/MeetupIdX/src/MeetupId.SectionBus.swift
  2. +29
    -5
      Modules/MeetupIdX/src/MeetupId.Shoulds.swift

+ 9
- 5
Modules/MeetupIdX/src/MeetupId.SectionBus.swift Ver arquivo

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


+ 29
- 5
Modules/MeetupIdX/src/MeetupId.Shoulds.swift Ver arquivo

@@ -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<Bool>? {
guard !c.isLoading.keys.isEmpty else { return nil }
var keys = Set<String>()
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<String>? {
/**/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<String>? {
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)
}

}

Carregando…
Cancelar
Salvar