Commit Graph
4561 Commits
Author SHA1 Message Date
Daniel D’AquinoandGitHub f7669d1093 Merge pull request #3719 from damus-io/copilot/add-auto-compact-lmdb-setting
Auto compact LMDB on a schedule
2026-04-06 17:13:04 -07:00
Daniel D’Aquino 9285504d9a Add auto-compact LMDB schedule setting with UI and tests
Closes: https://github.com/damus-io/damus/issues/3718
Changelog-Added: Automatic lossless storage optimization
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-04-06 15:01:06 -07:00
Daniel D’AquinoandGitHub 2e08fb9f8d Merge pull request #3663 from alltheseas/improve-blur-overlay-design
Improve BlurOverlayView to look protective, not broken
2026-04-06 14:56:36 -07:00
652e802ca6 Improve BlurOverlayView to look protective, not broken
The blur overlay previously used error-state iconography (eye.slash icon,
"Tap to load" button, raw URL display) which made users think media was
broken rather than intentionally hidden. Redesign to communicate
intentional protection:

- Replace eye.slash icon with shield icon
- Change title from "Media from someone you don't follow" to
  "Content hidden" (the old text was also wrong for undistractMode)
- Rename button from "Tap to load" to "Show"
- Remove raw URL display that added noise
- Remove unused properties (artifacts, size, damus_state, parentView)
  and dead ParentViewType enum that only existed for the URL display
- Simplify all 4 call sites to pass only the blur binding

Changelog-Changed: Redesigned media blur overlay to look like intentional protection instead of a broken state

Closes: https://github.com/damus-io/damus/issues/3662
Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 14:48:30 -07:00
Daniel D’Aquino bfad604e5b Revert "Remove transaction inheritance"
This reverts commit c1fb8b592f.

It turns out we still need transaction inheritance.

Even though the current Ndb interface hides transaction objects from callers and prevents those transactions from being held open beyond the small sync window where the underlying query result is borrowed, there is nothing preventing that caller from making another nested ndb query call from within that closure.

Closes: https://github.com/damus-io/damus/issues/3688
Changelog-Fixed: Fixed issue where mentioned profile names would not render properly
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-03-18 18:55:30 -07:00
Daniel D’AquinoandGitHub 92cca89c06 Merge pull request #3642 from ericholguin/ios-26-fixes
ui: Fixes for iOS 26 toolbars
2026-03-18 17:21:59 -07:00
ericholguinandDaniel D’Aquino d99443be6d ui: Fixes for iOS 26 toolbars
Note: This will only become user-facing once we switch to liquid glass
mode, therefore no changelog entry is needed now.

Changelog-None
Closes: https://github.com/damus-io/damus/issues/3702
Co-Authored-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: ericholguin <ericholguin@apache.org>
2026-03-18 17:07:25 -07:00
Daniel D’AquinoandGitHub f175e79a78 Merge pull request #3699 from alltheseas/fix/relay-list-bottom-cutoff
fix: add bottom padding to UserRelaysView to prevent last relay cutoff
2026-03-18 14:40:05 -07:00
alltheseasandClaude Opus 4.6 4fe94b081c fix: add bottom padding to UserRelaysView to prevent last relay from being cut off
Closes #3697

Signed-off-by: alltheseas

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 15:40:47 -05:00
Daniel D’AquinoandGitHub 38f0e9f152 Merge pull request #3698 from danieldaquino/gh-3696
Reduce max age for stale temporary snapshots
2026-03-18 12:19:36 -07:00
Daniel D’Aquino 96eb780f11 Reduce max age for stale temporary snapshots
The previous fix that implemented cleanup of temporary snapshots
included a max age for stale temporary snapshots, which was originally
set to 24h.

This improved the situation, but it still meant that the app could
accumulate 24 old snapshots, which leads to a non-trivial storage
amount.

This commit changes that to 30 minutes for better storage efficiency.

The previous fix was not published on the App Store yet, so no changelog
entry is needed.

