Проверка шаблона шины для iOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
524B

  1. public extension MicItem {
  2. static func shouldResetActivity(_ c: MicItemContext) -> Bool? {
  3. if
  4. c.activityDate.isRecent,
  5. let end = c.activityDate.value
  6. {
  7. let now = Date()
  8. return now < end
  9. }
  10. return nil
  11. }
  12. static func shouldResetTimeout(_ c: MicItemContext) -> (delay: Int, value: Bool)? {
  13. if
  14. c.activityDate.isRecent,
  15. let end = c.activityDate.value
  16. {
  17. let now = Date()
  18. let timeout = now < end
  19. return (timeout, true)
  20. }
  21. return nil
  22. }
  23. }