Commit Graph

613 Commits

Author SHA1 Message Date
Daniel D’Aquino ad75d8546c Add experimental push notification support
I added support for the experimental push notifications feature. There are many improvements to be made, so this feature is currently opt-in only. If the user does not opt-in, their device tokens will not be sent out and thus they will receive no push notifications.

We should perform more testing on real-life staging environments before fully releasing this feature.

Testing
-------

Testing was done gradually during development.

Device: iOS simulators
iOS: 17
Damus version: A few different but recent prototypes
Rough coverage:
1. Checked that no device tokens are sent out when setting is off
2. Checked that I can successfully receive device tokens when feature is ON and set to localhost.
3. Checked sending test push notifications of types "note" (kind: 1), reaction (kind: 7) and DMs (kind 4) works and shows a generic but reasonable push notification message
4. Checked that clicking on the notifications above take the user to the correct screen

Closes: https://github.com/damus-io/damus/issues/67
Changelog-Added: Add experimental push notification support
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-11-20 10:32:33 -08:00
William Casarin f976f23854 v1.6 (29)
Almost there!!!
2023-11-15 12:50:44 -08:00
William Casarin cf13e1ca61 Actually fix camera descriptions 2023-11-15 12:48:56 -08:00
William Casarin 2585a375ab v1.6 (28) 2023-11-13 10:31:28 -08:00
William Casarin 289e051202 v1.6 (26) 2023-11-13 10:31:28 -08:00
William Casarin d1d830fca1 v1.6 (25) 2023-10-31 10:26:12 +09:00
Daniel D’Aquino 139df33cb7 Rename ZapButton to NoteZapButton and ZapButtonView to ProfileZapLinkView (no-op)
This is a non-functional refactor to rename two views with similar names, to avoid confusion.

Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-24 12:18:20 +08:00
William Casarin 29915159db v1.6 (24) changelog 2023-10-22 14:27:56 +08:00
Daniel D’Aquino e70f270c5c zaps: Improve discoverability of profile zaps
via zappability badges and profile action sheets

This commit improves discoverability of zaps with the following changes:

1. New zap icon appears on profile pictures of events where the author of such event has zaps setup
2. Clicking on a profile picture from an event shows an action sheet that makes it easier to see a preview of their profile, and a zap button

Testing
-------

Devices:
- iPhone 14 Pro simulator
- iPad 10 simulator

iOS:
- 17.0.1
- 16.4

Damus: This commit

Coverage:
1. Checked that zap icon appears on profile pictures on events in different feeds and threads
2. Checked that this zap icon only appears for profiles that have zaps enabled
3. Checked that profile action sheet looks good on both light mode and dark mode
4. Checked that long descriptions are truncated and the "see more" "see less" buttons work
5. Checked that clicking "see more" or "see less" adapts the size of the action sheet (on iPhone)
6. Checked that action sheet looks good whether or not the user has a website link setup
7. Checked that long presses on the zap button in the action sheet bring the same options as the normal profile view
8. Checked all the buttons in the action sheet take the user to the expected place
9. Checked that the original profile view looks good (on both light and dark mode)

Notes:
- Action sheet cannot be resized on iPad.
- Could not test on Mac Catalyst because there seems to be a crash on the creation of a new account

Reference ticket: https://github.com/damus-io/damus/issues/1596

Changelog-Added: Improve discoverability of profile zaps with zappability badges and profile action sheets
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-22 10:40:31 +08:00
Davide De Rosa 45904e1bf2 nav: compare searches for navigation decisions
In 7c98489, routes are compared to the stack top before push.
Problem is, search comparison is not looking at the NostrFilter.

Instead, hash value involves two UUID-based fields (sub_id,
profiles_subid), so equality will always fail and result in a
"duplicated push".

As I do not know the context of such fields to deliberately
drop them, this patch is sent as a draft.

The basic idea is using the filter for comparison, so I added
a Hashable extension to NostrFilter where the subject of the
comparison may be fine-tuned.

Adding `hashtag` resolves #1367 but it's only a starting point.

Signed-off-by: Davide De Rosa <keeshux@gmail.com>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-22 08:56:42 +08:00
Daniel D’Aquino 7ae66b8490 ui: Add suggested hashtags to universe view
This commit adds a suggested hashtag section to the universe view tab. The method for suggesting hashtags is currently simple:
1. It contains a list of many possible hashtags that we could recommend
2. It calculates how many users have been talking about it in the events fetched by the Universe tab
3. It selects the Top-N most mentioned suggested hashtags in the Universe tab

This has the following properties:
1. It has some spam resistance as it ranks by unique users mentioning the tag (instead of events)
2. It is a simple way to curate good hashtags
3. It shows the ones with the most amount of people talking about it among the notes fecthed in the Universe view

Testing
-------

PASS

Device: iPhone 14 Pro simulator
iOS: 17.0
Damus: This commit
Coverage:

1. Suggested hashtags are displayed
2. Layout looks similar to Figma
3. User count goes up (does not stay at zero)
4. Clicking on a suggested hashtag takes you to that hashtag view
5. Only the top 5 hashtags are displayed

Notes: The counts seem low, probably because there are not enough notes loaded in Universe View