Closes: https://github.com/damus-io/damus/issues/3696
Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-03-18 12:07:55 -07:00
Daniel D’AquinoandGitHub 69ba4b2c38 Merge pull request #3690 from alltheseas/fix/post-compact-sigbus-crash
fix: delete stale lock.mdb during compaction to prevent SIGBUS crash
2026-03-16 23:14:03 -07:00
alltheseasandClaude Opus 4.6 9d687ce4f6 fix: delete stale lock.mdb during compaction to prevent SIGBUS crash
Also clean up temp directory on post-replace size mismatch to match
all other error paths in compact_if_needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 23:13:13 -05:00
Daniel D’AquinoandGitHub e07e8c2dc3 Merge pull request #3668 from tyiu/translations
Translations
2026-03-16 20:00:48 -07:00
Daniel D’AquinoGitHubcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
ae1fefcfdd Fix subject-verb agreement issue in user-facing label
"Notes... usually contains" should be "Notes... usually contain" since "Notes" is plural.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-03-16 20:00:02 -07:00
Daniel D’AquinoandGitHub cc22c1e97c Merge pull request #3665 from alltheseas/fix/relay-disconnect-freeze
Fix stale relay list: replace UserDefaults hex lookup with ndb query
2026-03-16 18:39:07 -07:00
2e10c0b4c5 Fix stale relay list: replace UserDefaults hex lookup with ndb query
Replace the fragile `latestRelayListEventIdHex` UserDefaults lookup in
`getLatestNIP65RelayListEvent()` with a direct nostrdb query using
`ndb.query(filters:maxResults:)` on the AUTHOR_KINDS index. This
eliminates the stale-hex failure mode where relay add/remove operations
would silently fall back to bootstrap or year-old relay lists.

Add an in-memory `lastSetRelayList` cache to bridge the nostrdb async
write gap — `set()` populates it, `getUserCurrentRelayList()` checks it
first, and `load()` clears it once ndb has committed.

Remove `latestRelayListEventIdHex` from: Delegate protocol,
DamusState, SaveKeysView, UserSettingsStore, and all test mocks.

Includes 5 regression tests that fail before the fix and pass after:
- testRemoveRelayDoesNotFallBackToBootstrapList
- testCacheBridgesAsyncWriteGap
- testRapidSequentialRemovesDoNotReintroduceRelays
- testLoadClearsCacheAndReadsFromNdb
- testNdbQueryFindsRelayListWithoutStoredHex

Changelog-Fixed: Fix stale relay list causing inability to disconnect relays
Closes: #3537
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
2026-03-16 18:32:22 -07:00
Daniel D’AquinoandGitHub 537734397f Merge pull request #3686 from danieldaquino/gh-3680
feat: implement LMDB compact solution for storage optimization
2026-03-16 16:47:53 -07:00
Daniel D’Aquino 2c6e574b11 feat: implement LMDB compact solution for storage optimization
- Add `compact(to:)` method on `Ndb` using `mdb_env_copy2` / `ndb_snapshot`
  with `MDB_CP_COMPACT` flag to produce a smaller compacted database copy
- Add `compact_if_needed(db_path:)` static startup method that reads a
  UserDefaults flag, opens a temp Ndb, compacts to a sibling temp dir,
  atomically replaces `data.mdb`, cleans up, and clears the flag
- Add `set_compact_on_next_launch()` to schedule compaction from the UI
- Call `Ndb.compact_if_needed()` in `ContentView.connect()` before the
  main Ndb instance is opened
- Add `CompactDatabaseButton` to `StorageSettingsView` with a confirmation
  dialog that informs the user a restart is needed
- Add `NdbCompactionTests` unit tests covering flag API, no-op path,
  missing-DB path, and full round-trip compaction

