Михаил Капелько 11 months ago
parent
commit
cbf87ce93f
4 changed files with 39 additions and 3 deletions
  1. +3
    -0
      Modules/MeetupIdX/MeetupId.yml
  2. +18
    -2
      Modules/MeetupIdX/src/MeetupId.Generated.swift
  3. +17
    -0
      Modules/MeetupIdX/src/MeetupId.Shoulds.swift
  4. +1
    -1
      Utilities/platform/2/generation/pipeSource.py

+ 3
- 0
Modules/MeetupIdX/MeetupId.yml View File

@@ -1,6 +1,7 @@
version: 2

model:
join: [Bool, false]
textApp: [String, ""]
textUI: [String, ""]

@@ -8,9 +9,11 @@ service:
actions:
busModel
pipes:
join: [toggle, K.join]
textApp: [recent, K.textApp]
textUI: [recent, K.textUI]

world:
join: [ps]
textApp: [ps]
textUI: [ps]

+ 18
- 2
Modules/MeetupIdX/src/MeetupId.Generated.swift View File

@@ -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


+ 17
- 0
Modules/MeetupIdX/src/MeetupId.Shoulds.swift View File

@@ -2,6 +2,23 @@ import Foundation

public extension MeetupId {
static func shouldEnableJoin(_ c: MeetupIdContext) -> Bool? {
guard
c.textUI.isRecent ||
c.join
else {
return nil
}

if onlyFormat(c.textUI.value) == "123"{
/**/print("ИГР MeetupI.shouldEJ-1")
return true
}

if c.join {
return false
}
return nil
}
}

+ 1
- 1
Utilities/platform/2/generation/pipeSource.py View File

@@ -18,7 +18,7 @@ def pipeSource(name, entity, structure):
elif src.startswith("K."):
busKey = src
busValueType = structure.model.fields[name][0]
src = "Bus.events.compactMap { Bus.convertKeyValue(" + busKey + ", $0) }.map { (k: String, v: " + busValueType + ") in v }.eraseToAnyPublisher()"
src = "Bus.events.compactMap { Bus.convertKeyValue(" + busKey + ", $0) }.map { (k: String, v: " + busValueType + ") in v }"
# Значение по умолчанию.
elif src == default:
return default + "." + name


Loading…
Cancel
Save