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