Commit Graph

10744 Commits

Author SHA1 Message Date
Claude 2bb860e97f fix: show video UI when upgrading voice call to video
The call screen used state.callType (set at call initiation) to decide
whether to render video. When a voice call was upgraded to video via
the toggle button, callType remained VOICE so the video grid and local
preview were never shown despite the track being created and sent.

Replace the static isVideoCall check with hasActiveVideo that also
considers isVideoEnabled and the presence of remote video tracks.
Fixes both the full-screen group call UI and the PIP overlay.

https://claude.ai/code/session_015TvWJoAEsfc2ohiRoT9sTr
2026-04-03 21:13:26 +00:00
Vitor Pamplona 52107c9349 Merge pull request #2118 from vitorpamplona/l10n_crowdin_translations
New Crowdin Translations
2026-04-03 16:51:28 -04:00
Crowdin Bot b070bbb98f New Crowdin translations by GitHub Action 2026-04-03 20:50:19 +00:00
Vitor Pamplona 2159bcff6b Merge pull request #2119 from vitorpamplona/claude/fix-video-call-ui-kNo2m
Improve video call UI to show active peer videos with fallback avatars
2026-04-03 16:48:40 -04:00
Claude 9af306282b fix: video call UI per-peer video activity and layout improvements
- Track per-peer video activity in CallController so each peer's video
  state is independent (fixes frozen frames and incorrect fallback to
  phone-call UI when one peer disables video)
- Replace single RemoteVideoGrid with PeerVideoGrid that shows video
  for active peers and avatar/name for inactive peers
- Use call type (VIDEO vs VOICE) to determine layout instead of relying
  solely on isRemoteVideoActive boolean
- Remove extra spacing in AddParticipantDialog between search field and
  user list
- Fix group video monitor using separate job to avoid conflict with P2P
  monitor

https://claude.ai/code/session_01EFDCu97SLYp3TCeBSAttAe
2026-04-03 20:45:08 +00:00
davotoula 4ecc471d82 update translations: CZ, DE, PT, SE 2026-04-03 22:38:09 +02:00
Vitor Pamplona 136e6a4121 Merge pull request #2117 from vitorpamplona/l10n_crowdin_translations
New Crowdin Translations
2026-04-03 16:18:10 -04:00
Vitor Pamplona 98d652401d Merge pull request #2116 from davotoula/fix-intermittent-test-failure-desktop-feed-filter
Fix intermittent test failure, DesktopFeedFilters.kt
2026-04-03 16:13:01 -04:00
Crowdin Bot fa688db50b New Crowdin translations by GitHub Action 2026-04-03 20:12:03 +00:00
Vitor Pamplona e36a6e4ae2 Merge pull request #2115 from vitorpamplona/claude/fix-webrtc-multiple-videos-EXBGs
Support multiple remote video tracks in group calls
2026-04-03 16:10:58 -04:00
Vitor Pamplona 4cf9418582 Merge pull request #2113 from vitorpamplona/l10n_crowdin_translations
New Crowdin Translations
2026-04-03 16:10:36 -04:00
Vitor Pamplona 3eb72200f6 Merge pull request #2114 from greenart7c3/claude/implement-payment-targets-VzxXc
Add payment targets feature with NIP-A3 support
2026-04-03 16:10:28 -04:00
Vitor Pamplona 171907d1cd Merge pull request #2112 from greenart7c3/claude/add-relay-setting-kxeIb
Add option to forward profile events to local relays
2026-04-03 16:10:13 -04:00
Claude 6bb464e768 fix: render all remote video tracks in group WebRTC calls
The UI was only showing the first connected peer's video track
(remoteVideoTrack) instead of all tracks from the remoteVideoTracks
map. This adds a grid layout that renders all remote videos and
per-peer frame activity monitoring so the controller correctly
detects video activity from any participant.

