From 0f21ea9599bf8bc143253fbe2f115b29d5f178e4 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Thu, 19 Jun 2025 16:06:02 -0700 Subject: [PATCH] Minimum expiry for PKI nodes --- Meshtastic/Persistence/UpdateCoreData.swift | 2 +- Meshtastic/Views/Settings/AppSettings.swift | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Meshtastic/Persistence/UpdateCoreData.swift b/Meshtastic/Persistence/UpdateCoreData.swift index a203964f..6d085b21 100644 --- a/Meshtastic/Persistence/UpdateCoreData.swift +++ b/Meshtastic/Persistence/UpdateCoreData.swift @@ -13,7 +13,7 @@ public func clearStaleNodes(nodeExpireDays: Int, context: NSManagedObjectContext return TimeInterval(-nodeExpireDays * 86400) } var nodePKIExpireTime: TimeInterval { - return TimeInterval(-7 * 86400) + return TimeInterval((nodeExpireDays < 7 ? -7 : -nodeExpireDays) * 86400) } if nodeExpireDays == 0 { diff --git a/Meshtastic/Views/Settings/AppSettings.swift b/Meshtastic/Views/Settings/AppSettings.swift index c64e049c..6c6cd44d 100644 --- a/Meshtastic/Views/Settings/AppSettings.swift +++ b/Meshtastic/Views/Settings/AppSettings.swift @@ -6,6 +6,7 @@ import MapKit import OSLog struct AppSettings: View { + private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } @Environment(\.managedObjectContext) var context @EnvironmentObject var bleManager: BLEManager @State var totalDownloadedTileSize = "" @@ -71,6 +72,9 @@ struct AppSettings: View { Text("180") } } + Text("Nodes without PKI keys are cleared from the app database on the schedule set by the user, nodes with PKI keys are cleared only if the interval is set to 7 days or longer.") + .foregroundStyle(.secondary) + .font(idiom == .phone ? .caption : .callout) } Button { isPresentingCoreDataResetConfirm = true