Михаил Капелько 10 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 { public extension Mic {
enum C { 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: Словарь активных состояний /// - Returns: Словарь активных состояний
static func shouldResetActivityDates(_ c: MicContext) -> [String: Date]? { static func shouldResetActivityDates(_ c: MicContext) -> [String: Date]? {
if c.activeIds.isRecent { if c.activeIds.isRecent {
var ad = c.activityDates
var ad = c.activityDates.value
let ids = c.activeIds.value let ids = c.activeIds.value
let now = Date() let now = Date()
// Задаём абсолютную дату истечения для активных id. // Задаём абсолютную дату истечения для активных 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]()) @StateObject var adates = BusUI.Value(Mic.K.activityDates, [String: Date]())


func val(_ k: String) -> String { 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 { var body: some View {
@@ -113,6 +115,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate
func testMic4() { func testMic4() {
delayedSend(2, Mic.K.activeIds, ["1"]) delayedSend(2, Mic.K.activeIds, ["1"])
delayedSend(5, Mic.K.activeIds, ["1", "4"]) delayedSend(5, Mic.K.activeIds, ["1", "4"])
delayedSend(11, Mic.K.activeIds, ["3", "4"])
} }


func delayedSend( func delayedSend(


Loading…
Cancel
Save