Changelog-Added: Add suggested hashtags to universe view
Closes: https://github.com/damus-io/damus/issues/1569
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-21 08:42:00 +08:00
Daniel D’Aquino bf43842590 onboarding: Suggest first post during onboarding
Testing of standard flow
------------------------

PASS

Device: iPhone 14 Pro simulator
iOS: 17.0
Damus: This commit
Steps:
1. Delete and reinstall Damus
2. Go through onboarding until suggested users appear
3. Click "continue". Should slide into the post view. PASS
4. Post view should look similar to the Figma design file, but with examples as placeholders. PASS
5. Examples should switch every 3 seconds. PASS
6. Typing a first character causes the #introductions hashtag to be automatically added. PASS
7. Uploading an image makes progress view show up and not break layout. PASS
8. Clicking on "post" should post this note and dismiss onboarding view. PASS

Testing of other flows
----------------------

PASS

Device: iPhone 14 Pro simulator
iOS: 17.0
Damus: This commit
Special remark: Made local change to always show the onboarding suggestions, and speed up testing
Coverage:

1. Clicking "skip" on suggested users view will skip into the post view. PASS
2. Clicking "cancel" on post view and then going to the normal post view reveals a blank draft. PASS
3. Clicking "cancel" dismisses onboarding view and does not post anything. PASS
4. Normal post view looks normal (not broken). PASS
5. Changing initial suggested post during onboarding, cancelling the post, and then re-entering normal post view reveals the draft with user modifications. PASS

Changelog-Added: Suggest first post during onboarding
Closes: https://github.com/damus-io/damus/issues/1338
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-21 08:42:00 +08:00
Daniel D’Aquino 3b76fcb743 test: Add basic snapshot test coverage for EventView
This commit adds a basic snapshot test for EventView, and also adds some testing infrastructure to help with mocking NostrDB behavior.

Test
----

PASS

Device: iOS 17.0 Simulator
iOS: 17.0
Damus: This commit
Steps: Run `EventViewTests`
Results: Snapshot matches baseline reference added
2023-10-16 03:13:28 +02:00
Jericho Hasselbush 439f9974c5 login: add nsec qr-scanning
- Allow scanning of QR codes, and if detects a nsec, will provide it to
  the login prompt.

- If nsec is found, provides option to keep nsec in keychain; default is
  to not store

- User stays logged in until they logout, or app is force-quit if nsec
  is not stored.

damusApp.swift:
  Obtains keypair from the notification generated to allow login.

LoginView.swift:
  New views allowing for adding and logic handling the QR reader in
  QRScanNSECView.swift to enable QR scan for nsec.

QRScanNSECView.swift:
  New view to scan for QR code. The sparkling magnifying glass is enabled
  if the view calling the QR view changes the privKeyFound bound variable.

Tipjar: npub1el277q4kesp8vhs7rq6qkwnhpxfp345u7tnuxykwr67d9wg0wvyslam5n0
Closes: https://github.com/damus-io/damus/issues/1291
Changelog-Added: Add QR scan nsec logins.
Signed-off-by: Jericho Hasselbush <jericho@sal-et-lucem.com>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-16 03:12:53 +02:00
Daniel D’Aquino 7bed47c919 test: Setup Snapshot testing library and add a snapshot test (testTextWrapperViewWillWrapText)
This change adds `https://github.com/pointfreeco/swift-snapshot-testing` as a package dependency and links it to the `damusTests` target.
It also adds one snapshot test to demonstrate its usefulness, by adding coverage to one particular aspect that we have never been able to test before: Whether or not the post text editor will wrap the text once the text gets long.

Testing of the test
-------------------

PASS

iOS: 17.0
Device: Simulator
Damus: This commit
Test steps:

1. Run `testTextWrapperViewWillWrapText`. PASS
2. Change TextViewWrapper.swift and remove this line:
```
textView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
```
3. Rerun. It fails. PASS (This is expected)

Closes: https://github.com/damus-io/damus/issues/1562
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-10 22:05:45 -07:00
William Casarin 7a6a6dffbc camera: actually add CameraPreview to project 2023-10-07 17:00:25 -07:00
Suhail Saqan 472f81b311 add CameraModel and CameraService for interacting with the camera 2023-10-07 16:52:38 -07:00
Daniel D’Aquino 7744787c51 storage: Improve clear cache functionality
This patch improves clear cache functionality by:
- Reducing kingfisher cache removal to one command (The two commands running async was leading to warning logs. One was a subset of the other)
- Removing all files under the cache folder where not currently used by other processes

Full Functionality test
-----------------------

PASS

Device: iPhone 13 mini (Physical device)
iOS: 17.0.3
Damus: This commit
Special remarks:
- I had to locally delete other unit tests to be able to build the test target
- Unit test run on an earlier version of the patch. Test coverage should still apply since this newer patch is a subset of the previous.

Setup: Run Damus with debugger connection to Xcode

Test steps:

