Commit Graph

42 Commits

Author SHA1 Message Date
212b4785fb Fix note rendering for those that contain previewable items or leading and trailing whitespaces
Changelog-Fixed: Fixed note rendering for those that contain previewable items or leading and trailing whitespaces
Closes: https://github.com/damus-io/damus/issues/2187
Signed-off-by: Terry Yiu <git@tyiu.xyz>
2025-05-06 10:55:35 -04:00
2a19d5d831 Add Apple translation popovers for notes for iOS 17.4+ and macOS 14.4+
Changelog-Added: Add Apple translation popovers for notes for iOS 17.4+ and macOS 14.4+
2024-09-23 20:14:31 -07:00
ericholguin
0dce7aea45 ux: Create Highlights
This patch allows users to create a highlight in Damus.
This is done by modifying the menu options when text is selected, including a custom highlight option.
This option presents a sheet to the user of what they are highlighting with a cancel or post button.
If they press Post the sheet will dismiss and their highlight will be posted.

Testing
——
iPhone 15 Pro Max (17.3.1) Dark Mode:
https://v.nostr.build/wGDnx.mp4

iPhone SE (3rd generation) (16.4) Light Mode:
https://v.nostr.build/xEK0e.mp4

——

Changelog-Added: Ability to create highlights

Signed-off-by: ericholguin <ericholguin@apache.org>
2024-06-21 12:00:44 -07:00
kernelkind
7f6540b0c0 translate: remove redundant translation call
When auto-translate is enabled, translations are saved in cache through
preload_event in EventCache so it's redundant and wasteful to call
translate() as an async task

Closes: https://github.com/damus-io/damus/issues/1940
Lightning-address: kernelkind@getalby.com
Signed-off-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2024-02-20 11:20:31 -08:00
kernelkind
58326f679e translate: implement string distance for close matches
Implement the levenshtein string distance algorithm for determining
if the translation is too similar to the original content.

Closes: https://github.com/damus-io/damus/issues/1996

Lightning-address: kernelkind@getalby.com
Signed-off-by: kernelkind <kernelkind@gmail.com>
Reviewed-by: William Casarin <jb55@jb55.com>
Link: 20240214032018.57812-1-kernelkind@gmail.com
Signed-off-by: William Casarin <jb55@jb55.com>
2024-02-19 13:10:13 -08:00
Daniel D’Aquino
9a547077c1 Hook up Damus Purple translation service
This commit integrates the Damus Purple translation service:
- Automatically handles translation settings change after purchase
- Asks for permission to override translation settings if the user already has translation setup
- Translation settings can be changed with Damus Purple, if desired
- Translation requests working with the Damus API server

Testing
--------

PASS

Device: iPhone 15 simulator
iOS: 17.2
Damus: This commit
Damus Purple API server: `9397201d7d55ddcec4c18fcd337f759b61dce697` running on Ubuntu 22.04 LTS VM (npm run dev)
iOS setting: English set as the only preferred language.
Steps:
1. Enable Damus Purple feature flag on developer settings, set purple localhost mode, and restart app
2. Set translation setting to something other than none (e.g. DeepL)
3. Simulate Damus Purple purchase
4. Check that when dismissing welcome view, a confirmation prompt will ask the user whether they want to switch translator to Damus Purple. PASS
5. Click "Yes".
6. Go to translation settings. Check that translation settings are set to "Purple". PASS
7. Go to a non-English profile. Check that translations appear with "Mock translation" (Which is the translation text provided by the mock translation server). PASS
8. Reinstall app
9. Repeat the test, but this time starting with no translation settings. Make sure that translation settings will automatically switch to Damus Purple. PASS

Feature flag testing
--------------------

PASS

Preconditions: Same as above
Steps:
1. Turn off translation
2. Turn off Damus Purple feature flag
3. Go to translation settings. Make sure that Damus Purple is not an option. PASS

Closes: https://github.com/damus-io/damus/issues/1836
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2024-01-01 04:44:24 -08:00
William Casarin
69c7acea76 tests: add ndb support to tests
stops it from crashing
2023-09-21 09:10:06 -04:00
William Casarin
c71b0ee916 blocks: pass keypair instead of privkey to avoid pubkey gen
Generating a pubkey is quite slow, so pass a keypair instead of privkey
2023-08-28 11:47:29 -07:00
William Casarin
14ba33674b setting: adjustable font size for jack the zapper
Changelog-Added: Adjustable font size
2023-08-03 18:38:20 -07:00
William Casarin
cebd1f48ca ndb: switch to nostrdb notes
This is a refactor of the codebase to use a more memory-efficient
representation of notes. It should also be much faster at decoding since
we're using a custom C json parser now.

