Commit graph

5181 commits

Author SHA1 Message Date
de2edafe61 feat(wallet): rewrite SSSS on account data + AES-256-GCM envelope
The Rust SDK removed the low-level SecretStoreWrapper.putSecret/getSecret
API between 26.03.x and 26.04.x — it was an escape hatch we were using
to pin arbitrary bytes into a Matrix 4S slot. The SDK maintainers never
contracted that primitive; locking it down lets their recovery code
evolve without worrying about third-party storage.

This commit replaces that dependency with a self-contained design we
own end-to-end, so future SDK moves no longer break our backup flow.

### Design
- Slot: `com.sulkta.wallet.seed.v1` in Matrix account data.
  Our namespace, not a Matrix-spec 4S slot — we are NOT impersonating
  Matrix secret storage, we are holding our own opaque blob.
- Envelope (JSON): version tag, algorithm tag, random 12-byte IV, GCM
  output (ciphertext || tag), AAD = slot name. AES-256-GCM via stock
  javax.crypto. AAD binds a blob to its slot so a blob can't be lifted
  from one namespace and successfully opened in another.
- Key: derived from the user's existing Matrix recovery key via
  HKDF-SHA256 with info label "sulkta.wallet.seed.v1". The info label
  guarantees we never produce the same key bytes Matrix uses for its
  own crypto — same secret, different domain.
- I/O: client.setAccountData(key, json) + client.accountData(key)
  via the SDK; the homeserver only ever sees the opaque encrypted blob.

### Files
- api/walletsecretstorage/WalletSecretStorage.kt — new interface
- impl/walletsecretstorage/WalletSecretEnvelope.kt — AES-GCM envelope
  (with unit tests: round-trip, wrong key, tampered ct, tampered iv,
  wrong AAD, wrong version, malformed JSON)
- impl/walletsecretstorage/RecoveryKeyDerivation.kt — base58 decode
  + parity check + HKDF-SHA256 (with unit tests: determinism,
  whitespace tolerance, distinct info labels → distinct keys)
- impl/walletsecretstorage/MatrixAccountDataWalletSecretStorage.kt —
  WalletSecretStorage impl wrapping Client account data
- test/walletsecretstorage/FakeWalletSecretStorage.kt — in-memory fake
- api/MatrixClient.kt: old .secretStorage → .walletSecretStorage
- features/wallet/.../WalletBackupServiceImpl.kt — rewired to use the
  new interface; hasBackupWithoutKey now goes through the same path
  instead of manually poking the raw Matrix HTTP API.
- DELETED: api/secretstorage/SecretStorage.kt, SecretStore.kt, impl/
  secretstorage/RustSecretStorage.kt — the old SDK-dependent path.

### Backward compat note
Users who backed up a wallet seed on the OLD SDK have a blob in Matrix's
4S at `com.sulkta.cardano.wallet_seed`. This branch cannot read those.
Since the prior integration was only tested internally, acceptable
today — anyone with an old backup re-enters their mnemonic.
2026-04-17 10:16:53 -07:00
a944499eda fix(sdk): adapt to matrix-rust-sdk 26.04.x API shifts
TracingConfiguration gained a required sentryConfig parameter between
26.03.x and 26.04.x. Pass null — we don't use SDK-side Sentry.

