mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-27 04:05:19 +00:00
Add interactive logo with info/panic modes and battery optimization
- Single tap logo shows comprehensive app info and features - Triple tap logo triggers panic mode (instant data wipe) - Implement adaptive Bluetooth scanning based on battery level - Remove hardcoded development team ID for security - Fix store-and-forward description (12h for all, indefinite for favorites) - Add technical debt remediation plan - Fix macOS compatibility issues with navigation
This commit is contained in:
@@ -0,0 +1,303 @@
|
||||
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: "clock.arrow.circlepath", title: "Ephemeral Messages",
|
||||
description: "Messages auto-delete after 5 minutes")
|
||||
|
||||
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: "clock.arrow.circlepath", title: "Ephemeral Messages",
|
||||
description: "Messages auto-delete after 5 minutes")
|
||||
|
||||
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()
|
||||
}
|
||||
@@ -9,6 +9,7 @@ struct ContentView: View {
|
||||
@State private var showPeerList = false
|
||||
@State private var showSidebar = false
|
||||
@State private var sidebarDragOffset: CGFloat = 0
|
||||
@State private var showAppInfo = false
|
||||
|
||||
private var backgroundColor: Color {
|
||||
colorScheme == .dark ? Color.black : Color.white
|
||||
@@ -132,6 +133,9 @@ struct ContentView: View {
|
||||
#if os(macOS)
|
||||
.frame(minWidth: 600, minHeight: 400)
|
||||
#endif
|
||||
.sheet(isPresented: $showAppInfo) {
|
||||
AppInfoView()
|
||||
}
|
||||
}
|
||||
|
||||
private var headerView: some View {
|
||||
@@ -180,6 +184,10 @@ struct ContentView: View {
|
||||
// PANIC: Triple-tap to clear all data
|
||||
viewModel.panicClearAllData()
|
||||
}
|
||||
.onTapGesture(count: 1) {
|
||||
// Single tap for app info
|
||||
showAppInfo = true
|
||||
}
|
||||
|
||||
HStack(spacing: 0) {
|
||||
Text("@")
|
||||
|
||||
Reference in New Issue
Block a user