* fix(security): Clear in-memory keys during panic mode #588
* feat: Recreate mesh service after panic clear (#602)
* feat: Recreate mesh service after panic clear
This commit refactors the panic clear process to ensure a new mesh identity is immediately created and applied.
Previously, the `ChatViewModel` would clear sensitive data, but the recreation of the `BluetoothMeshService` was handled externally. This could lead to a delay or failure in adopting the new identity.
Key changes:
- Introduces `MeshServiceHolder` to manage the lifecycle of the `BluetoothMeshService` instance.
- Adds `recreateMeshServiceAfterPanic()` to `ChatViewModel`, which now explicitly clears the old service instance and creates a new one with a regenerated identity.
- The `meshService` property in `ChatViewModel` is now a `var` to allow it to be replaced with the fresh instance post-panic.
- The new service is started, and a broadcast announcement is sent immediately, ensuring the new peer ID is used on the network.
* fix: Ensure mesh service is properly managed in foreground service
* refactor: Decouple handlers from direct service reference
This commit updates the `VerificationHandler` and `MediaSendingManager` to receive the `meshService` via a lambda function (`getMeshService`) instead of a direct reference.
This change decouples the handlers from the service instance, preventing them from holding a stale reference if the service reconnects or changes. By invoking the lambda to get the current service instance when needed, it ensures they always interact with the active `meshService`.
* fix: restart bluetooth
---------
Co-authored-by: Moe Hamade <69801237+moehamade@users.noreply.github.com>
* refactor: abstract LocationProvider, use FusedLocationProvider
* Refactor: Sync permission state on check
Replaces manual updatePermissionState calls with a unified checkAndSyncPermission method. This ensures that _permissionState flow always reflects the actual system permission status whenever it is checked (e.g. in requestOneShotLocation), preventing desync issues when permissions are revoked at runtime.
* Refactor: Add timeout and tracking to SystemLocationProvider
Implements robust cleanup and timeout logic for location requests.
- SystemLocationProvider: Adds 30s timeout and listener tracking for legacy one-shot requests to prevent memory leaks on pre-Android 11 devices.
- FusedLocationProvider: Adds 30s duration to requests.
- LocationProvider: Adds cancel() method for full resource cleanup.
- LocationChannelManager: Ensures cancel() is called during cleanup.
* try catch
* location manager improvements
* fix: resolve compilation errors and improve location state handling
- Fix missing imports and stray braces in LocationChannelManager
- Implement checkSystemLocationEnabled and BroadcastReceiver for location state
- Order class members for correct initialization
- Consolidate UI refresh logic in LocationChannelsSheet
* fix: guard against stale geocoding results on legacy devices
- Add isActive check after blocking Geocoder.getFromLocation call
- Prevent stale results from overwriting state after job cancellation
* try catch the foreground location service if not available
* ask for background permissions
* background permissions in onboarding
* small improvements
* persistence step 1
* fix build
* messages in the background work, notifications not yet
* app state store
* DM icon shows up
* notification launches when app is closed!
* keep ui updated
* lifecycle fixes
* extensive logging, maybe revert later
* send nickname in announcement
* quit in notification
* setting in about sheet
* fix quit bitchat
* lifecycle fixes
* power mode based on background state
* stats for both direciotns
* fix graph persistence
* better counting
* count per device
* only compute when debug sheet is open? untested
* fix read receipts
* fix read receipts fully
* fix unread badge if messages have been read in focus
* foreground promotion fix
* fix app kill in notification
* adjust to new tor
* nice
* about sheet design
* try 1
* works
* equalize UI with ios
* ui cleanup
* geohash chats: no building
* load notes in background
* insta
* simplify and tor icon change
* icons nice
* refactor
* unify location enabled / disabled
* cooler
* simplify, doesnt subscribe right away
* load when clicked
* plus minus location notes
* load when tor is available
* translations
* fix transalations
* implement review comments
* english done
* de
* more extraction
* wip strings en
* translations work
* remove unneeded translations
* remove notification message
* add languages
* new languages
* tor voice wip
* worky BLE a bit
* can send sound
* remove tor
* ui cleanup
* recording time
* progress bar color
* nicknames for audio
* onboarding permissions no microphone
* may work
* fix destionation
* extend
* refactor voice input component
* fix keyboard collapse issue
* send images
* wip image open
* image sending works
* wip waveforms
* better
* better animation
* fix cursor for sending audio
* image sending animation
* image sending animation
* full screen image viewer
* gossip sync for fragments too
* reduce delays
* fix keyboard focus
* use v2 for file transfers
* do not sync fragments
* scrollable image viewer
* ui
* ui adjustments
* nicer animation
* seek through audio
* add spec
* add more details to documentation
* File sharing E2E:
- Add TLV BitchatFilePacket, FileSharingManager
- Implement sendFileNote in ChatViewModel
- File receive path: save to files/incoming and render [file] messages with FileMessageItem or FileSendingAnimation during transfer
- SAF FilePickerButton and dispatcher wiring; image/file choice to follow in MediaPickerOptions
- Add FileViewerDialog with system open/save, FileProvider and file_paths
- Hook transfer progress to file sending UI
- Manifest: READ_MEDIA_* and FileProvider
- Fix MessageHandler saving and prefix for non-image payloads
- Add helper utils (FileUtils)
* kinda wip
* fix buttons
* files half working
* wip file transfer
* file packet has 2-byte TLV and chunks. it wokrs but it sucks
* clean
* remove gossip sync for fragments
* fix audio and image rendering
* adjust FILE_SIZE TLV size too
* cleanup
* haptic
* private messages media
* read receipts for media
* use enum for message type not string
* delivery ack checks dont push content
* check
* animation fix
* refactor
* ui adjustments
* comments
* refactor
* fix crash on send and receive of the same file
* refactor notifications
* tests
* feat(debug): add DebugSettingsManager + DebugSettingsSheet scaffold and AboutSheet entry; groundwork for verbose logging, GATT controls, relay stats, device/scan views
* fix(debug): wire debug sheet launch via onShowDebug in AboutSheet from ChatScreen; add public start/stop server/client methods}
* fix(about): remove misplaced debug item block inside PoW section; keep debug launcher managed by ChatScreen only
* feat(debug): wire DebugSettingsSheet role switches to explicit startServer/stopServer and startClient/stopClient; expose role controls + disconnectAll on BluetoothConnectionManager; fix syntax error; build passes
* feat(debug): add connect/disconnect helpers; wire DebugSettingsSheet connect/disconnect actions to BluetoothConnectionManager
* feat(debug): add debug settings button at bottom of AboutSheet; wire onShowDebug callback to open DebugSettingsSheet from ChatScreen
* feat(debug): wire verbose logging into chat view via DebugSettingsManager; add rolling relay stats; push connected devices and scan results; ensure GATT role stop closes connections; log incoming packets and relay events; add UI polling for devices; build passes
* chore(debug-branch): remove unrelated files that were mistakenly added in first commit; keep only intended debug settings changes
* fix(chat): prevent mesh→geohash leak
Root cause:
- DebugSettingsManager→chat bridge appended system logs to the global timeline regardless of active channel
- MeshDelegateHandler added public mesh messages to UI unconditionally
Fixes:
- Only inject debug system messages when selected location channel is Mesh
- Only add public mesh messages to UI when Mesh is selected (still send notifications)
Build: ./gradlew assembleDebug
}
* fix(timeline): restore message persistence across channel switches
Root cause:
- NostrGeohashService.switchLocationChannel() called messageManager.clearMessages()
which wiped ALL messages (mesh + debug + geohash) from main timeline
- Geohash events were adding to main timeline, causing cross-contamination
Fixes:
- Remove messageManager.clearMessages() from channel switching
- ChatScreen displayMessages now routes to separate storage:
- Mesh: messages (main timeline, includes debug logs when Mesh selected)
- Geohash: viewModel.getGeohashMessages(geohash) from separate history
- Private: privateChats[peerID]
- Channels: channelMessages[channel]
- Geohash events no longer add to main timeline, only to geohash history
- Mesh messages always stored to preserve history when switching away
Result: Each chat type has persistent separate storage, no message loss
* Debug/relay logs: use MessageType names; include device route in verbose packet logs.
* Verbose device-peer assignment and connection/disconnection logs with peerId, deviceId, nickname; packet relay log uses MessageType names.}
* Debug logs API: include nickname and deviceId for incoming/relay; update callers.}
* Fix compile: import MessageType; correct debug manager API usage and remove stray insertion; build.}
* Respect relay toggle; helper to log relay with deviceId.}
* PacketRelayManager: add relay toggle and unified logging helper; clean file header comments; build fixes.}
* changes
* Geohash local echo: do not add to mesh timeline; rely on geohash history and ChatScreen display for location channels.
* persisting
* persist debug settings
* gitignore
* gatt server / client controls
* debugger
* max connection settings and graph
* more graph
* better logging
* refactor logging
* fix(geohash): enforce client-side filter on subscription and validate 'g' tag in handler; move dedup after validation; avoid misrouting events across geohashes
* cleanup duplicate code block
* remove
* cleanup peermanager
* cleanup geohash code
* direct connections fix
* pow display
* track disconnects too
* display pow only if enabled
* display pow only if enabled
* direct connection tracking
* tor started
* tor works
* tor code
* improve manager
* works
* move tor icon
* werks
* arti works
* arti works
* arti works with reconnect
* delay fix
* refactor
* location name in notifications
* remove tests
* panic nostr
* mentions with hashes, otherwise none
* fix timestamps
* parse geohashes in messages
* works
* fix country name
* mention notifications work