|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import Foundation
-
- public extension MeetupId {
- static func shouldEnableJoin(_ c: MeetupIdContext) -> Bool? {
- guard !c.isLoading.value else { return nil }
-
- if
- c.textUI.isRecent,
- let sid = formatId(c.textUI.value)
- {
- return sid.count > 2
- }
-
- if c.join {
- return false
- }
-
- if
- c.isLoading.isRecent,
- !c.isLoading.value
- {
- return true
- }
-
- return nil
- }
-
- static func shouldFinishLoading(_ c: MeetupIdContext) -> Bool? {
- guard
- c.isLoading.isRecent,
- c.isLoading.value
- else {
- return nil
- }
- return true
- }
-
- static func shouldResetLoading(_ c: MeetupIdContext) -> Bool? {
- if
- c.join,
- !c.isLoading.value
- {
- return true
- }
-
- if
- c.finishLoading,
- c.isLoading.value
- {
- return false
- }
-
- return nil
- }
-
- static func shouldResetText(_ c: MeetupIdContext) -> String? {
- guard c.textUI.isRecent else { return nil }
- return formatId(c.textUI.value)
- }
- }
|