Changelog-Changed: Improved memory usage and performance when processing events
2023-08-03 13:20:36 -07:00
William Casarin
7040235605 refactor: add Pubkey, Privkey, NoteId string aliases
This is a non-behavioral change in preparation for the actual switchover
from Strings to Ids. The purpose of this kit is to reduce the size of
the switchover commit which is going to be very large.
2023-07-31 05:38:19 -07:00
William Casarin
f9d21ef901 test: rename test_event to test_note 2023-07-31 05:38:19 -07:00
William Casarin
374610a21a artifacts: allow unseparated note artifacts
This is needed for longform events. Right now we treat unseparated note
artifacts as a list of blocks, but we will likely need to render these
blocks into lists of attributed texts with image blocks inbetween.
2023-07-10 18:24:43 -07:00
fcd7d2beab Fix localization issues and export strings for translation 2023-07-09 15:33:15 -04:00
Bryan Montz
9847f12c95 Remove unused code
Closes: #1105
2023-05-08 11:01:04 -07:00
William Casarin
c74d3e4938 fix some translation bugs 2023-04-30 22:04:33 -07:00
William Casarin
df6911f9cb cache note language 2023-04-30 21:40:11 -07:00
William Casarin
1ca0519e25 Event Preloading
Changelog-Added: Added event preloading when scrolling
Changelog-Added: Preload images so they don't pop in
Changelog-Fixed: Fixed preview elements popping in
Changelog-Changed: Cached various UI elements so its not as laggy
Changelog-Fixed: Fixed glitchy preview
2023-04-30 20:06:38 -07:00
93580e5296 Do not translate own notes if logged in with private key
If you're not the private key user, it's possible you're just lurking on
somebody's account and you might not speak their language, so you might
need translations.

Changelog-Fixed: Do not translate own notes if logged in with private key
Closes: #943
2023-04-17 11:06:50 -07:00
6c7f8cdbe5 Fix localization issues and export strings for translation 2023-04-06 21:05:53 -04:00
William Casarin
4786c6f0cb Don't show Translating... if we're not actually translating
Changelog-Fixed: Don't show Translating... if we're not actually translating
2023-04-06 17:33:01 -07:00
William Casarin
e9be227009 Add bitcoin icon to bitcoin hashtags
Changelog-Added: Add bitcoin icon to bitcoin hashtags
2023-04-06 16:04:16 -07:00
William Casarin
2ae4a156da Make sure we only update translation cache on main thread 2023-04-06 10:39:01 -07:00
William Casarin
c5341ba337 Cache translations, fix translation popping
Completely refactor Translate View. Simplify bool logic into a state enum.

Changelog-Fixed: Fix translation text popping
Changelog-Added: Cache translations
2023-04-06 10:16:53 -07:00
William Casarin
6499738994 Fix auto-translations
Changelog-Fixed: Fix broken auto-translations
2023-04-06 08:27:27 -07:00
William Casarin
532eaa35bf pointless refactors 2023-04-06 08:27:27 -07:00
William Casarin
3da12e708f Only show translate button if autotranslate is off 2023-04-03 17:44:08 -07:00
William Casarin
c6e5193111 Don't show translation status
It's too poppy
2023-04-03 17:12:10 -07:00
William Casarin
f2ce146e98 Revert "Refactor auto-translations and add caching"
There are quite a few issues with this and is causing crashing

This reverts commit ae82114a33.
2023-03-31 10:01:31 -07:00
William Casarin
9ba3543d91 Fixed size of translated text
Changelog-Fixed: Fixed size of translated text
2023-03-31 09:26:39 -07:00
ae82114a33 Refactor auto-translations and add caching
Changelog-Added: Add auto-translation caching to ruduce api usage
Closes: #843
2023-03-31 09:07:15 -07:00
William Casarin
c7a34379dd Merge remote-tracking branch 'github/translations' 2023-03-27 12:42:59 -04:00
866e93d338 Add auto-translate setting 2023-03-27 10:31:58 -04:00
f75fc7eebe Add optional language filter on Universe feed 2023-03-27 10:26:18 -04:00
fd596241a2 Fix localization issues, import translations, and add Spanish (Spain), Vietnamese, and Portuguese (Brazil) 2023-03-24 22:31:20 -06:00
OlegAba
a1a89dc98e Add selectable text feature
Changelog-Added: Added the ability to select text on posts
Closes: #639
2023-02-18 08:59:47 -08:00
f69e0c660a Fix language detection to look at only text and not URLs or hashtags
Changelog-Fixed: Improve language detection
Closes: #577
2023-02-13 09:56:26 -08:00
852609ee30 Add alert to warn against posting nsec1 private keys
Changelog-Added: Warn when attempting to post an nsec key
Closes: #498
2023-02-06 11:59:44 -08:00
567303e680 Add DeepL translation integration
Changelog-Added: DeepL translation integration
Closes: #522
2023-02-06 11:51:50 -08:00
William Casarin
ba8425dedb Revert "Add remote image loading policy settings"
We still want to blur images from stranges if we set the everyone
policy. This is a regression.

This reverts commit ced5b4974f, reversing
changes made to 9be55b08fd.
2023-02-05 00:24:03 -08:00
radixrat
1a2e9464af add friends of friends, apply to all images 2023-02-03 19:37:23 -05:00
William Casarin
1696e0365e refactor: settings and translation view 2023-02-03 09:25:07 -08:00