|
|
@@ -12,6 +12,7 @@ import UIKit |
|
|
|
// MARK: - Context |
|
|
|
|
|
|
|
public protocol MeetupIdContext { |
|
|
|
var join: Bool { get } |
|
|
|
var textApp: MPAK.Recent<String> { get } |
|
|
|
var textUI: MPAK.Recent<String> { get } |
|
|
|
} |
|
|
@@ -34,6 +35,7 @@ extension MeetupId { |
|
|
|
// MARK: - Model |
|
|
|
|
|
|
|
public struct Model: MeetupIdContext { |
|
|
|
public var join: Bool = false |
|
|
|
public var textApp: MPAK.Recent<String> = .init("") |
|
|
|
public var textUI: MPAK.Recent<String> = .init("") |
|
|
|
} |
|
|
@@ -57,6 +59,7 @@ extension MeetupId { |
|
|
|
// MARK: - World |
|
|
|
|
|
|
|
public struct World { |
|
|
|
let join = PassthroughSubject<Void, Never>() |
|
|
|
let textApp = PassthroughSubject<String, Never>() |
|
|
|
let textUI = PassthroughSubject<String, Never>() |
|
|
|
|
|
|
@@ -87,10 +90,23 @@ extension MeetupId { |
|
|
|
|
|
|
|
// MARK: - SectionGenerated Service Pipes |
|
|
|
|
|
|
|
ctrl.pipe( |
|
|
|
dbg: "join", |
|
|
|
sub: nil, |
|
|
|
Bus.events.compactMap { Bus.convertKeyValue(K.join, $0) }.map { (k: String, v: Bool) in v }.eraseToAnyPublisher(), |
|
|
|
{ $0.join = true }, |
|
|
|
{ $0.join = false } |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ctrl.pipeValue( |
|
|
|
dbg: "textA", |
|
|
|
sub: nil, |
|
|
|
Bus.events.compactMap { Bus.convertKeyValue(K.textApp, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher().eraseToAnyPublisher(), |
|
|
|
Bus.events.compactMap { Bus.convertKeyValue(K.textApp, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher(), |
|
|
|
{ |
|
|
|
$0.textApp.value = $1 |
|
|
|
$0.textApp.isRecent = true |
|
|
@@ -103,7 +119,7 @@ extension MeetupId { |
|
|
|
ctrl.pipeValue( |
|
|
|
dbg: "textUI", |
|
|
|
sub: nil, |
|
|
|
Bus.events.compactMap { Bus.convertKeyValue(K.textUI, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher().eraseToAnyPublisher(), |
|
|
|
Bus.events.compactMap { Bus.convertKeyValue(K.textUI, $0) }.map { (k: String, v: String) in v }.eraseToAnyPublisher(), |
|
|
|
{ |
|
|
|
$0.textUI.value = $1 |
|
|
|
$0.textUI.isRecent = true |
|
|
|