1. Follow multiple active accounts (Skip if local Damus is already filled up with GBs of data)
2. Scroll down on the feed for a couple of minutes (or until you have seen at least a few images, a few videos, and link previews) (Skip if local Damus is filled up with GBs of data)
3. In Xcode, download a storage container (Window > Devices and Simulators > Select the device > Select Damus > click on (...) > Download container)
    - Note: Even though you see the file, it does not download instantly. Monitor the file size until it roughly reaches the size reported in iOS storage settings, as the download may still be in progress. This may take a few minutes in some cases.
    - Also take note of storage usage in iOS settings
4. Open the app data package using terminal
5. Run `du -h . | sort -hr`
6. Clear cache and check logs. Logs should indicate the caches being cleared, and there should be no storage-related warning/error logs. PASS
7. Download a new storage container. Remember to wait until it completes download.
8. Run `du -h . | sort -hr` on it.
9. Compare. There should be much less data. Also check iOS settings storage usage. PASS
10. Go back to the home feed and start scrolling, browsing, follow some other people, etc. Look at your own profile as well. Everything should appear to be working as expected with no crashes or important data loss
11. Check bookmarks are still present. PASS
12. Run `DamusCacheManagerTests`. Should pass. PASS* (*See special remarks)

Results:
- Storage usage goes from 3.9GB to 394.7MB
- Damus works as normal after clearing cache, and after restarting the app as well. It becomes slower for a moment, but after a bit it loads as normal again.
- No warning or error logs pertaining to clearing cache
- Unit test passes

My storage container disk usage stats after clearing cache:
```
% du -h | sort -hr
359M	./AppData
359M	.
336M	./AppData/Documents
 23M	./AppData/Library
 20M	./AppData/Library/Caches
7.9M	./AppData/Library/Caches/com.jb55.damus2
2.4M	./AppData/Library/SplashBoard/Snapshots
2.4M	./AppData/Library/SplashBoard
1.8M	./AppData/Library/SplashBoard/Snapshots/com.jb55.damus2 - {DEFAULT GROUP}
1.6M	./AppData/Library/Caches/com.jb55.damus2/fsCachedData
636K	./AppData/Library/SplashBoard/Snapshots/sceneID:com.jb55.damus2-ecc156b1-eb9c-4439-b219-e1eebf2b4c36
596K	./AppData/Library/Caches/com.apple.WebKit.GPU/com.apple.metal
596K	./AppData/Library/Caches/com.apple.WebKit.GPU
452K	./AppData/Library/Caches/com.jb55.damus2/com.apple.metal
296K	./AppData/Library/SplashBoard/Snapshots/sceneID:com.jb55.damus2-ecc156b1-eb9c-4439-b219-e1eebf2b4c36/downscaled
224K	./AppData/Library/HTTPStorages/com.jb55.damus2
224K	./AppData/Library/HTTPStorages
164K	./AppData/Library/Caches/com.onevcat.Kingfisher.ImageCache.default
156K	./AppData/Library/Caches/RelayLogs
112K	./AppData/Library/Caches/com.apple.dyld
 92K	./AppData/Library/Preferences
 60K	./AppData/Library/Caches/com.jb55.damus2/com.apple.metal/archiveUsage.db
 12K	./AppData/Library/Saved Application State/com.jb55.damus2.savedState
 12K	./AppData/Library/Saved Application State
8.0K	./AppData/StoreKit
8.0K	./AppData/Library/Saved Application State/com.jb55.damus2.savedState/ecc156b1-eb9c-4439-b219-e1eebf2b4c36
4.0K	./AppData/Library/Saved Application State/com.jb55.damus2.savedState/KnownSceneSessions
4.0K	./AppData/Library/LanguageModeling/en-dynamic.lm
4.0K	./AppData/Library/LanguageModeling
4.0K	./AppData/Library/Cookies
  0B	./AppData/SystemData/com.apple.SafariViewService/Library/WebKit/WebsiteData
  0B	./AppData/SystemData/com.apple.SafariViewService/Library/WebKit
  0B	./AppData/SystemData/com.apple.SafariViewService/Library
  0B	./AppData/SystemData/com.apple.SafariViewService
```

Biggest storage used remaining is in the Documents folder where NostrDB is stored. However, we do not want to clear NostrDB, so this is expected behavior.

