Михаил Капелько 10 月之前
父節點
當前提交
cca1543856
共有 3 個文件被更改,包括 17 次插入2 次删除
  1. +1
    -0
      Modules/MicX/Mic/src/Mic.K.swift
  2. +13
    -0
      Modules/MicX/MicItem/src/MicItem.Shoulds.swift
  3. +3
    -2
      Modules/MicX/MicItem/src/MicItem.V.swift

+ 1
- 0
Modules/MicX/Mic/src/Mic.K.swift 查看文件

@@ -3,5 +3,6 @@ public extension Mic {
public static let activityDate = "Mic.activityDate"
public static let isActive = "Mic.isActive"
public static let MI = "Mic.Model.Item"
public static let timeout = "Mic.timeout"
}
}

+ 13
- 0
Modules/MicX/MicItem/src/MicItem.Shoulds.swift 查看文件

@@ -10,4 +10,17 @@ public extension MicItem {

return nil
}

static func shouldResetTimeout(_ c: MicItemContext) -> (delay: Int, value: Bool)? {
if
c.activityDate.isRecent,
let end = c.activityDate.value
{
let now = Date()
let timeout = now < end
return (timeout, true)
}

return nil
}
}

+ 3
- 2
Modules/MicX/MicItem/src/MicItem.V.swift 查看文件

@@ -5,11 +5,12 @@ extension MicItem {
public struct V: View {
var id: String?
@StateObject var isActive = BusUI.Value(K.isActive, false)
let processors: [Any]
let proc: [Any]
public init(_ id: String? = nil) {
self.id = id
self.processors = [
self.proc = [
Bus.DelayV(shouldResetTimeout, K.MI, K.timeout)
Bus.Sync(shouldResetActivity, K.MI, K.isActive),
MicItem.Controller()
]


Loading…
取消
儲存