https://claude.ai/code/session_01E4ASQDLSu5CSjiAiAmrNeK
2026-04-03 19:58:06 +00:00
Claude c803c06607 feat: show error dialog when payto:// URI fails to open
- Use Intent(ACTION_VIEW) + startActivity instead of LocalUriHandler so
  ActivityNotFoundException is catchable
- Show ErrorMessageDialog with title/message when no app handles the URI,
  matching the pattern used by zap payment errors
- Always show the wallet icon (profile button + reactions row), showing a
  disabled "no targets" row in the dialog when the author has none set
- Add no_payment_app_found and error_dialog_payment_error string resources

https://claude.ai/code/session_018G4g1cChqjeNEM5TztD3FE
2026-04-03 19:54:29 +00:00
Claude 5796cac947 fix: republish NIP-78 AppSpecificDataEvent when sendKind0EventsToLocalRelay changes
Add Account.updateSendKind0EventsToLocalRelay() suspend fun that calls
sendNewAppSpecificData() after updating the setting, matching the pattern
used by updateFilterSpam/updateWarnReports. Update AccountViewModel to
call this via launchSigner instead of directly mutating settings.

https://claude.ai/code/session_01Er9VV7nHyDb5pihrunb81F
2026-04-03 16:52:09 -03:00
Claude 68623a43f9 fix: remove unused destroy() from ForwardKind0ToLocalRelayState
EventCollector lives for the lifetime of Account, matching the same
pattern used by CacheClientConnector — no explicit teardown needed.

https://claude.ai/code/session_01Er9VV7nHyDb5pihrunb81F
2026-04-03 16:52:09 -03:00
Claude 30aa997a93 refactor: move sendKind0EventsToLocalRelay to AccountSyncedSettings
- Move the setting from a raw AccountSettings field into
  AccountSyncedSettingsInternal / AccountSecurityPreferences so it is
  serialised with the rest of the synced app-specific data (NIP-78)
- Remove one-off LocalPreferences persistence (no longer needed)
- Update ForwardKind0ToLocalRelayState to read from syncedSettings.security
- Move the UI toggle from inside renderLocalItems into the relay
  settings screen (AllRelayListScreen) as a proper SettingsRow item
  in the local-relay section, with title and description
- Fix Account initialisation order so localRelayList is declared before
  ForwardKind0ToLocalRelayState

https://claude.ai/code/session_01Er9VV7nHyDb5pihrunb81F
2026-04-03 16:52:02 -03:00
Claude e82e1ee226 feat: add account setting to forward kind 0 events to local relay
Adds a toggle in the Local Relays settings section that, when enabled,
forwards all received kind 0 (profile/metadata) events to the user's
configured local relays.

- AccountSettings: add sendKind0EventsToLocalRelay MutableStateFlow + toggle method
- LocalPreferences: persist the new setting
- ForwardKind0ToLocalRelayState: uses EventCollector to intercept kind 0
  events from any relay and publish them to local relays when enabled
- Account: instantiate ForwardKind0ToLocalRelayState
- AccountViewModel: expose toggleSendKind0ToLocalRelay
- LocalRelayListView: add Switch toggle above the relay list
- strings.xml: add label and description strings

https://claude.ai/code/session_01Er9VV7nHyDb5pihrunb81F
2026-04-03 16:49:13 -03:00
Crowdin Bot 39088bfffc New Crowdin translations by GitHub Action 2026-04-03 19:47:59 +00:00
Vitor Pamplona 843f557fee Merge pull request #2111 from vitorpamplona/claude/debug-webrtc-calls-ZPFIV
Improve peer disconnection handling in calls
2026-04-03 15:46:31 -04:00
Claude 303e68331a fix: clean up rejected peer's PeerSession to prevent stale sessions blocking hangup
When a peer rejects a group call, CallManager updated its state but never
notified CallController to dispose the peer's PeerSession. This caused two
issues:

