Михаил Капелько 11 months ago
parent
commit
7173a79e98
3 changed files with 7 additions and 4 deletions
  1. +1
    -1
      Modules/MicX/Mic/src/Mic.C.swift
  2. +1
    -1
      Modules/MicX/Mic/src/Mic.Shoulds.swift
  3. +5
    -2
      src/App.swift

+ 1
- 1
Modules/MicX/Mic/src/Mic.C.swift View File

@@ -1,5 +1,5 @@
public extension Mic {
enum C {
static let activityTimeout = 5
static let activityTimeout: TimeInterval = 5
}
}

+ 1
- 1
Modules/MicX/Mic/src/Mic.Shoulds.swift View File

@@ -7,7 +7,7 @@ public extension Mic {
/// - Returns: Словарь активных состояний
static func shouldResetActivityDates(_ c: MicContext) -> [String: Date]? {
if c.activeIds.isRecent {
var ad = c.activityDates
var ad = c.activityDates.value
let ids = c.activeIds.value
let now = Date()
// Задаём абсолютную дату истечения для активных id.


+ 5
- 2
src/App.swift View File

@@ -12,8 +12,10 @@ struct Content: View {
@StateObject var adates = BusUI.Value(Mic.K.activityDates, [String: Date]())

func val(_ k: String) -> String {
let dt = adates.v[k] ?? .distantPast
return String(describing: Int(dt.timeIntervalSince1970))
if let dt = adates.v[k] {
return String(describing: Int(dt.timeIntervalSince1970))
}
return "N/A"
}

var body: some View {
@@ -113,6 +115,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate
func testMic4() {
delayedSend(2, Mic.K.activeIds, ["1"])
delayedSend(5, Mic.K.activeIds, ["1", "4"])
delayedSend(11, Mic.K.activeIds, ["3", "4"])
}

func delayedSend(


Loading…
Cancel
Save