mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-15 14:46:03 +00:00
* feat(watchos): add direct gateway node * docs: refresh watch node docs map * chore: leave release notes to release workflow * chore(ios): refresh native localization inventory * fix(watchos): keep direct node policy bounded
27 lines
1013 B
Swift
27 lines
1013 B
Swift
enum WatchDeferredPayloadOrdering {
|
|
static func isExpired(expiresAtMs: Int64?, nowMs: Int64) -> Bool {
|
|
expiresAtMs.map { $0 <= nowMs } == true
|
|
}
|
|
|
|
static func isNewerThanSnapshot(payloadSentAtMs: Int64?, snapshotSentAtMs: Int64?) -> Bool {
|
|
guard let payloadSentAtMs, let snapshotSentAtMs else { return true }
|
|
return payloadSentAtMs > snapshotSentAtMs
|
|
}
|
|
|
|
static func isAtOrBeforeSnapshot(payloadSentAtMs: Int64?, snapshotSentAtMs: Int64?) -> Bool {
|
|
guard let snapshotSentAtMs else { return false }
|
|
return payloadSentAtMs.map { $0 <= snapshotSentAtMs } ?? true
|
|
}
|
|
|
|
static func indicesOldestFirst(for timestamps: [Int64?]) -> [Int] {
|
|
timestamps.indices.sorted { lhs, rhs in
|
|
let lhsTimestamp = timestamps[lhs] ?? .min
|
|
let rhsTimestamp = timestamps[rhs] ?? .min
|
|
if lhsTimestamp != rhsTimestamp {
|
|
return lhsTimestamp < rhsTimestamp
|
|
}
|
|
return lhs < rhs
|
|
}
|
|
}
|
|
}
|