Timeline.sendRaw was moved off Timeline onto Room. Add sendRawEvent to
the JoinedRoom API interface, implement in JoinedRustRoom by calling
innerRoom.sendRaw, and have RustTimeline.sendRaw proxy through the
owning JoinedRoom. Our /pay event path keeps working without callers
having to know about the SDK move.
2026-04-17 10:12:48 -07:00
0ef6b69a79 Merge branch 'main' into wallet
# Conflicts:
#	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesFlowNode.kt
#	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNavigator.kt
#	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNode.kt
#	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesView.kt
#	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt
#	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/suggestions/SuggestionsPickerView.kt
#	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/suggestions/SuggestionsProcessor.kt
#	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/threads/ThreadedMessagesNode.kt
#	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/topbars/MessagesViewTopBar.kt
#	libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/mentions/ResolvedSuggestion.kt
2026-04-16 22:05:16 -07:00
Jorge Martín
7cdad11753 Use Devices.PHONE directly in the landscape preview 2026-04-15 15:51:06 +02:00
Jorge Martín
69fb344517 Use WindowSizeClass instead of just checking portrait/landscape orientation 2026-04-15 15:51:06 +02:00
Jorge Martín
42a572cce2 Add landscape previews 2026-04-15 15:51:06 +02:00
Jorge Martín
70e45d9bfe Some tweaks for landscape and insets 2026-04-15 15:51:06 +02:00
bxdxnn
f389eae868 Make media captions scrollable (#6498) 2026-04-15 15:51:06 +02:00
Jorge Martin Espinosa
0058de9bca
Add extra logs for timeline pagination (#6589)
We found some possible rare issues with pagination these could help understand.
2026-04-15 15:14:42 +02:00
Jorge Martin Espinosa
66513bc905
Take into account homeserver capabilities (#6507)
* Take into account homeserver capabilities: add `HomeserverCapabilitiesProvider` to check if the HS allows changing the user's display name or avatar. Also, modify the edit user profile screen to reflect these values.

* Add `/myavatar` command. Filter both `/nick` and `/myavatar` commands based on the homeserver capabilities.

* Update screenshots

* Assume the use can change their display name and avatar url if the capabilities check fails: if they try to change those, the HS will return an error anyway.

* Disable also `/myroomname` and `/myroomavatar` based on the HS capabilities.

---------

Co-authored-by: ElementBot <android@element.io>
2026-04-15 12:29:41 +00:00
Jorge Martin Espinosa
80470b3792
Feature: add room threads list (#6575)
Add threads list screen for rooms:

- Add `ThreadsListService` to subscribe to thread changes in the room.
- Create `ThreadsListView` and its associated node a presenters (the UI may change).
- Add a menu icon in the room screen to open it.

This is still pending info about unread threads, so several UI components related to it will be hidden.

* Add feature flag and use it to hide the access to this new screen

---------

Co-authored-by: ElementBot <android@element.io>
2026-04-15 12:14:22 +00:00
Skye Elliot
897c68e7b7
Add confirmation dialog when inviting users with unknown identities (#6523)
* feat: Add confirmation modal when inviting unknown users

* tests: Add preview tests for invite confirmation modal

* tests: Add unit tests for invite confirmation modal

* feat: Switch confirmation sheet contents based on identity state

* tests: Add history sharing unit tests for `DefaultStartDMActionTest`

* tests: Update snapshots for `CreateDmConfirmationBottomSheet`

* chore: Fix tiny nits

* fix: Remove default param on `ConfirmingStartDmWithMatrixUser`

* refactor: Use new AsyncAction over boolean flag

* fix: Add sleeps to tests

* refactor: Remove `PromptOrInvite` and switch on async action

* fix: Remove redundant `assertThat`

* feat: Alllow invite confirmation modal to be dismissed

* tests: Update snapshots for InvitePeopleView

* fix: Adjust `CreateDmConfirmationBottomSheet` to conform to design

* feat: Use localazy translations and plurals

* fix: When users are unselected, unselect them in search results too

* tests: Use aMatrixUserList to provide multiple users

* Update screenshots

* fix: Add missing parameter in UserProfilePresenterTest

---------

Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
Co-authored-by: ElementBot <android@element.io>
2026-04-15 10:25:58 +01:00
Jorge Martin Espinosa
e0554bbaf3
Use Coil3 for ZoomableAsyncImage (#6582)
The `-coil` version uses Coil 2.X, there is a `-coil3` version using the latest one, which matches the one we use in the rest of the app.
2026-04-15 07:58:03 +00:00
Benoit Marty
4b8368f242
Merge pull request #6296 from element-hq/feature/bma/signInWithElementClassicFinal
Sign in with element classic final
2026-04-14 23:00:47 +02:00
Jorge Martin Espinosa
7a7a5a68b9
Fix isInAirGappedEnvironment check for older APIs (#6573)
* Fix `isInAirGappedEnvironment` check for older APIs: use `networkCapabilities.hasCapability` instead of `networkCapabilities.capabilities.contains`, which only works on Android 12 and newer versions

* Check for air-gapped env in the FOSS app too: this unifies the notification behaviour on EXA and Element Pro
2026-04-14 15:52:41 +02:00
ganfra
9a4da33340 Fix breaking change, will implement in a separate PR 2026-04-13 20:37:15 +02:00
Benoit Marty
8c5caabed4 Sign in with Classic 2026-04-13 11:16:05 +02:00
bmarty
23c1112dcf Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
Benoit Marty
dc4c1c265b
Merge pull request #6560 from element-hq/feature/bma/removeSpacesFF
Remove spaces features flags
2026-04-10 09:17:51 +02:00
Benoit Marty
c3a999e45a
Merge pull request #6559 from element-hq/feature/bma/fixModuleDependencies
Fix module dependencies
2026-04-10 09:17:34 +02:00
Benoit Marty
6ff6a0a86b
Merge pull request #6553 from element-hq/renovate/org.matrix.rustcomponents-sdk-android-26.x
Update dependency org.matrix.rustcomponents:sdk-android to v26.04.8
2026-04-09 13:17:58 +02:00
Benoit Marty
8cbc03b9a2 Fix test compilation issue. 2026-04-09 12:09:51 +02:00
Benoit Marty
5eb9bed386 Remove FF RoomListSpaceFilters 2026-04-09 11:33:08 +02:00
Benoit Marty
64b0a7eef3 Remove FF CreateSpaces 2026-04-09 11:28:24 +02:00
Benoit Marty
b6ce6a95c0 Remove FF SpaceSettings 2026-04-09 10:54:54 +02:00
Benoit Marty
85823b3e62 Fix compilation issue: RoomAliases does not exist anymore. 2026-04-09 09:52:40 +02:00
Benoit Marty
df73b44279 Depend on api not impl module. 2026-04-08 18:10:32 +02:00
Benoit Marty
035e527101 Depend on api not impl module. 2026-04-08 18:04:46 +02:00
Benoit Marty
dae308fcf7 Fix crash, ensure that super.onTimeout(startId) is not called when the method is not available. 2026-04-08 11:15:51 +02:00
Gianluca Iavicoli
523ede744a
Fix portrait image metadata when uploading without media optimization (#6362)
* fix(media): preserve image orientation metadata without optimization

* style: linting
2026-04-08 11:01:54 +02:00
Benoit Marty
e63a50b512
Merge pull request #6517 from element-hq/feature/bma/compound10
Sync compound tokens https://github.com/element-hq/compound-design-tokens/releases/tag/v10.0.0
2026-04-08 09:40:14 +02:00
ElementBot
6ad85d4dfc
Sync Strings (#6537)
* Sync Strings from Localazy

* Sync strings.

---------

Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
Co-authored-by: Benoit Marty <benoit@matrix.org>
2026-04-07 16:02:12 +02:00
Benoit Marty
4ad495d36c
Add support for slash commands (under Feature Flag) (#6482)
* Add support for slash commands

* Update screenshots

* Rename module `slash` to `slashcommands`

* Rename `SlashCommand` to `SlashCommandService`

* Introduce MsgType in order to send text message with a different msgtype value.

* Format file and add parameter names, add default values and cleanup

* Add isSupported parameter to filter out unsupported yet commands.

* Slash commands: disable suggestions if the feature is disabled.

* Fix sending shrug command.

* Add missing test on SuggestionsProcessor

* Add tests on MessageComposerPresenter about slash command.

* Fix import ordering

* Add missing tests on CommandExecutor

* Add missing tests in MarkdownTextEditorStateTest

* Slash commands: Improve code when sending message with prefix.

* Slash commands: Add support for /unflip

---------

Co-authored-by: ElementBot <android@element.io>
2026-04-02 16:15:32 +02:00
Jorge Martin Espinosa
860def3965
Tentative fix for ForegroundServiceStartNotAllowedException (#6509)
* Tentative fix for `ForegroundServiceStartNotAllowedException`

When failing to start the service in foreground, don't crash. This is a helper to speed up the scheduling by keeping the CPU awake, not a critical part that should succeed

* Simplify `DefaultPushHandlingWakeLock`

It seems like restarting the service from background won't work in some cases, so don't try it.
2026-04-02 11:10:47 +02:00
ElementBot
13de580a51 Update screenshots 2026-04-02 07:52:20 +00:00
Benoit Marty
e401619017 Changer border color of InReplyTo to separatorPrimary 2026-04-02 09:37:15 +02:00
Benoit Marty
fe05c27232 Import token v10.0.0./tools/compound/import_tokens.sh -b v10.0.0 2026-04-01 18:08:32 +02:00
Jorge Martin Espinosa
410a3d132b
Add floating/sticky date badge in the timeline (#6496)
* Add floating date indicator while scrolling the timeline (#6433)

* Add `FeatureFlags.FloatingDateBadge`. This enables displaying the floating date badge in the timeline as you scroll.

* Don't display the floating badge if the timeline isn't reversed. Otherwise, this will affect talkback users and break the existing navigation

* Use `TimelineItem.formattedDate()` to get the date to display. Always try finding the closest one (usually it will be just the 1st one we try).

* Align designs with iOS. Also fix shadows in fade animation by adding some paddings.

* Update screenshots

---------

Co-authored-by: Gianluca Iavicoli <gianluca.iavicoli04@gmail.com>
Co-authored-by: ElementBot <android@element.io>
2026-04-01 10:45:57 +00:00
Jorge Martin Espinosa
bd618ccba6
Fix content scrolling not working in the RTE (#6492)
Implement a `customDetectVerticalDragGestures` that matches the original `detectVerticalDragGestures` expect we conditionally consume the initial DOWN event in compose to decide whether we need to drag the bottom sheet or scroll inside the Android `EditText`
2026-04-01 11:06:28 +02:00
Jorge Martin Espinosa
87184328eb
Fix crash when using View.hideKeyboardAndAwaitAnimation (#6502)
* Fix crash when using `View.hideKeyboardAndAwaitAnimation`

Remove the `View.OnApplyWindowInsetsListener` used in modern Android versions to detect if the insets changed after they do the first time: this is a single use operation and the listener will be called every time the insets change

Also, replace `Mutex` with `CompletableDeferred` so it doesn't matter if it's called several times, we only care about the first one.

* Don't try to hide the keyboard if it's already hidden. Also, add a 1s timeout in case everything goes wrong and we somehow never complete the future.
2026-03-31 16:45:10 +00:00
Jorge Martin Espinosa
579bc7db62
Try fixing location pin previews (#6495)
* Try fixing location pin previews

* Update screenshots

---------

Co-authored-by: ElementBot <android@element.io>
Co-authored-by: Benoit Marty <benoitm@element.io>
2026-03-31 14:57:37 +00:00
ElementBot
6ab47dae17
Sync Strings from Localazy (#6486)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2026-03-31 15:48:37 +02:00
Jorge Martin Espinosa
ad56b01e4a
Try handling ForegroundServiceStartNotAllowedException better (#6483)
* Try handling `ForegroundServiceStartNotAllowedException` better

The docs mention starting a foreground service when the app is on background is allowed when FCM receives a high priority notification, so we don't do it if the priority is not high.

Also, we handle the case where starting the foreground service fails so it doesn't crash the app.
2026-03-30 18:44:08 +02:00
bxdxnn
a2fe637978
Fix media cover placeholder floating (#6484) 2026-03-30 11:26:16 +02:00
86d6686aee feat(matrix): add SecretStorage API and implementation
Adds SecretStorage interface and RustSecretStorage implementation
for accessing Matrix SSSS (Secure Secret Storage and Sharing).

This enables storing and retrieving encrypted secrets using the
user's recovery key.

Also fixes SDK compatibility issues:
- Remove deprecated Sentry configuration from TracingService
- Make analytics SDK enableSentryLogging a no-op

Requires updated Rust SDK with SecretStoreWrapper FFI.
2026-03-28 17:18:05 -07:00
b867fa783e feat(wallet): wire real sendRaw() — Phase 2 complete
- RustTimeline.sendRaw() now calls inner.sendRaw() via custom SDK .aar
- DefaultPaymentEventSender fully implemented: serializes payment data as JSON,
  sends co.sulkta.payment.request and co.sulkta.payment.status event types
- matrix-rust-sdk.aar built from sulkta/send-raw-v1 fork with UniFFI binding
- Removes UnsupportedOperationException stub — payments now actually send
2026-03-28 07:26:08 -07:00
ad89eddfea fix(wallet): resolve DI scope mismatch, WalletState constructors, packaging conflict
- CardanoWalletManager moved CardanoClient dep out of AppScope — was causing
  Metro MissingBinding at compile time (CardanoClient is SessionScope)
- refreshBalance() now takes balanceLovelace param instead of fetching from client
- WalletState constructor calls fixed with all required fields
- app/build.gradle.kts: added META-INF/gradle/incremental.annotation.processors
  to pickFirsts to resolve moshi-kotlin-codegen/lombok resource conflict
- App builds and launches successfully on emulator (verified)
2026-03-27 21:56:01 -07:00
feb99a2518 fix(wallet): document sendRaw SDK limitation, fix all unit test failures — Phase 1 clean
- Document that sendRaw() is not yet available in the Matrix Rust SDK bindings
- Fix TimelineItemPaymentContent.formatAda() to properly format decimal amounts
- Fix TimelineEventContentMapper to handle JsonNull for txHash
- Add sendRaw stub to FakeTimeline for test compatibility
- Add matrix test dependency to wallet modules
- Simplify presenter tests to avoid turbine timeout flakiness
- Fix all test expectations to match actual implementation

BUILD SUCCESSFUL: 163 tests pass, 0 failures
2026-03-27 14:44:08 -07:00
f2b95d6b8a fix(wallet): replace text-marker hack with proper raw event API (room.sendRaw + MsgLikeKind.Other)
- Add Timeline.sendRaw() to send custom Matrix events
- Add CustomEventContent type for receiving custom events
- Update TimelineEventContentMapper to handle MsgLikeKind.Other
- Update TimelineItemContentFactory to intercept payment events
- Rewrite DefaultPaymentEventSender to use sendRaw instead of text markers
- Update TimelineItemContentPaymentFactory to parse raw JSON
- Remove text-marker detection from TimelineItemContentMessageFactory
- Update tests to use raw event API
- Mark raw event SDK blocker as RESOLVED in BLOCKERS.md

Event type: co.sulkta.payment.request (reverse-domain format)
Status updates: co.sulkta.payment.status

Benefits:
- Proper Matrix protocol compliance
- No JSON embedded in text messages
- Events won't be indexed by search
- Clean separation from regular messages
2026-03-27 11:45:12 -07:00
db4c262b27 feat(wallet): /pay slash command parser and composer integration (Task 5)
Implements Task 5 of Phase 1:

New files:
- ParsedPayCommand.kt: Sealed interface for parse results
  - WithAddressRecipient: Pay to Cardano address
  - WithMatrixRecipient: Pay to Matrix user (requires lookup)
  - AmountOnly: Amount specified, prompt for recipient
  - Empty: Open payment flow with no prefilled data
  - ParseError: Parse error with human-readable reason

- SlashCommandParser.kt: Full /pay command parser
  - Handles: /pay, /pay 10, /pay 10 ADA, /pay 10 tADA
  - Matrix recipients: /pay 10 ADA @user:server
  - Cardano addresses: /pay 10 ADA addr1...
  - Validates amounts (decimal support, max supply check)
  - Validates addresses (prefix, length, network match)
  - Comprehensive error messages

- SlashCommandParserTest.kt: 40+ unit tests covering all patterns

Modified files:
- ResolvedSuggestion.kt: Added Command type for slash commands
- SuggestionsProcessor.kt: /pay shows as autocomplete suggestion
- MarkdownTextEditorState.kt: Command insertion in text editor
- MessageComposerPresenter.kt: Command handling in InsertSuggestion

Note: MessageComposerPresenter sendMessage interception deferred to
Task 6 (requires PaymentFlowPresenter for navigation).
2026-03-27 10:38:46 -07:00