Михаил Капелько 10 meses atrás
pai
commit
dbcf2a17a6
4 arquivos alterados com 29 adições e 0 exclusões
  1. +2
    -0
      Modules/MeetupIdX/MeetupId.yml
  2. +11
    -0
      Modules/MeetupIdX/src/MeetupId.Generated.swift
  3. +2
    -0
      Modules/MeetupIdX/src/MeetupId.SectionBus.swift
  4. +14
    -0
      Modules/MeetupIdX/src/MeetupId.Shoulds.swift

+ 2
- 0
Modules/MeetupIdX/MeetupId.yml Ver arquivo

@@ -5,6 +5,7 @@ model:
isLoading: [Bool, false]
join: [Bool, false]
textUI: [String, ""]
testTextUI: [String, ""]

service:
actions:
@@ -14,5 +15,6 @@ service:
isLoading: [recent, K.isLoading]
join: [toggle, K.join]
textUI: [recent, K.textUI]
testTextUI: [many, K.testTextUI]

world:

+ 11
- 0
Modules/MeetupIdX/src/MeetupId.Generated.swift Ver arquivo

@@ -15,6 +15,7 @@ public protocol MeetupIdContext {
var isLoading: MPAK.Recent<Bool> { get }
var join: Bool { get }
var textUI: MPAK.Recent<String> { get }
var testTextUI: MPAK.Many<String> { get }
}

// MARK: - Controller
@@ -39,6 +40,7 @@ extension MeetupId {
public var isLoading: MPAK.Recent<Bool> = .init(false)
public var join: Bool = false
public var textUI: MPAK.Recent<String> = .init("")
public var testTextUI: MPAK.Many<String> = .init()
}

// MARK: - Service
@@ -142,6 +144,15 @@ extension MeetupId {
)


ctrl.pipeValue(
dbg: "testTUI",
sub: nil,
Bus.events.compactMap { Bus.convertKeyValue(K.testTextUI, $0) }.map { (k: String, v: MPAK.Many<String>) in v }.eraseToAnyPublisher(),
{
$0.testTextUI = $1
},
{ m, _ in m.testTextUI.keys = [] }
)


}


+ 2
- 0
Modules/MeetupIdX/src/MeetupId.SectionBus.swift Ver arquivo

@@ -12,6 +12,8 @@ extension MeetupId {
Bus.Delay(shouldFinishLoading, 5, K.M, K.finishLoading),
Bus.Sync(shouldEnableJoin, K.M, K.isJoinAvailable),
Bus.Sync(shouldResetLoading, K.M, K.isLoading)

Bus.Debounce(shouldManyResetText, 0.2, K.M, K.testTextApp),
])
}
}


+ 14
- 0
Modules/MeetupIdX/src/MeetupId.Shoulds.swift Ver arquivo

@@ -1,4 +1,5 @@
import Foundation
import MPAK

public extension MeetupId {
static func shouldEnableJoin(_ c: MeetupIdContext) -> Bool? {
@@ -57,4 +58,17 @@ public extension MeetupId {
guard c.textUI.isRecent else { return nil }
return formatId(c.textUI.value)
}

// MARK: - Many

static func shouldManyResetText(_ c: MeetupIdContext) -> MPAK.Many<String>? {
guard !c.testTextUI.keys.isEmpty else { return nil }
var d = [String: String]()
for id in c.testTextUI.keys {
let text = c.testTextUI.dict[id]
d[id] = formatId(text)
}
return .init(c.testTextUI.keys, d)
}

}

Carregando…
Cancelar
Salvar