Михаил Капелько 10 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 version: 2


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


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


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

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

@@ -12,6 +12,7 @@ import UIKit
// MARK: - Context // MARK: - Context


public protocol MeetupIdContext { public protocol MeetupIdContext {
var join: Bool { get }
var textApp: MPAK.Recent<String> { get } var textApp: MPAK.Recent<String> { get }
var textUI: MPAK.Recent<String> { get } var textUI: MPAK.Recent<String> { get }
} }
@@ -34,6 +35,7 @@ extension MeetupId {
// MARK: - Model // MARK: - Model


public struct Model: MeetupIdContext { public struct Model: MeetupIdContext {
public var join: Bool = false
public var textApp: MPAK.Recent<String> = .init("") public var textApp: MPAK.Recent<String> = .init("")
public var textUI: MPAK.Recent<String> = .init("") public var textUI: MPAK.Recent<String> = .init("")
} }
@@ -57,6 +59,7 @@ extension MeetupId {
// MARK: - World // MARK: - World


public struct World { public struct World {
let join = PassthroughSubject<Void, Never>()
let textApp = PassthroughSubject<String, Never>() let textApp = PassthroughSubject<String, Never>()
let textUI = PassthroughSubject<String, Never>() let textUI = PassthroughSubject<String, Never>()


@@ -87,10 +90,23 @@ extension MeetupId {


// MARK: - SectionGenerated Service Pipes // 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( ctrl.pipeValue(
dbg: "textA", dbg: "textA",
sub: nil, 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.value = $1
$0.textApp.isRecent = true $0.textApp.isRecent = true
@@ -103,7 +119,7 @@ extension MeetupId {
ctrl.pipeValue( ctrl.pipeValue(
dbg: "textUI", dbg: "textUI",
sub: nil, 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.value = $1
$0.textUI.isRecent = true $0.textUI.isRecent = true


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

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


public extension MeetupId { public extension MeetupId {
static func shouldEnableJoin(_ c: MeetupIdContext) -> Bool? { 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 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."): elif src.startswith("K."):
busKey = src busKey = src
busValueType = structure.model.fields[name][0] 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: elif src == default:
return default + "." + name return default + "." + name


Loading…
Cancel
Save