Closes: https://github.com/damus-io/damus/issues/3680
Changelog-Added: Added "Compact Database" button in Settings → Storage that reclaims unused space by compacting the NostrDB on the next app launch
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-03-16 16:29:27 -07:00
Daniel D’AquinoandGitHub 55817d066e Merge pull request #3683 from danieldaquino/gh-3681
Remove transaction inheritance
2026-03-16 14:11:58 -07:00
Daniel D’AquinoandGitHub 599a2f48e3 Merge pull request #3685 from danieldaquino/gh-3684
Fix snapshot promotion and add temporary snapshot cleanup
2026-03-16 10:28:19 -07:00
Daniel D’Aquino 2ea9cdd416 Fix snapshot promotion and add temporary snapshot cleanup
Preserve the last good shared snapshot until a replacement is fully staged, and proactively remove stale snapshot_temp_* directories left behind by interrupted snapshot attempts. This prevents orphaned temp snapshots from accumulating while avoiding false cleanup errors after successful promotion.

Changelog-Fixed: Fixed issue where temporary files would not get cleaned up
Closes: https://github.com/damus-io/damus/issues/3684
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-03-16 03:03:56 -07:00
Daniel D’Aquinoandalltheseas c1fb8b592f Remove transaction inheritance
Transaction inheritance causes issues such as:
1. higher fragmentation in the db file, causing storage inefficiencies.
2. stale transactions holding an old view of the database, causing notes
   to be unavailable in certain scenarios

This should be safe because direct access to transactions is hidden
within the NostrDB Swift modules behind safe interfaces that prevent
direct access, thus reducing or eliminating the chance of accidentally
starting two transactions within the same thread (which would cause a
deadlock).

Closes: https://github.com/damus-io/damus/issues/3681
Changelog-Fixed: Disabled transaction inhe
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Co-Authored-By: alltheseas <alltheseas@users.noreply.github.com>
2026-03-14 01:08:48 -07:00
Daniel D’Aquino 0a801b01cb Add full container file breakdown to storage settings export
Users reported total app storage significantly higher than what the
storage settings view shows. To aid debugging, the export now includes
a "Full Container File Breakdown" section that enumerates every regular
file in the app sandbox and shared app group container, sorted by size
descending so orphaned/unexpectedly large files are easy to spot.

Changes:
- StorageStatsManager: add ContainerFileEntry and containerFileBreakdown()
- StorageStatsViewHelper: add formatContainerFileBreakdown() helper and
  include it at the end of formatStorageStatsAsText output

Closes: https://github.com/damus-io/damus/issues/3677
Changelog-Added: Full container file breakdown in storage settings export
2026-03-13 15:09:54 -07:00
alltheseasandClaude Opus 4.6 1768432a1e Move client tag display from feed to note detail view
Remove client tag from EventTop (feed header) and display it inline
next to the timestamp in SelectedEventView instead. Removes unused
ClientTagLabel struct. Applies lineLimit(1) with tail truncation to
guard against unbounded client tag names.

Closes: https://github.com/damus-io/damus/issues/3672
Signed-off-by: alltheseas

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 20:49:29 -05:00
tyiu 31e281ce73 Fix localization issues and export strings for translation
Signed-off-by: Terry Yiu <git@tyiu.xyz>
2026-03-09 21:08:29 -04:00
Daniel D’Aquino 7937accfb3 Fix build errors in PostView tests
Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-03-09 17:09:23 -07:00
Daniel D’Aquino 658e457d59 Do not define OS on justfile commands
This prevents issues when OS versions change.

Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-03-09 17:07:08 -07:00
transifex-integration[bot]andtyiu 963da2d4eb Translate Localizable.stringsdict in pl_PL
100% translated source file: 'Localizable.stringsdict'
on 'pl_PL'.
2026-03-07 00:23:32 -05:00
alltheseasandDaniel D’Aquino af3bb212c3 Show client tags on events
Display "via ClientName" indicator beside timestamps when an event has
a client tag, allowing users to see which nostr app published it.

Changelog-Added: Show client name on events when available
Closes: https://github.com/damus-io/damus/issues/3323
Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
2026-02-27 13:19:55 -08:00
alltheseasandDaniel D’Aquino f3361e6eae Add client tag accessor to NdbNote
Add a clientTag property to NdbNote that parses and returns the client
tag metadata from an event's tags, enabling display of which app
published an event.