1. The rejected peer's PeerConnection lingered in HAVE_LOCAL_OFFER state
   until the entire call ended (resource leak visible as "disposing 2 peer
   sessions" when only 1 should exist).

2. In onPeerDisconnected, the allDisconnected check required ALL sessions
   to be CLOSED. The stale session blocked this check, preventing automatic
   hangup when ICE failed — meaning the remote peer never received a hangup
   event and kept ringing.

Fix: invoke onPeerLeft when a peer rejects in Offering/Connecting/Connected
states, and make onPeerDisconnected treat sessions without a remote
description as inactive.

https://claude.ai/code/session_01UXaFKmHVPDyTzfHL8fkSw1
2026-04-03 19:33:30 +00:00
davotoula c0bdde0ce4 ?: 0L forces Long regardless of nullability, so all comparisons are Long vs Long — no cast issue. 2026-04-03 21:08:05 +02:00
Vitor Pamplona 35a1a20bde Merge pull request #2110 from vitorpamplona/claude/debug-webrtc-calls-KqELh
Improve group call peer management and signaling robustness
2026-04-03 15:01:22 -04:00
Claude bde17099a4 fix: WebRTC group call bugs — self-event filtering, mesh setup, per-peer cleanup
Four bugs fixed in group call signaling:

1. Self-event filtering: Own answer/ICE/hangup events echoed from relays
   were processed as if from another peer, causing callees to attempt
   callee-to-callee connections with themselves.

2. Lost peer discovery: When a callee received another callee's answer
   while still ringing (IncomingCall state), the peer was silently
   discarded. Now stored in discoveredCalleePeers and used for mesh
   setup after accepting.

3. Duplicate onNewPeerInGroupCall: Both CallManager and CallController
   triggered mesh setup for the same peer, causing duplicate log entries
   and wasted work. Removed CallManager's redundant calls since
   CallController handles this internally via onCallAnswerReceived.

4. No per-peer session cleanup: When a peer hung up but the call
   continued, their WebRTC PeerSession was never disposed — it lingered
   until ICE timeout. Added onPeerLeft callback and disposePeerSession
   to cleanly close individual sessions and update video tracks.

Also added strategic debug logging for session lifecycle, peer
discovery, and disconnect handling.

https://claude.ai/code/session_01SWDsQJibYi1MMgvu55puSY
2026-04-03 19:00:04 +00:00
Vitor Pamplona 49932edc62 Merge pull request #2109 from vitorpamplona/claude/fix-group-call-rejection-yPDlk
Handle peer rejections in incoming group calls
2026-04-03 14:49:24 -04:00
Claude d08d101b7d fix: remove rejecting peer from group members in IncomingCall state
When a group member (e.g. Bob) rejects a call, the rejection event is
sent to all group members. The caller (Alice) correctly removes Bob,
but other callees (Charlie) were not removing Bob because the
IncomingCall handler in onCallRejected only handled self-rejection
for multi-device sync. Now it also removes the rejecting peer from
groupMembers, matching the behavior already present in onPeerHangup.

https://claude.ai/code/session_01PMwKCEU1fRDGNQ8WdX8CFW
2026-04-03 18:47:04 +00:00
Vitor Pamplona 397cdb6a6b Making sure the instance is created before running cleaup 2026-04-03 14:32:36 -04:00
Vitor Pamplona 32f6815fb5 Merge pull request #2108 from vitorpamplona/claude/implement-mls-engine-kotlin-Jz9RL
test: add comprehensive MLS engine tests and fix self-decrypt ratchet
2026-04-03 14:20:24 -04:00
Vitor Pamplona 5622d0d531 Merge pull request #2107 from vitorpamplona/claude/fix-call-ringing-issue-OGVEG
Fix call audio state transitions and notification handling
2026-04-03 14:19:23 -04:00
Claude fe13b77e22 fix: harden call cleanup to guarantee nothing is left running
Three issues addressed:

1. Make cleanup() exception-safe: wrap each WebRTC dispose call in
   its own try-catch so that a failure in one (e.g. native crash
   disposing a PeerConnection) does not skip releasing the camera,
   audio mode, foreground service, or EGL context.

2. Upgrade the Idle safety net to call cleanup() instead of only
   stopping ringing/notifications. If the Ended state is missed due
   to StateFlow conflation, the Idle handler now performs full
   resource cleanup (camera, WebRTC, audio mode, foreground service,
   proximity wake lock). cleanup() is idempotent since all resources
   are null-checked and nulled out.

3. Call cleanup() in AccountViewModel.onCleared() so that WebRTC
   resources, camera, audio mode, and foreground service are released
   when the ViewModel is destroyed (e.g. logout, activity recreation).

4. Clear processedEventIds when transitioning to Idle to prevent
   unbounded memory growth across calls.

https://claude.ai/code/session_01GWRdrVAa29BsDkv8R7Z3Y9
2026-04-03 18:16:09 +00:00
Claude 286685c0bd fix: stop ringback tone when Connecting state is skipped by StateFlow conflation
StateFlow is conflated — when the state transitions rapidly from
Offering → Connecting → Connected, the collector may skip Connecting
entirely and only see Connected. Since stopRingbackTone() was only
called in the Connecting handler, the ringback tone would keep playing
through the entire call.

Fix: duplicate the ringing/notification cleanup in the Connected handler
so the tone is always stopped regardless of which state the collector
sees first. Also make switchToCallAudioMode() idempotent and clean up
the previous ToneGenerator in startRingbackTone() to prevent leaks.

https://claude.ai/code/session_01GWRdrVAa29BsDkv8R7Z3Y9
2026-04-03 18:11:22 +00:00
Claude b9db4f8e38 test: add comprehensive MLS engine tests and fix self-decrypt ratchet
Add interop-focused tests for all MLS engine components:
- Ed25519 sign/verify round-trips (JVM)
- X25519 DH key agreement verification (JVM)
- HPKE seal/open encryption cycle (JVM)
- Key schedule determinism and secret derivation (commonMain)
- MlsGroup integration: create, encrypt/decrypt, add/remove members

Fix MlsGroup self-decrypt by caching sent key/nonce generations to
avoid ratchet conflict when decrypting own messages on the same instance.

https://claude.ai/code/session_01966YzookEUQDwszM3YCgeR
2026-04-03 18:10:57 +00:00
Vitor Pamplona 9be9117362 Merge pull request #2106 from vitorpamplona/claude/implement-mls-engine-kotlin-Jz9RL
Add MLS (Messaging Layer Security) implementation for Marmot
2026-04-03 13:55:36 -04:00
Vitor Pamplona f01fb9e70a Merge pull request #2105 from vitorpamplona/claude/fix-call-ringing-bug-aZlur
Fix call state handling to prevent missed cleanup due to StateFlow conflation
2026-04-03 13:34:43 -04:00
Claude a1f8817fce fix: stop call ringing when Ended state is missed due to StateFlow conflation
The state collector in CallController was blocking on
showIncomingCallNotification() which downloads the caller's profile
picture over the network. Because StateFlow is conflated, if the call
ended (peer hangup, reject, timeout) while the collector was suspended,
the Ended→Idle transition would cause the Ended emission to be lost.
Since cleanup/stopRinging only ran in the Ended handler, the ringtone
and vibration would continue indefinitely.

Two fixes:
1. Launch showIncomingCallNotification in a separate coroutine so the
   collector is never blocked by network I/O.
2. Add a safety-net Idle handler that stops ringing, ringback tone,
   and cancels the call notification.

https://claude.ai/code/session_01NfyLNgR4d8yjnxaQJ6FUt5
2026-04-03 17:31:06 +00:00
Vitor Pamplona 5250ef0abd Merge pull request #2104 from vitorpamplona/claude/fix-endcall-ui-user-81baC
Exclude current user from peer lists in call UI
2026-04-03 13:22:09 -04:00
Claude a6c1909602 fix: filter out logged-in user from call member pictures in all call states
The Offering, Ended, Connected, and PipConnected call states were showing
the logged-in user's picture alongside other call members. IncomingCall and
Connecting already filtered correctly. Now all states consistently exclude
the current user via `- accountViewModel.account.signer.pubKey`.

https://claude.ai/code/session_01PFzKU8Y3nUQXhshA3MT5EM
2026-04-03 17:20:53 +00:00
Claude 119f9dd966 feat: implement MLS cryptographic engine in pure Kotlin (Phase 3)
Implements the core MLS (RFC 9420) engine for Marmot Protocol integration,
targeting ciphersuite 0x0001 (DHKEM-X25519, AES-128-GCM, SHA-256, Ed25519).

Components:
- codec/: TLS presentation language encoder/decoder (RFC 8446 Section 3)
- crypto/: Ed25519 signatures, X25519 ECDH, HPKE (RFC 9180), MlsCryptoProvider
  with ExpandWithLabel, DeriveSecret, SignWithLabel, EncryptWithLabel
- tree/: Left-balanced binary tree, LeafNode/ParentNode, RatchetTree with
  TreeKEM encap/decap, tree hashing, resolution, path secret derivation
- schedule/: Key schedule (epoch secret derivation chain), SecretTree
  (per-sender encryption ratchets), MLS-Exporter function
- framing/: MLSMessage, PublicMessage, PrivateMessage, content types
- messages/: Proposal (Add/Remove/Update/SelfRemove), Commit, UpdatePath,
  Welcome, GroupInfo, GroupContext, KeyPackage, GroupSecrets
- group/: MlsGroup high-level API (create, join via Welcome, add/remove
  members, encrypt/decrypt messages, export keys for Marmot outer layer)

Crypto uses expect/actual pattern: JVM/Android via java.security (EdDSA, XDH),
native platforms stubbed for future implementation. Reuses existing Quartz
primitives (AESGCM, HKDF, SHA-256, HMAC, ChaCha20-Poly1305).

Includes tests for TLS codec, binary tree arithmetic, and MLS type roundtrips.

https://claude.ai/code/session_01966YzookEUQDwszM3YCgeR
2026-04-03 17:00:41 +00:00
Vitor Pamplona 31448ad1f6 Makes sure relays and tor are available if just the call activity starts. 2026-04-03 12:59:34 -04:00
Vitor Pamplona 858f13d60f Merge pull request #2103 from vitorpamplona/claude/debug-webrtc-connecting-Q7Jo8
Refactor CallController for multi-peer group calls with mesh topology
2026-04-03 12:58:14 -04:00
Claude fcecb5241c feat: implement full-mesh WebRTC group calls with per-peer PeerConnections
Replaces the single-PeerConnection architecture with full mesh topology
where each participant maintains one PeerConnection per peer, as
specified by NIP-AC.

WebRtcCallSession: Refactored to a pure PeerConnection wrapper that
accepts a shared PeerConnectionFactory. No longer manages media sources,
tracks, or camera — those are now shared across all peer sessions.

CallController: Manages per-peer sessions via ConcurrentHashMap. Shared
resources (PeerConnectionFactory, EglBase, audio/video sources, camera)
are initialized once and reused. Each peer gets its own WebRtcCallSession
with per-peer ICE candidate routing. Supports callee-to-callee mesh
connections with pubkey-based tie-breaking to avoid ofer glare.

CallManager: New methods for per-peer offer/answer publishing
(publishOfferToPeer, publishAnswerToPeer, beginOffering). Forwards ALL
answers to CallController (not just the first). New callbacks
onNewPeerInGroupCall and onMidCallOfferReceived for mesh setup. Handles
mid-call offers (same call-id) when already in Connecting/Connected state.

AccountViewModel: Updated callback wiring to pass peer pubkey with
answer events and register new group call callbacks.

https://claude.ai/code/session_01J5fJx9YbSBx1BsBMctiAm8
2026-04-03 16:54:00 +00:00
Vitor Pamplona 425f8463ec Merge pull request #2102 from vitorpamplona/l10n_crowdin_translations
New Crowdin Translations
2026-04-03 12:42:04 -04:00
Crowdin Bot 7342b6c066 New Crowdin translations by GitHub Action 2026-04-03 16:05:11 +00:00
davotoula f78e152d35 update translations: CZ, DE, PT, SE 2026-04-03 17:55:44 +02:00
Vitor Pamplona 57a505c877 Merge pull request #2101 from vitorpamplona/claude/marmot-encryption-group-state-3hXJ4
Add Marmot protocol support with MIP-00, MIP-02, MIP-03, MIP-05 implementations
2026-04-03 11:38:41 -04:00
Claude 0488245200 fix: send ICE candidates to all peers and exclude self from peer set
Two bugs caused WebRTC group calls to get stuck in "Connecting":

1. CallController.onLocalIceCandidate() used currentPeerPubKey() which
   returns only the first peer via firstOrNull(). ICE candidates were
   gift-wrapped to only one peer; the others never received them.
   Fixed by iterating over all currentPeerPubKeys().

2. CallManager.acceptCall() set Connecting.peerPubKeys to groupMembers
   which includes the local user's own pubkey. This caused
   currentPeerPubKey() to potentially return self, sending ICE
   candidates to oneself instead of the caller.
   Fixed by filtering out signer.pubKey from the peer set.

https://claude.ai/code/session_01J5fJx9YbSBx1BsBMctiAm8
2026-04-03 15:36:50 +00:00
Claude c4096dbd1a test: add comprehensive tests for Marmot Phase 2 components
38 test cases covering:
- ChaCha20Poly1305: RFC 8439 §2.8.2 test vector, round-trip, tamper
  detection, wrong key, invalid nonce/key length, large messages
- GroupEventEncryption: round-trip, empty/large messages, format
  validation, random nonce uniqueness, tamper detection, integration
  with GroupEvent.build()
- CommitOrdering: deterministic winner selection (lowest created_at,
  smallest id tiebreak), comparator sorting, EpochCommitTracker
  lifecycle (add/resolve/clear)
- KeyPackageUtils: validation (encoding, content, ref), selection
  policy (prefer non-last-resort, newest), migration kind detection
- MarmotFilters: all filter builders produce correct kinds, tags,
  authors, since parameters; no empty filters

https://claude.ai/code/session_01Ee5wmBAXwN46AJYUGYA9RQ
2026-04-03 15:33:00 +00:00
Claude 6cbd56c53d feat: add Marmot Phase 2 — encryption, group state, and lifecycle helpers
Implements encryption/decryption, gift-wrap flows, and utility logic for
the Marmot MLS-over-Nostr protocol, building on the Phase 1 event defs.

New files:
- ChaCha20Poly1305: standard AEAD (12-byte nonce) for MIP-03 outer layer
- GroupEventEncryption: encrypt/decrypt GroupEvent content with MLS key
- WelcomeGiftWrap: NIP-59 gift-wrap pipeline for Welcome messages
- KeyPackageUtils: selection policy, rotation, migration helpers
- CommitOrdering: deterministic conflict resolution for MLS commits
- MarmotFilters: relay subscription filter builders for all Marmot events
- TokenEncryption: ECDH + HKDF + ChaCha20 token encryption for MIP-05

https://claude.ai/code/session_01Ee5wmBAXwN46AJYUGYA9RQ
2026-04-03 15:23:31 +00:00
Vitor Pamplona 7eaa01f197 Merge pull request #2100 from vitorpamplona/claude/fix-call-ui-dark-mode-3Unot
Fix call UI to exclude current user from peer list
2026-04-03 11:19:49 -04:00