Михаил Капелько před 10 měsíci
rodič
revize
cb527c2154
3 změnil soubory, kde provedl 53 přidání a 5 odebrání
  1. +2
    -0
      Modules/MPAKX/src/MPAK.Many.swift
  2. +2
    -2
      Modules/MeetupIdX/MeetupId.yml
  3. +49
    -3
      Modules/MeetupIdX/src/MeetupId.Shoulds.swift

+ 2
- 0
Modules/MPAKX/src/MPAK.Many.swift Zobrazit soubor

@@ -3,6 +3,8 @@ extension MPAK {
public var keys: Set<String>
public var dict: [String: T]

public var isRecent: Bool { !keys.isEmpty }

public init(
_ keys: Set<String> = [],
_ dict: [String: T] = [:]


+ 2
- 2
Modules/MeetupIdX/MeetupId.yml Zobrazit soubor

@@ -12,9 +12,9 @@ service:
busModel
pipes:
finishLoading: [toggle, K.finishLoading]
isLoading: [recent, K.isLoading]
isLoading: [many, K.isLoading]
join: [toggle, K.join]
textUI: [recent, K.textUI]
textUI: [many, K.textUI]
testTextUI: [many, K.testTextUI]

world:

+ 49
- 3
Modules/MeetupIdX/src/MeetupId.Shoulds.swift Zobrazit soubor

@@ -2,6 +2,7 @@ import Foundation
import MPAKX

public extension MeetupId {
/*
static func shouldEnableJoin(_ c: MeetupIdContext) -> Bool? {
guard !c.isLoading.value else { return nil }

@@ -25,6 +26,47 @@ public extension MeetupId {
return nil
}
*/

static func shouldManyEnableJoin(_ c: MeetupIdContext) -> MPAK.Many<Bool>? {
var d = [String: Bool]()

// TODO: Когда копировать dict isLoading?

if c.textUI.isRecent {
for id in c.textUI.keys {
guard
c.isLoading.dict[id] == nil
let text = c.testTextUI.dict[id]
else {
continue
}
let sid = formatId(text)
d[id] = sid.count > 2
}
if !d.isEmpty {
return .init(Set(d.keys), d)
}
}
/*

if c.join,
!c.isLoading.value
{
return false
}
if
c.isLoading.isRecent,
!c.isLoading.value
!c.isLoading.value
{
return true
}
*/
return nil
}

/*
static func shouldFinishLoading(_ c: MeetupIdContext) -> Bool? {
@@ -38,6 +80,10 @@ public extension MeetupId {
}
*/

/*

это ещё конвертнуть надо в Many

static func shouldResetLoading(_ c: MeetupIdContext) -> Bool? {
if
c.join,
@@ -55,6 +101,7 @@ public extension MeetupId {

return nil
}
*/

/*
static func shouldResetText(_ c: MeetupIdContext) -> String? {
@@ -63,11 +110,9 @@ public extension MeetupId {
}
*/

// MARK: - Many
static func shouldManyFinishLoading(_ c: MeetupIdContext) -> MPAK.Many<Bool>? {
guard !c.isLoading.keys.isEmpty else { return nil }
guard c.isLoading.isRecent else { return nil }
var keys = Set<String>()
var d = [String: Bool]()
for id in c.isLoading.keys {
if
let isLoading = c.isLoading.dict[id],
@@ -76,6 +121,7 @@ public extension MeetupId {
keys.insert(id)
}
}
let d = [String: Bool]()
return MPAK.Many(keys, d)
}



Načítá se…
Zrušit
Uložit