Ref: https://github.com/damus-io/damus/issues/3323
Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
2026-02-27 13:19:55 -08:00
alltheseasandDaniel D’Aquino 7f2c575f20 Expose client tag toggle in settings
Add a Privacy section in Appearance settings allowing users to disable
client tag publishing if they prefer not to identify Damus when posting.

Ref: https://github.com/damus-io/damus/issues/3323
Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
2026-02-27 13:19:55 -08:00
alltheseasandDaniel D’Aquino ec28822451 Add Damus client tag emission
- Add ClientTagMetadata struct with parsing helpers and documentation
- Append Damus client tags when posting across app, share, and drafts flows
- Gate the behavior behind a new publish_client_tag setting (default on)

Changelog-Added: Add client tag to published events to identify Damus
Ref: https://github.com/damus-io/damus/issues/3323
Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
2026-02-27 13:19:55 -08:00
Daniel D’Aquino 795fce1b65 Add storage usage stats settings view
This commit implements a new Storage settings view that displays storage
usage statistics for NostrDB, snapshot database, and Kingfisher image cache.

Key features:
- Interactive pie chart visualization (iOS 17+) with tap-to-select functionality
- Pull-to-refresh gesture to recalculate storage
- Categorized list showing each storage type with size and percentage
- Total storage sum displayed at bottom
- Conditional compilation for iOS 16/17+ compatibility
- All calculations run on background thread to avoid blocking main thread
- NostrDB storage breakdown

Changelog-Added: Storage usage statistics view in Settings
Changelog-Changed: Moved clear cache button to storage settings
Closes: https://github.com/damus-io/damus/issues/3649
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-25 15:45:37 -08:00
copilot-swe-agent[bot]andDaniel D’Aquino 65e767b774 fix: refresh balance and transactions in WalletModel.connect() on wallet switch
When a new wallet is connected, clear stale balance and transaction data
from the previous wallet immediately so the view does not display outdated
information while fresh data is being fetched.

Closes: https://github.com/damus-io/damus/issues/3644
Changelog-Fixed: Wallet view now immediately clears stale data when switching wallets
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Co-authored-by: Daniel D’Aquino <daniel@daquino.me>
Tested-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-25 13:24:11 -08:00
Daniel D’Aquino af9956de8a v1.16.1 changelog
Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-23 18:33:55 -08:00
CopilotGitHubcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>danieldaquino
7be75f37c6 Fix: Gracefully ignore unsupported NWC response types (e.g. get_info)
When another NWC client (e.g. Alby) connected to the same relay calls
`get_info`, Damus receives the response and previously threw a
DecodingError.typeMismatch, causing an "Oops" error dialog to be shown.

Fix: Make `result_type` optional in `WalletConnect.Response`. Unknown
result types now decode without throwing — `result_type` and `result`
are set to `nil`, and the rest of the existing nil-guarded code paths
handle this silently.

Adds a test to verify `get_info` (and any future unknown result type)
is decoded gracefully.

Closes: #2204
Changelog-Fixed: Fixed issue where the app could display an error message when using another NWC wallet in parallel
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: danieldaquino <24692108+danieldaquino@users.noreply.github.com>
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-23 12:50:25 -08:00
ericholguinandDaniel D’Aquino 84ef5ecf53 gifs: Tenor GIFs
This PR adds GIFs to Damus using Tenor as the service.
This is a Damus Labs feature to begin with.
In the future we should be able to also query nostr for gif media.

Changelog-Added: Added GIF keyboard support (Damus Labs only)
Signed-off-by: ericholguin <ericholguin@apache.org>
2026-02-20 17:56:04 -08:00
yseandDaniel D’Aquino f440f37cbf tests: wallet: add encoding test for list_transactions request
This adds a test to verify that the `getTransactionList` behaves as
expected when passing a nil and not-nil type as argument.

Signed-off-by: Hydra Yse <hydra_yse@proton.me>
2026-02-18 22:52:09 -08:00
yseandDaniel D’Aquino b59816e180 wallet: models: unset type field for list transactions request
Removes the empty `type` field from the wallet's list_transactions
request in favor of a null field, which is parsable by serializers.

