Analyze scalability and prepare for TestFlight

- Deep analysis of mesh network scalability limits
- Current full mesh topology supports ~20-30 users maximum
- Identified bottlenecks: O(n²) connections, message flooding, battery impact
- Documented future scaling solutions: hierarchical topology, DHT routing
- Ready for TestFlight submission with current capacity constraints
This commit is contained in:
jack
2025-07-04 11:53:57 +02:00
parent cce43fcfc7
commit f77cec3fb2
6 changed files with 545 additions and 213 deletions
+1 -37
View File
@@ -35,9 +35,7 @@ class ChatViewModel: ObservableObject {
@Published var favoritePeers: Set<String> = [] // Now stores public key fingerprints instead of peer IDs
private var peerIDToPublicKeyFingerprint: [String: String] = [:] // Maps ephemeral peer IDs to persistent fingerprints
// Ephemeral message settings
private var messageAutoDeleteTimer: Timer?
private let messageRetentionTime: TimeInterval = 300 // 5 minutes
// Messages are naturally ephemeral - no persistent storage
init() {
loadNickname()
@@ -49,9 +47,6 @@ class ChatViewModel: ObservableObject {
// Request notification permission
NotificationService.shared.requestAuthorization()
// Start auto-delete timer for ephemeral messages
startAutoDeleteTimer()
}
private func loadNickname() {
@@ -225,37 +220,6 @@ class ChatViewModel: ObservableObject {
print("[PANIC] All data cleared for safety")
}
// Ephemeral message auto-deletion
private func startAutoDeleteTimer() {
messageAutoDeleteTimer = Timer.scheduledTimer(withTimeInterval: 30, repeats: true) { [weak self] _ in
self?.deleteOldMessages()
}
}
private func deleteOldMessages() {
let cutoffTime = Date().addingTimeInterval(-messageRetentionTime)
// Delete old public messages
let beforeCount = messages.count
messages.removeAll { message in
message.timestamp < cutoffTime && message.sender != "system"
}
if messages.count < beforeCount {
print("[EPHEMERAL] Deleted \(beforeCount - messages.count) old messages")
}
// Delete old private messages
for (peerID, messageList) in privateChats {
let oldCount = messageList.count
privateChats[peerID] = messageList.filter { $0.timestamp >= cutoffTime }
if let newCount = privateChats[peerID]?.count, newCount < oldCount {
print("[EPHEMERAL] Deleted \(oldCount - newCount) old private messages from \(peerID)")
}
}
}
func formatTimestamp(_ date: Date) -> String {