Changelog-Changed: Improve clear cache functionality
Closes: https://github.com/damus-io/damus/issues/1472
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-07 16:42:08 -07:00
William Casarin f90a485b5e v1.6 (23) final 2023-10-06 12:56:31 -07:00
William Casarin 76f3cd4edc 21 2023-10-06 10:42:17 -07:00
William Casarin deb75df54e v1.6 (20) 2023-10-04 14:54:48 -07:00
Daniel D’Aquino 768ab3e9e4 ui: Fix issue where relays with trailing slashes cannot be removed (#1531)
Summary
-------

This fixes the issue at Github #1531 where relays with trailing slashes cannot be removed.

The root cause (Identified by @fishcakeday) was that for a relay to be removed, a certain dictionary entry containing the relay url needed to be removed prior to sending the updated relay list. However those dictionary keys used `String` objects, which cannot tell that two URLs are the same with or without a trailing slash.

To fix the issue, I have used a dictionary with the type `[RelayURL: RelayInfo]`, and made the necessary protocol conformance implementations for RelayURL. This way, URLs are handled with higher accuracy (e.g. Trailing slashes do not matter, URLs that resolve to the same location will match no matter what).

This allows us to leverage the existing parsing and handling logic that comes with the `URL` type, instead of manually handling URL strings.

Generally speaking it is preferrable to work with higher level `URL` or `RelayURL` objects than handle URLs via `String`. There is an opportunity to refactor more code, but I intentionally kept the changes to `RelayURL` limited to the functionality in this issue, because otherwise the changeset becomes very big and risky.

Issue reproduction
------------------

**Device:** iPhone 14 Pro simulator
**iOS:** 17.0
**Damus:** Local build from `476f52562` with the following local change:
``` diff

Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-02 12:34:08 -07:00
Daniel D’Aquino 0f86a41c4a ui: Hide quoted or reposted notes from people whom the user has muted. (#1216)
Summary
-------

This patch fixes the issue where the user might see notes from users that they have muted, if such note has been reposted or quoted.

Furthermore, this patch introduces some improvements on some of the associated views, making them more reusable.

Testing of the fix
------------------

**PASS**

**Device:** iPhone 14 Pro simulator
**iOS:** 17.0
**Damus:** This commit
**Test steps:**

1. Create two test accounts (if not created already). We will use test account "A". Test account "B" is an external test account
2. Make some notes from test account "B" (if non existent)
3. Switch to account "A"
4. Under test account "A", follow account "B"
5. Repost a note from account "B", and quote another note from account "B"
6. Access "account B"'s timeline. Repost and quoted note should all be visible. Layout should look as usual
7. Click on the reposted note. Should appear and it should look normal
8. Click on the note with the quote. Should appear and it should look normal
9. Click on the quoted note. Should appear and it should look normal
10. Now mute account "B"
12. Go back to account "A"'s timeline
13. Repost should appear, but the reposted content should be hidden behind a mute box. Clicking on show/hide should show or hide muted content
14. Note with quoted content should appear, but the quoted content should be hidden behind a mute box. Clicking on show/hide should work as expected
15. Make sure that the layout in steps 13 and 14 look good.
16. Click on the repost to access the thread view. Should be muted as expected.
17. Add a comment to the repost. Comment should appear even if the mute box hides the main note
18. Click on the note with quote to open its thread view. Comments should appear, main note should appear, but quoted content should be behind the mute box
19. Under account "B", add a comment to the quoted notes
20. Under account "A", check in the thread view that "B"'s reply is behind a mute box
21. Reply to the note with the quote. Check that the note appears correctly and that quoted content is behind the mute box (in the post composer view)
22. Find on Nostr a post where one of the replies contains a quoted note. Mute the user of the quoted content, and check that quoted content is now in a mute box

Smoke sanity test
-----------------

**PASS**

**Device:** iPhone 14 pro simulator
**iOS:** 16.4
**Test steps:** Browse a timeline filled with real notes and comments. Go through different notes and threads, mute some users, just to make sure nothing else appears obsviously broken.

Other notes
-----------

I removed this code:

```
.frame(maxWidth: .infinity, minHeight: PFP_SIZE)
```

from `EventShell`, because it was causing the layout to break on "threaded" style event view with muted quoted content (e.g. in a reply with quoted content).

The line of code dates back to `495859e07f`, but I am not sure why this line existed in the first place, or if removing it has any negative impact.

Closes: https://github.com/damus-io/damus/issues/1216
Changelog-Fixed: Hide quoted or reposted notes from people whom the user has muted. (#1216)
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-02 12:34:08 -07:00
Suhail Saqan 8a2e87718b camera: add CameraPreview for displaying the view the camera is reading 2023-10-02 12:34:08 -07:00
Suhail Saqan 88b3c6fe8d camera: add PhotoCaptureProcessor and VideoCaptureProcessor 2023-10-02 12:34:08 -07:00
Suhail Saqan cdacbcfdca util: add ImageResizer to change size of images 2023-09-24 11:58:16 -07:00
William Casarin 9f15688699 v1.6 (19) 2023-09-24 11:33:40 -07:00
William Casarin 4377cf28ef v1.6 (18) 2023-09-21 18:05:59 -04:00
William Casarin 622a436589 ndb: add NdbTxn transaction class
This will be used for transactions
2023-09-21 09:10:06 -04:00
William Casarin bb4fd75576 nostrdb: add profiles to nostrdb
This adds profiles to nostrdb

- Remove in-memory Profiles caches, nostrdb is as fast as an in-memory cache
- Remove ProfileDatabase and just use nostrdb directly

Changelog-Changed: Use nostrdb for profiles
2023-09-21 09:10:06 -04:00
Daniel D’Aquino 49283f2bb2 filters: add "Do not show #nsfw tagged posts" setting
This commit adds a setting where the user can choose to hide notes with
a #nsfw hashtag. This setting was implemented to allow users to filter
out adult or other unsafe content.

I moved the code logic for content filtering into a new file, and
defined a protocol for content filters. Although the logic is still
simple, this might help in developing a flexible API in case we have
more complex filtering needs in the future.

I also modified the name of the "Appearance" setting to "Appearance and
filters", to make it easier for users to intuitively find this setting.
(Note: Re-translations of this string might be necessary)

**PASS**
**iOS:**
- iOS 17.0 (iPhone 14 Pro)

**Damus:** (This commit)
**Steps:**
1. Follow another account that you control (Account B)
2. On account B, post a note saying "#test this is a test". This note should show up on the home feed.
3. On account B, post a note saying "#nsfw this is a test". This note should NOT show up on the home feed
4. Go to settings and disable the NSFW filter. Go back to the home view. The #nsfw post should now show up.
5. Close app and reopen. NSFW post should still show up (i.e. Setting should be persistent)
6. Unfollow account B
7. Close app and reopen.
8. Follow the "#grownostr" hashtag
9. Turn on the NSFW filter
10. On account B, post a note saying "#grownostr this is a test". This note should show up on the home view.
11. On account B, post a note saying "#grownostr #nsfw this is a test". This note should NOT show up.
12. Double-check the "notes and replies" tab. Note should NOT show up there either.
12. Turn off NSFW filter
13. Note from step 11 should now show up.
14. Go to Universe view and find a post with a hashtag. Remember where the post is.
14. Locally change the tag keyword from "nsfw" to that hashtag (Note: I had to test this way because my posts were not showing up in the Universe view)
15. Turn off the filter. Check post is there, in the Universe view.
16. Turn on the filter. Check post is no longer there in the Universe view. (Check the neighboring posts are the same, to make sure)
17. Bring back the code to its normal state.
18. Search for "#nsfw". Make sure that #nsfw appears (I believe this is ok, because it means the person is purposefully searching for it)

Closes: https://github.com/damus-io/damus/issues/1412
Changelog-Added: Add "Do not show #nsfw tagged posts" setting
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-21 09:10:06 -04:00
William Casarin a88f5db10b Revert "deps: add tldextract"
This reverts commit 4263b9690f.
2023-09-21 08:48:20 -04:00
ericholguin 7baf7e66dc relays: add relay pic view for displaying relay icons 2023-09-10 09:54:35 -07:00
William Casarin 4263b9690f deps: add tldextract
This is needed for the new relay view
2023-09-10 09:52:54 -07:00
ericholguin 94ce604b9d components: add neutral button style component 2023-09-09 09:45:16 -07:00
ericholguin b934d66f64 components: add lighter gradient 2023-09-09 09:45:16 -07:00
Bryan Montz 54ba64535d video: remove GSPlayer dependency
Changelog-Fixed: Fixed audio in video playing twice
Closes: https://github.com/damus-io/damus/pull/1539
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-07 10:33:34 -07:00
Bryan Montz 9cf53a9e93 video: remove VideoPlayer and switch to VideoController for cache
Closes: https://github.com/damus-io/damus/pull/1539
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-07 10:33:31 -07:00
Bryan Montz f1f3abfb98 video: add DamusVideoPlayerViewModel
Closes: https://github.com/damus-io/damus/pull/1539
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-07 10:33:14 -07:00
Bryan Montz dec07df2c1 video: add VideoController, which hold cached metadata and mute states
Closes: https://github.com/damus-io/damus/pull/1539
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-07 10:33:12 -07:00
Bryan Montz 53734ea483 video: add AVPlayerView, a simple wrapper for AVPlayerViewController
Closes: https://github.com/damus-io/damus/pull/1539
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-07 10:33:07 -07:00
Grimless b18a0c573e profile: move the "Follow you" badge into the profile header
Move the "Follow you" badge into the profile header he profile header
out-of-line with the often long and already space-constrained
username/display name text

Changelog-Changed: Move the "Follow you" badge into the profile header
Closes: https://github.com/damus-io/damus/pull/1529
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-03 18:02:54 -07:00
Grimless 6ee0be40e9 Create helper extensions for Block and update tests for the Block helper model
Closes: https://github.com/damus-io/damus/pull/1528
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-03 18:02:32 -07:00
Grimless a64f898df7 Move the Block helper type to its own file, collapse the various standalone functions for parsing block data, and refactor consumers to initialize a Block with given data and access its members as needed.
Closes: https://github.com/damus-io/damus/pull/1528
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-03 18:02:32 -07:00
William Casarin caffa0398b nostrdb: profile flatbuffers in nostrdb working! 2023-08-26 20:46:42 -07:00
William Casarin 92bbc9766d project: disable compile warnings for lmdb and nostrdb 2023-08-26 20:46:42 -07:00
William Casarin 4c0166bd31 add swift flatbuffers 2023-08-26 20:46:42 -07:00
William Casarin 35b67dc08d nostrdb: initial Ndb class 2023-08-26 17:11:41 -07:00
William Casarin 1f5f1e28a4 nostrdb: pull latest, adding flatcc and lmdb 2023-08-25 19:05:34 -07:00
William Casarin f30f93f65c Revert "Move the Block helper type to its own file"
This fixes the broken tests

This reverts commit 286ae68fd6.
2023-08-25 19:05:34 -07:00
William Casarin 16fa701509 v1.6 (17) 2023-08-23 17:48:32 -07:00
William Casarin 1d11bb40b5 v1.6 (16) 2023-08-23 13:30:38 -07:00
William Casarin 0338297bfe Live Music & Generic Statuses
Changelog-Added: Added live music statuses
Changelog-Added: Added generic user statuses
2023-08-23 13:26:55 -07:00
Grimless 286ae68fd6 Move the Block helper type to its own file
Collapse the various standalone functions for parsing block data, and
refactor consumers to initialize a Block with given data and access its
members as needed.

Closes: https://github.com/damus-io/damus/pull/1496
Signed-off-by: William Casarin <jb55@jb55.com>
2023-08-21 17:11:43 -07:00
Daniel D’Aquino dcb94635ea Fix text editing issues on characters added right after mention link
Changelog-Fixed: Fix text editing issues on characters added right after mention link
Closes: https://github.com/damus-io/damus/issues/1375
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Tested-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-08-20 17:25:06 -07:00
Fishcake 9104ddb051 add function to create nip98 http authorization header
Closes: https://github.com/damus-io/damus/pull/1471
Signed-off-by: William Casarin <jb55@jb55.com>
2023-08-20 16:29:33 -07:00
William Casarin d5b944170f actually build 15 because reasons 2023-08-20 11:25:01 -07:00
William Casarin 2e512317e7 v1.6 (13) 2023-08-18 10:10:18 -07:00
Daniel D‘Aquino 066b3cdde8 Fix image links appearing with escaped slashes
Changelog-Fixed: Fix images and links occasionally appearing with escaped slashes
Closes: https://github.com/damus-io/damus/issues/1468
Signed-off-by: Daniel D‘Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
Rewarded-sats: 50000
2023-08-18 08:41:21 -07:00
William Casarin 916f7d789e v1.6 (11) 2023-08-07 08:45:07 -07:00
William Casarin d4faacb99f relays: strip trailing / from relay urls
Fixes: https://github.com/damus-io/damus/issues/1443
Changelog-Fixed: Fix issue with slashes on relay urls causing relay connection problems
2023-08-06 09:07:33 -07:00
William Casarin 5b9803d234 script: add build-git-hash.txt build output
Otherwise we get warnings
2023-08-06 07:54:23 -07:00
William Casarin d489bcc586 test: add test for failing nostr report event 2023-08-06 06:56:24 -07:00
William Casarin c0f4e3fe03 v1.6 (9) 2023-08-03 17:25:52 -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 b556257edd util: add structured logger 2023-08-03 12:17:56 -07:00
Daniel D‘Aquino ef5a3030a6 Add unit tests surrounding creation of posts with non-latin hashtags, as well as the rendering of non-latin hashtag
Signed-off-by: Daniel D‘Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-08-03 12:17:32 -07:00
William Casarin d4aa8a5602 config: show git hash in version info
This will be useful for sanity checks and bisecting
2023-08-01 09:29:09 -07:00
William Casarin ff20cc4767 tests: enable code coverage 2023-07-31 03:25:50 -07:00
William Casarin b40c595a7c notify: switch over to new typesafe notifications 2023-07-30 11:02:44 -07:00
William Casarin 80063af19a notify: add typesafe notifications 2023-07-30 11:02:44 -07:00
William Casarin df3b94a1fc notify: add typesafe notify class 2023-07-30 11:02:44 -07:00
William Casarin 06a66a3709 add some type aliases to make the ndb move more incremental 2023-07-30 10:52:02 -07:00
Joel Klabo 480921db20 Suggested Users to Follow
ui: Add Suggested Users Views and Helpers
ui: Add Logic to Launch Suggested User Screen

Changelog-Added: Suggested Users to Follow
2023-07-29 10:25:24 -07:00
Suhail Saqan d11cd76e6a Add multiple reaction support
Changelog-Added: Add support for multiple reactions
Closes: https://github.com/damus-io/damus/issues/1335
2023-07-29 10:03:55 -07:00
William Casarin 2f8aa29e92 ndb: make NostrEvents immutable
Since we can't mutate NdbNotes, let's update the existing codebase to
generate and sign ids on NostrEvent constructions. This will allow us to
match NdbNote's constructor
2023-07-25 15:34:05 -07:00
William Casarin e34351ca37 ndb: fix iterators, pack id tags, more tests 2023-07-23 11:55:36 -07:00
William Casarin 7ec8da6c73 ndb: start implementing existing NostrEvent functionality
We eventually want to switch over to NdbNote instead of NostrEvent. To
facilitate this, the plan is to eventually make NostrEvent an alias of
NdbNote. For this to work, let's make sure the NostrEvent extensions are
implemented on NdbNote.

We will likely switch away from string properties as well, but for now
we will try to emulate as much as possible to make sure everything is
working first.
2023-07-22 17:19:47 -07:00
William Casarin 6d43754e71 ndb: add pubkey to NdbNote 2023-07-22 17:19:47 -07:00
William Casarin ad0e1f28b7 test: fix build and tests 2023-07-21 15:26:03 -07:00
William Casarin 61051ee853 nostrdb: add initial swift integration 2023-07-21 15:02:01 -07:00
William Casarin dc7826c4e5 c: add nostrdb c lib 2023-07-21 15:02:01 -07:00
William Casarin 4eee715bcd c: add jsmn json parser
This is used by the nostrdb lib. Let's add it here.
This doesn't unescape things, so we'll still need to do that manually.
2023-07-21 14:56:24 -07:00
William Casarin dd6c082a8e v1.6 (7) 2023-07-17 14:35:54 -07:00
William Casarin 12febf9671 view: extract ProfileEditButton to its own file
profile view file is getting cray cray
2023-07-17 13:25:56 -07:00
William Casarin 2c0296cce3 project: bump deployment target
not sure how this is different than the previous setting that was
updated.

Cc: Bryan Montz <bryanmontz@me.com>
2023-07-17 13:25:56 -07:00
William Casarin ff654c4e11 test: add text attribute testing function
This will be used for testing attributed strings
2023-07-17 10:25:09 -07:00
William Casarin fd59407171 test: fix old markdown tests 2023-07-17 10:25:09 -07:00
William Casarin cd7998b69d v1.6 (6) 2023-07-16 15:33:00 -07:00
William Casarin bd4c29604f Fix broken markdown renderer
This switches away from the old markdown renderer to the new one at
https://github.com/damus-io/swift-markdown-ui

Changelog-Fixed: Fix broken markdown renderer
2023-07-16 15:27:24 -07:00
William Casarin fc640b85ed add swift-markdown-ui
We will be using this lib which is much better than the builtin
framework for markdown rendering. We use a modified version that removes
html tag rendering which looks horrible.
2023-07-16 15:25:09 -07:00
William Casarin fb2a69acd8 project: fix test fixtures 2023-07-14 13:07:52 -07:00
Terry Yiu 8a9e3ea76b Fix localization issues and export strings for translation
Changelog-Fixed: Fix localization issues and export strings for translation
Signed-off-by: Terry Yiu <git@tyiu.xyz>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-07-14 09:34:29 -07:00
William Casarin 9879c78e41 build 5 because I broked something 2023-07-13 15:43:21 -07:00
William Casarin e36747a81a v1.6 (4) 2023-07-13 11:13:50 -07:00
William Casarin 17df2972d9 ui: add follow hashtag ui on search view 2023-07-13 11:08:04 -07:00
William Casarin 7b73a54de5 test: switch to test data file
We only added the file before, let's actually use it now
2023-07-13 07:32:27 -07:00
William Casarin 7046fe0d4f ui: add DamusBackground helper
We will be using this in more places
2023-07-13 06:56:23 -07:00
William Casarin 69922b1d77 Remove LoadMoreButton
Was an old unused thing
2023-07-12 08:21:44 -07:00
William Casarin 7f9371d85f v1.6 (3) 2023-07-11 12:58:15 -07:00
William Casarin 031c7823ae refactor: move hashtag tests to their own file 2023-07-11 07:21:16 -07:00
William Casarin 45d9121ed7 fix project issues 2023-07-10 20:56:52 -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
William Casarin 4d995fd04c Longform Notes 2023-07-10 17:39:13 -07:00
William Casarin 518886912c refactor: carve out TextEvent body into EventShell
We'll need this for other event types
2023-07-10 17:39:13 -07:00
Joel Klabo bf95a8b328 Banner Image Upload
Changelog-Added: Enable banner image editing
2023-07-10 17:27:42 -07:00
William Casarin 15d633a42f project: update to recommend settings 2023-07-10 11:08:20 -07:00
Terry Yiu 140c3505ba
Update translations 2023-07-09 15:36:35 -04:00
Bryan Montz 51d71f11c1 replace RelayMetadatas with RelayModelCache in DamusState
Signed-off-by: Bryan Montz <bryanmontz@me.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-07-09 07:40:39 -07:00
Bryan Montz f619fef410 add RelayModel and RelayModelCache classes
Signed-off-by: Bryan Montz <bryanmontz@me.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-07-09 07:40:39 -07:00
Bryan Montz ef4aeb40e0 add RelayLog class
Signed-off-by: Bryan Montz <bryanmontz@me.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-07-09 07:40:39 -07:00
Bryan Montz ebcfe3c25f add developer mode view and setting
Signed-off-by: Bryan Montz <bryanmontz@me.com>
2023-07-07 09:02:52 -07:00
William Casarin 3451e7d88f v1.6 2023-07-04 12:18:33 -07:00
William Casarin a04a401292 nscript: load script view
This allows you to open and run scripts for testing purposes, but only
from external links such as nostr:nscript...
2023-07-04 11:48:27 -07:00
William Casarin 30e33a01c1 nostrscript: add a helper function 2023-07-03 16:59:50 -07:00
William Casarin 97f10e865f NostrScript
NostrScript is a WebAssembly implementation that interacts with Damus.
It enables dynamic scripting that can be used to power custom list views,
enabling pluggable algorithms.

The web has JavaScript, Damus has NostrScript. NostrScripts can be
written in any language that compiles to WASM.

This commit adds a WASM interpreter I've written as a mostly-single C
file for portability and embeddability. In the future we could
JIT-compile these for optimal performance if NostrScripts get large and
complicated. For now an interpreter is simple enough for algorithm list
view plugins.

Changelog-Added: Add initial NostrScript implementation
Signed-off-by: William Casarin <jb55@jb55.com>
2023-07-03 14:31:38 -07:00
Terry Yiu 6e964f71ff Add trie-based user search cache to replace non-performant linear scans
Changelog-Added: Speed up user search
Tested-by: William Casarin <jb55@jb55.com>
Fixes: #1219
Closes: #1342
2023-07-03 12:06:01 -07:00
Bryan Montz 7cd3aef157 Updated test target to deployment target of iOS 16.0
Changelog-Updated: Bumped minimum verison to iOS 16.0
Signed-off-by: Bryan Montz <bryanmontz@me.com>
2023-07-02 13:03:13 -07:00
Scott Penrose f0b0eade37 Convert to NavigationStack
- Fixes linking issues on SideMenu and tab switching issues
- I currently bumped to iOS 16+ to get iterate and get this working.
2023-06-30 06:42:56 -07:00
William Casarin 82c53e43e5 v1.5 (8) 2023-06-27 06:30:50 +02:00
William Casarin 1e2326cccf v1.5 (7)
rip zap button
2023-06-27 05:35:53 +02:00
Terry Yiu 422167f7aa Add indication of followers you know in a profile
Changelog-Added: Add indication of followers you know in a profile
2023-06-25 09:38:57 +02:00
William Casarin b70bf1f647 v1.5-6 2023-06-25 09:38:46 +02:00
William Casarin a641f972ff v1.5-5 2023-06-24 08:38:02 +02:00
William Casarin 337c4de337 reduce ContentView redraws
Remove observability from the home model, and use inner models for
updating specific parts of the UI, such as notification dots on the tab
bar.
2023-06-23 11:51:51 +02:00
William Casarin e885f38c54 refactor: switch CustomizeZapView to use a model
Changelog-Fixed: Fix CustomizeZapView from randomly disappearing
2023-06-23 11:51:51 +02:00
William Casarin 4d43e590e0 view: Add ZapUserView
This will be used to make it clear that we are zapping a user
2023-06-22 10:23:56 +02:00
William Casarin 6ec533b0cd view: Add AboutView
This will be used by different views for the user's about section
2023-06-20 17:00:48 +02:00
Bryan Montz 296d96d6df rename RelayStatus to RelayStatusView 2023-06-20 10:18:34 +02:00
William Casarin bcdd0b4e23 Revert "Add Inter font"
This reverts commit 271e3ad54a.
2023-06-12 11:25:27 +02:00
Ben Weeks 271e3ad54a Add Inter font
ChangeLog-Changed: Switch to new font (Inter)
2023-06-10 12:38:13 +02:00
William Casarin 043eb5b436 Show zap comments in threads and show top zap
Changelog-Added: Top zaps
Changelog-Added: Show zap comments in threads
2023-06-09 10:11:25 +02:00
Terry Yiu 8ca377bec9
Add max length truncation to displayed profile attributes to mitigate spam
Changelog-Fixed: Add max length truncation to displayed profile attributes to mitigate spam
Fixes: #1237
2023-06-04 17:50:52 -04:00
Terry Yiu 952d6746d5 Add profile zaps
Refactor profile zaps to reuse same BOLT11 Lightning invoice logic as
note zaps, which fixes profile zaps from Cash App and Muun wallets

Changelog-Added: Add profile zaps
Changelog-Fixed: Fix profile zapping for Muun and Strike wallets
Closes: #1236
Fixes: #1067
2023-06-04 10:56:43 -07:00
William Casarin 809a08ef63 v1.5 (3) 2023-05-30 19:40:37 -07:00
William Casarin 57e6f083b8 Revert "Updated UI to use custom font"
This reverts commit 020a00bf7e.
2023-05-30 19:35:21 -07:00
William Casarin 6aa28fce6c v1.5-2 2023-05-30 18:04:21 -07:00
William Casarin 88b04fde09 xcode: remove .git ext from package 2023-05-30 17:58:48 -07:00
William Casarin 6214ab8d8f video: add DamusVideoPlayer view 2023-05-29 17:11:14 -07:00
William Casarin 4d95d36a1e Add GSPlayer + VideoPlayer 2023-05-29 17:10:14 -07:00
Ben Weeks 06ba0f7387 Add ability to show multiple posts per user in Universe
ChangeLog-Added: Add ability to show multiple posts per user in Universe
Closes: #1198
Fixes: #1189
2023-05-29 15:35:29 -07:00
ericholguin 90c22fdabd components: added reusable gradient button style 2023-05-29 14:38:24 -07:00
ericholguin dfd1032cd8 gradients: add pink gradient 2023-05-29 14:38:24 -07:00
ericholguin a0e1e16f17 gradients: add damus logo gradient 2023-05-29 14:38:24 -07:00
Ben Weeks 020a00bf7e Updated UI to use custom font
Changelog-Changed: Updated UI to use custom font
2023-05-29 14:38:24 -07:00
Bryan Montz ea73c5252d Merge branch 'master' into user-cache 2023-05-26 06:46:47 -05:00
Bryan Montz 812213ff2b Add Damus splash screen
Changelog-Updated: Add Damus splash screen
2023-05-24 15:17:08 -07:00
William Casarin bffa42a13a Supporter Badges 2023-05-15 11:57:37 -07:00
William Casarin af912b1a0e v1.5-1 2023-05-15 09:59:22 -07:00
William Casarin 1313880574 Add release Damus build scheme 2023-05-14 10:49:54 -07:00