Signed-off-by: Hydra Yse <hydra_yse@proton.me>
2026-02-18 22:52:09 -08:00
yseandDaniel D’Aquino 609cdcc5f9 wallet: errors: add %@ string formatting instead of %s
This fixes a UI issue where the error message from the NWC response
would be incorrectly displayed due to utf-8 formatting.

Signed-off-by: Hydra Yse <hydra_yse@proton.me>
2026-02-18 22:33:33 -08:00
Daniel D’Aquino 59498e3256 Fix double-free crash when creating empty NdbFilter
When ndb_filter_end processes an empty filter (no fields added), it calls
realloc(filter->elem_buf.start, 0) which frees the memory and returns NULL.
The existing code only updated the pointer if realloc
returned non-NULL, leaving elem_buf.start pointing to freed memory. This
caused a double-free crash when ndb_filter_destroy later called free() on
the dangling pointer.

Fix by explicitly setting filter->elem_buf.start to NULL when realloc
returns NULL due to zero-size allocation, and update the assertion to
allow NULL pointers for empty filters. ndb_filter_destroy already checks
for NULL before freeing.

Closes: https://github.com/damus-io/damus/issues/3634
Changelog-Fixed: Fix memory corruption crash when creating empty filters
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-18 16:28:00 -08:00
Daniel D’Aquino 546e9eec32 v1.16 changelog
Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-17 04:19:23 -08:00
alltheseasandDaniel D’Aquino cfafcffde2 fix: wait for relay connection before loading nevent URLs
LoadableNostrEventViewModel.load() now calls awaitConnection() before
executeLoadingLogic(), preventing premature "not found" when opening
nevent URLs or search results before relays finish connecting.

Closes: https://github.com/damus-io/damus/pull/3559

Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
Tested-by: Daniel D’Aquino <daniel@daquino.me>
Reviewed-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-16 19:51:21 -08:00
Daniel D’Aquino 4099827169 Fix fulfillment call in testActionBarModel to use its async version
Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-16 19:12:35 -08:00
Daniel D’Aquino 32c0177049 Fix off-by-one-error in testTimerRestartsAfterSave
No user-facing change

Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-16 19:12:35 -08:00
Daniel D’Aquino 2e1a98ff19 Add useful view for note-not-found state in quoted notes
Changelog-Added: Added a view for quotes notes that could not be loaded, including actionable items
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-16 13:16:21 -08:00
Daniel D’Aquino 7fa044d205 Fix infinite loading spinner regression
Root cause:
1. `lookup` looks up a note by its note id, and saving its note key
2. `lookup` then returns early (i.e. does not loading anything from the
   network) since it found the note
3. On the view, once it borrows the note from NostrDB (a query using its
   NoteKey), the query fails (Most likely due to transaction inheritance
   and the fact that the inherited transaction may be an older snapshot
   of the database without the note), causing the view loading logic to
   fail silently, leading to the infinite loading spinner

The issue was addressed by performing a single query during lookup and
copying the note contents directly at that point to avoid this
transaction inheritance issue.

In the future we should consider a more comprehensive fix to address
other instances where this may happen. I opened
https://github.com/damus-io/damus/issues/3607 for this future work.

Changelog-Fixed: Fixed an issue where notes would keep loading indefinitely in some cases
Closes: https://github.com/damus-io/damus/issues/3498
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-16 13:16:21 -08:00
William CasarinandClaude Opus 4.6 be6b0e2702 Move note language computation off the main thread
NLLanguageRecognizer.processString() is an expensive NLP operation that
was moved to @MainActor in 5058fb33, causing UI jank when scrolling.

This moves language detection back to the async preload path where it
runs off the main thread. get_preload_plan is synchronous again and
defers language computation to preload_event. Translations still happen
on the first preload pass since preload_event now checks .havent_tried
directly rather than relying on the load_translations flag from the plan.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 10:16:25 -08:00
Daniel D’Aquino 2d5460b654 Bump version to 1.17
Changelog-None
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
2026-02-06 18:12:02 -08:00