This commit is contained in:
Михаил Капелько
2023-12-29 13:50:08 +03:00
parent 3063d0dd54
commit 1afcae37a7
3 changed files with 17 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ import Foundation
public extension MeetupId {
static func finishLoading(_ isLoading: Bool) -> Bool? {
guard isLoading else { return nil }
return false
return true
}
static func formatId(_ s: String) -> String? {

View File

@@ -12,6 +12,7 @@ import UIKit
// MARK: - Context
public protocol MeetupIdContext {
var finishLoading: Bool { get }
var isLoading: MPAK.Recent<Bool> { get }
var join: Bool { get }
var textUI: MPAK.Recent<String> { get }
@@ -35,6 +36,7 @@ extension MeetupId {
// MARK: - Model
public struct Model: MeetupIdContext {
public var finishLoading: Bool = false
public var isLoading: MPAK.Recent<Bool> = .init(false)
public var join: Bool = false
public var textUI: MPAK.Recent<String> = .init("")
@@ -93,6 +95,19 @@ extension MeetupId {
// MARK: - SectionGenerated Service Pipes
ctrl.pipe(
dbg: "finishL",
sub: nil,
Bus.events.compactMap { Bus.convertKeyValue(K.finishLoading, $0) }.map { (k: String, v: Void) in v }.eraseToAnyPublisher(),
{ $0.finishLoading = true },
{ $0.finishLoading = false }
)
ctrl.pipeValue(
dbg: "isL",
sub: nil,

View File

@@ -11,7 +11,7 @@ extension MeetupId {
let processors: [Any] = [
Bus.Processor(shouldEnableJoin, K.M, K.isJoinAvailable),
MeetupId.Debounce(0.2, formatId, K.textUI, K.textApp),
MeetupId.Delay(5, finishLoading, K.isLoading, K.isLoading),
MeetupId.Delay(5, finishLoading, K.isLoading, K.finishLoading),
]
public init() { }