Files
bitchat/bitchat/Views/AppInfoView.swift
T
jack f77cec3fb2 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
2025-07-04 11:53:57 +02:00

297 lines
13 KiB
Swift

import SwiftUI
struct AppInfoView: View {
@Environment(\.dismiss) var dismiss
@Environment(\.colorScheme) var colorScheme
private var backgroundColor: Color {
colorScheme == .dark ? Color.black : Color.white
}
private var textColor: Color {
colorScheme == .dark ? Color.green : Color(red: 0, green: 0.5, blue: 0)
}
private var secondaryTextColor: Color {
colorScheme == .dark ? Color.green.opacity(0.8) : Color(red: 0, green: 0.5, blue: 0).opacity(0.8)
}
var body: some View {
#if os(macOS)
VStack(spacing: 0) {
// Custom header for macOS
HStack {
Spacer()
Button("Done") {
dismiss()
}
.buttonStyle(.plain)
.foregroundColor(textColor)
.padding()
}
.background(backgroundColor.opacity(0.95))
ScrollView {
VStack(alignment: .leading, spacing: 24) {
// Header
VStack(alignment: .center, spacing: 8) {
Text("bitchat*")
.font(.system(size: 32, weight: .bold, design: .monospaced))
.foregroundColor(textColor)
Text("secure mesh chat")
.font(.system(size: 16, design: .monospaced))
.foregroundColor(secondaryTextColor)
}
.frame(maxWidth: .infinity)
.padding(.vertical)
// Features
VStack(alignment: .leading, spacing: 16) {
SectionHeader("Features")
FeatureRow(icon: "wifi.slash", title: "Offline Communication",
description: "Works without internet using Bluetooth mesh networking")
FeatureRow(icon: "lock.shield", title: "End-to-End Encryption",
description: "All messages encrypted with Curve25519 + AES-GCM")
FeatureRow(icon: "antenna.radiowaves.left.and.right", title: "Extended Range",
description: "Messages relay through peers, reaching 300m+")
FeatureRow(icon: "star.fill", title: "Favorites System",
description: "Store-and-forward messages for favorites indefinitely")
FeatureRow(icon: "at", title: "Mentions",
description: "Use @nickname to notify specific users")
}
// Privacy
VStack(alignment: .leading, spacing: 16) {
SectionHeader("Privacy")
FeatureRow(icon: "eye.slash", title: "No Tracking",
description: "No servers, accounts, or data collection")
FeatureRow(icon: "shuffle", title: "Ephemeral Identity",
description: "New peer ID generated each session")
FeatureRow(icon: "hand.raised.fill", title: "Panic Mode",
description: "Triple-tap logo to instantly clear all data")
}
// How to Use
VStack(alignment: .leading, spacing: 16) {
SectionHeader("How to Use")
VStack(alignment: .leading, spacing: 8) {
Text("• Set your nickname in the header")
Text("• Tap the people counter to see connected peers")
Text("• Tap a peer to start a private chat")
Text("• Use @nickname to mention someone")
Text("• Triple-tap the logo for panic mode")
}
.font(.system(size: 14, design: .monospaced))
.foregroundColor(textColor)
}
// Technical Details
VStack(alignment: .leading, spacing: 16) {
SectionHeader("Technical Details")
VStack(alignment: .leading, spacing: 8) {
Text("Protocol: Custom binary over BLE")
Text("Encryption: Curve25519 + AES-256-GCM")
Text("Range: ~100m direct, 300m+ with relay")
Text("Store & Forward: 12h for all, ∞ for favorites")
Text("Battery: Adaptive scanning based on level")
Text("Platform: Universal (iOS, iPadOS, macOS)")
}
.font(.system(size: 14, design: .monospaced))
.foregroundColor(textColor)
}
// Version
HStack {
Spacer()
Text("Version 1.0.0")
.font(.system(size: 12, design: .monospaced))
.foregroundColor(secondaryTextColor)
Spacer()
}
.padding(.top)
}
.padding()
}
.background(backgroundColor)
}
.frame(width: 600, height: 700)
#else
NavigationView {
ScrollView {
VStack(alignment: .leading, spacing: 24) {
// Header
VStack(alignment: .center, spacing: 8) {
Text("bitchat*")
.font(.system(size: 32, weight: .bold, design: .monospaced))
.foregroundColor(textColor)
Text("secure mesh chat")
.font(.system(size: 16, design: .monospaced))
.foregroundColor(secondaryTextColor)
}
.frame(maxWidth: .infinity)
.padding(.vertical)
// Features
VStack(alignment: .leading, spacing: 16) {
SectionHeader("Features")
FeatureRow(icon: "wifi.slash", title: "Offline Communication",
description: "Works without internet using Bluetooth mesh networking")
FeatureRow(icon: "lock.shield", title: "End-to-End Encryption",
description: "All messages encrypted with Curve25519 + AES-GCM")
FeatureRow(icon: "antenna.radiowaves.left.and.right", title: "Extended Range",
description: "Messages relay through peers, reaching 300m+")
FeatureRow(icon: "star.fill", title: "Favorites System",
description: "Store-and-forward messages for favorites indefinitely")
FeatureRow(icon: "at", title: "Mentions",
description: "Use @nickname to notify specific users")
}
// Privacy
VStack(alignment: .leading, spacing: 16) {
SectionHeader("Privacy")
FeatureRow(icon: "eye.slash", title: "No Tracking",
description: "No servers, accounts, or data collection")
FeatureRow(icon: "shuffle", title: "Ephemeral Identity",
description: "New peer ID generated each session")
FeatureRow(icon: "hand.raised.fill", title: "Panic Mode",
description: "Triple-tap logo to instantly clear all data")
}
// How to Use
VStack(alignment: .leading, spacing: 16) {
SectionHeader("How to Use")
VStack(alignment: .leading, spacing: 8) {
Text("• Set your nickname in the header")
Text("• Tap the people counter to see connected peers")
Text("• Tap a peer to start a private chat")
Text("• Use @nickname to mention someone")
Text("• Triple-tap the logo for panic mode")
}
.font(.system(size: 14, design: .monospaced))
.foregroundColor(textColor)
}
// Technical Details
VStack(alignment: .leading, spacing: 16) {
SectionHeader("Technical Details")
VStack(alignment: .leading, spacing: 8) {
Text("Protocol: Custom binary over BLE")
Text("Encryption: Curve25519 + AES-256-GCM")
Text("Range: ~100m direct, 300m+ with relay")
Text("Store & Forward: 12h for all, ∞ for favorites")
Text("Battery: Adaptive scanning based on level")
Text("Platform: Universal (iOS, iPadOS, macOS)")
}
.font(.system(size: 14, design: .monospaced))
.foregroundColor(textColor)
}
// Version
HStack {
Spacer()
Text("Version 1.0.0")
.font(.system(size: 12, design: .monospaced))
.foregroundColor(secondaryTextColor)
Spacer()
}
.padding(.top)
}
.padding()
}
.background(backgroundColor)
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button("Done") {
dismiss()
}
.foregroundColor(textColor)
}
}
}
#endif
}
}
struct SectionHeader: View {
let title: String
@Environment(\.colorScheme) var colorScheme
private var textColor: Color {
colorScheme == .dark ? Color.green : Color(red: 0, green: 0.5, blue: 0)
}
init(_ title: String) {
self.title = title
}
var body: some View {
Text(title.uppercased())
.font(.system(size: 16, weight: .bold, design: .monospaced))
.foregroundColor(textColor)
.padding(.top, 8)
}
}
struct FeatureRow: View {
let icon: String
let title: String
let description: String
@Environment(\.colorScheme) var colorScheme
private var textColor: Color {
colorScheme == .dark ? Color.green : Color(red: 0, green: 0.5, blue: 0)
}
private var secondaryTextColor: Color {
colorScheme == .dark ? Color.green.opacity(0.8) : Color(red: 0, green: 0.5, blue: 0).opacity(0.8)
}
var body: some View {
HStack(alignment: .top, spacing: 12) {
Image(systemName: icon)
.font(.system(size: 20))
.foregroundColor(textColor)
.frame(width: 30)
VStack(alignment: .leading, spacing: 4) {
Text(title)
.font(.system(size: 14, weight: .semibold, design: .monospaced))
.foregroundColor(textColor)
Text(description)
.font(.system(size: 12, design: .monospaced))
.foregroundColor(secondaryTextColor)
.fixedSize(horizontal: false, vertical: true)
}
Spacer()
}
}
}
#Preview {
AppInfoView()
}