|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- 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 shouldResetLoading(_ c: MeetupIdContext) -> Bool? {
- if
- c.join,
- !c.isLoading.value
- {
- return true
- }
-
- if
- c.finishLoading,
- c.isLoading.value
- {
- return false
- }
-
- return nil
- }
-
- }
|