1
0
mirror of git://jb55.com/damus synced 2024-09-16 02:03:45 +00:00
Commit Graph

2968 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
Daniel D’Aquino
878b1caa95 Fix onboarding post view not being dismissed
This commit fixes the issue where clicking "post" on the onboarding sheet does not dismisses itself under certain device/iOS combos.

The root cause is that the behavior of `dismiss` calls under a deeply nested view (i.e. not a direct subview of the sheet) is inconsistent depending on the device or iOS.

This fix does two things:
1. It upgrades the usage of `presentationMode` (which is deprecated) to the new `dismiss` API
2. It makes the onboarding sheet view (A direct subview of the sheet) to listen to signals from the post view and use that to also call `dismiss()`, which is explicitly supported by Apple in their docs (https://developer.apple.com/documentation/swiftui/environmentvalues/dismiss)

Testing
-------

PASS

Device: iPhone 13 mini (physical device)
iOS: 17.1
Damus: This commit (Local build, no local mods)
Setting: "Always show onboarding" is set to ON
Coverage:
1. Clicking "post" on onboarding post view publishes the post and dismisses the view. PASS
2. Clicking "cancel" on onboarding post view dismisses the view without publishing. PASS
3. Dragging the onboarding post view down dismisses the view without publishing. PASS
4. Making a normal post (I replied to a thread) still publishes the post and dismisses the normal post view sheet. PASS

Testing on other Device/iOS combos
---------------------------------

PASS

Preconditions:
- iPhone 15 Pro (simulator) on iOS 17.0.1
- iPhone SE 3rd gen (simulator) on iOS 16.4
Damus: This commit (Local build, no local mods)
Setting: "Always show onboarding" is set to ON
Coverage:
1. Clicking "post" on onboarding post view publishes the post and dismisses the view. PASS

Closes: https://github.com/damus-io/damus/issues/1726
Changelog-Fixed: Fix onboarding post view not being dismissed under certain conditions
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-11-20 08:35:37 -08:00
William Casarin
1fcbba5041 parser: fix url parse regression 2023-11-17 08:57:36 -08:00
William Casarin
20299615ba parser: always convert damus.io links to bech32 mentions
Update our note parse to always interpret damus.io links as bech32
mentions (nostr:npub...)

This means links will get converted to nostr: on post composition, and
if we ever see a link it will also get converted to nostr: visually

Changelog-Added: Always convert damus.io links to inline mentions
Fixes: https://github.com/damus-io/damus/issues/690
2023-11-17 08:09:28 -08:00
William Casarin
972a183ed8 damus-c: add cursor_skip helper
This is a cursor util for skipping over bytes
2023-11-17 08:07:53 -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
309cbaccce Manually update camera description translation
Just so we can get on the appstore.
2023-11-15 12:23:41 -08:00
William Casarin
d8640e2a1e Update Translations 2023-11-15 12:02:45 -08:00
William Casarin
bc330ab5de update nostrdb
to include potential ingester thread crash fix
2023-11-14 10:26:09 -08:00
William Casarin
41c76d9de0 tests: disable snapshot tests for now
Until they are working on macos and xcode cloud
2023-11-14 07:13:51 -08:00
William Casarin
eaaf802157 test: attempt to fix broken tests 2023-11-13 15:03:17 -08:00
William Casarin
bf59b5850c ci: remove xcode github action
We're using xcode cloud now which seems much more reliable
2023-11-13 15:02:00 -08:00
William Casarin
2585a375ab v1.6 (28) 2023-11-13 10:31:28 -08:00
William Casarin
29fa4ecf2e build: fix invalid function name 2023-11-13 10:31:28 -08:00
William Casarin
518fdffce9 ndb: potential fix for a crash in some nostrdb queries 2023-11-13 10:31:28 -08:00
William Casarin
289e051202 v1.6 (26) 2023-11-13 10:31:28 -08:00
Daniel D’Aquino
2a6c4d0b61 storage: Set more aggressive cache expiration values
I am setting the expiration values lower because it seems that the previous values were not keeping storage usage low enough.

Testing: Testing will be performed as a long-term test on Github issue #1689 (https://github.com/damus-io/damus/issues/1689)
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-11-11 20:23:37 -08:00
Daniel D’Aquino
386a28455a permissions: Update camera usage string to be more accurate
This changes the text that appears on the camera permission dialog, and makes it clear that camera access is also needed for the scanning of QR codes. This change was made to address a concern raised during the Apple app review process.

Testing
-------

PASS

Device: iPhone 13 Mini (physical)
iOS: 17.1
Damus: This commit
Special remarks: I locally modified the bundle identifier to be able to install a fresh copy of Damus from scratch and go through the prompt, without having to uninstall my own copy of Damus

Steps:
1. Install a fresh copy of Damus
2. On account creation, try to scan an nsec.
3. Make sure the camera usage prompt message is modified to the new string.

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-11-11 20:23:34 -08:00
Daniel D’Aquino
b2e555284b Add "Always show onboarding suggestions" developer setting
This commit adds a new setting that can be used by developers to test onboarding suggestions without having to make local changes to code or reinstall the app.

Testing
-------

Device: iPhone 15 Pro (Simulator)
iOS: 17.0.1
Damus: This commit
Coverage:
1. Starting the existing app under the default setting does not show onboarding suggestions
2. Turning the setting ON causes the app to show onboarding suggestions on every app restart
3. Turning the setting back OFF causes the app to no longer show onboarding suggestions

Changelog-Added: Add "Always show onboarding suggestions" developer setting
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-11-11 20:23:29 -08:00
William Casarin
cc385d3c3f nostrdb: add migration to fix local japanese profile names 2023-11-02 14:17:17 +09:00
ericholguin
2895c374c0 fix: relay filter button fix
Closes: https://github.com/damus-io/damus/pull/1678
Tested-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-11-02 13:21:19 +09:00
William Casarin
6863e74c0f nostrdb: fix japanese profile names not loading
update flatcc, including the patch that fixes japanese usenames

Changelog-Fixed: Fix japanese profiles names not loading
2023-11-02 10:20:40 +09:00
William Casarin
280d889f25 v1.6 (25) changelog 2023-10-31 10:27:55 +09:00
William Casarin
d1d830fca1 v1.6 (25) 2023-10-31 10:26:12 +09:00
Daniel D’Aquino
d2bb013db7 relays: automatically load extra regional bootstrap relays
Depending on user's locale. currently only supported for Japanese users.

This change allows Japanese users to automatically connect with popular
Japanese regional relays during account creation, thus allowing Japanese
users to better connect with the Japanese Nostr community.

More specifically, 3 Japanese regional relays will be automatically
added to the user's relay list (on top of the usual relays) under the
following conditions:

1. User's region (As configured in iOS settings) is Japan, AND
2. The user is creating a new Nostr account through Damus.

In the case the Nostr account is not new, Damus will not add any
regional relays (It will respect the user's relay list).

Testing
-------

PASS

Device: iPhone 15 Pro (Simulator)
iOS: 17.0.1
Damus: This commit
Test steps:

1. With the US region set, install Damus
2. Go through onboarding and create a new account.
3. Once the onboarding is complete, look at the connected relays. Should only be connected with popular international relays. PASS
4. Uninstall Damus
5. On iOS settings, go to Location & Region settings and change the region to Japan.
6. Install Damus
7. Go through onboarding and create a new account.
8. Once the onboarding is complete, look at the connected relays. User should be connected with intl relays as well as Japanese relays. PASS
9. Quit Damus and restart
10. Ensure the Japanese relays are still on the list. PASS
11. Quit Damus
12. Change region back to US
13. Restart Damus and check the relay list. Relay list should not be affected. PASS
14. Reinstall Damus
15. Check relay list. Only intl relays should be shown. PASS
16. Change region to Japan (JP)
17. Restart Damus and check the relay list. Relay list should not be affected. PASS
18. Reinstall Damus
19. This time, login with a pre-existing account (One that is not connected to Japanese relays).
20. After onboarding, check relay list. The relay list should be unaffected (i.e. Japanese relays should not have been added since this account is pre-existing). PASS

Note: The actual network connection with some of the Japanese relays
failed, but that is likely due to the Geo-based IP restrictions imposed
by some of those Japanese relays. The relay list has been copied
verbatim from @mattn's suggestions.

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

Changelog-Changed: Automatically load extra regional Japanese relays during account creation if user's region is set to Japan.
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-31 10:03:13 +09:00
ericholguin
c437a05ec0 ux: add long press to profile to navigate to profile page
Closes: https://github.com/damus-io/damus/pull/1665
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-30 11:59:13 +09:00
ericholguin
a2fdb61013 ui: change post view background to be all black
Closes: https://github.com/damus-io/damus/pull/1666
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-30 11:59:10 +09:00
ericholguin
4dd800e6b9 ui: make qrcode view font color white
Currently when in light mode the font is black which blends into the background
Changelog-Fixed: use white font color in qrcode view

Closes: https://github.com/damus-io/damus/pull/1653
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-30 11:59:07 +09:00
ericholguin
34c0728f21 ui: update the customize zap view
This PR updates the customize zap view by:

- replacing the old gradient button to the pink style
- show cursor on text field
- show textfield by default
- change custom zap grid to 4x2 instead of 3x3

Changelog-Changed: Updated customize zap view
Closes: https://github.com/damus-io/damus/pull/1656
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-30 11:58:36 +09:00
ericholguin
ec604664d8 ui: status view fixes for smaller screen devices
Changelog-Added: Tap to dismiss keyboard on user status view
Closes: https://github.com/damus-io/damus/pull/1652
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-10-27 09:21:43 +08:00
William Casarin
7710839261 noting: users are now notified when you quote repost them
Changelog-Changed: Users are now notified when you quote repost them
2023-10-27 09:02:05 +08:00
William Casarin
4389cc2128 load_profiles: add context for debugging
This is useful to see where the load_profiles request is coming from

We may need to switch to a central dispatch for profile loading, I
suspect there is a lot of redundancy between requests.
2023-10-24 13:02:41 +08:00
William Casarin
76508dbbfd perf: don't continuously attempt to fetch old profiles
Changelog-Changed: Save bandwidth by only fetching new profiles after a certain amount of time
2023-10-24 13:02:41 +08:00
Daniel D’Aquino
bbccc27a26 ui: Add setting that allows users to optionally disable profile action sheets.
Tested on iOS 17.0.1 on an iPhone 15 Pro simulator.

Closes: https://github.com/damus-io/damus/issues/1641
Changelog-Added: Add setting that allows users to optionally disable the new profile action sheet feature
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
Daniel D’Aquino
9969e70b5f ui: Add follow button to profile action sheet
Testing: Tested on iPhone 15 Pro simulator with iOS 17.0.1

Closes: https://github.com/damus-io/damus/issues/1636
Changelog-Added: Add follow button to profile action sheet
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
Daniel D’Aquino
692d29942b zaps: Implement single-tap zap on profile action sheet and fix zap fallthrough on default settings
This commit implements a single-tap zap on the profile action sheet and fixes an issue where zapping would silently fail on default settings if the user had no lightning wallet installed in their system.

Testing
-------

Configurations:
- iPhone 13 Mini (physical device) on iOS 17.0.2 with NWC wallet attached
- iPhone 15 Pro (simulator) on iOS 17.0.1 with no lightning wallet nor NWC

Damus: This commit

Coverage:
- Zapping using NWC connected wallet: PASS (Zaps and shows UX feedback of the completed action)
- Zapping under default settings and no lightning wallet: PASS (Shows the wallet selector invoice view)
- Long press on zap button brings custom zap view

Regression testing
------------------

Preconditions: iPhone 15 Pro (simulator) on iOS 17.0.1 with no lightning wallet nor NWC

Coverage:
- Zapping user on their full profile shows wallet selector. PASS
- On-post invoice shows wallet selector. PASS

Closes: https://github.com/damus-io/damus/issues/1634
Changelog-Changed: Zap button on profile action sheet now zaps with a single click, while a long press brings custom zap view
Changelog-Fixed: Fixed an issue where zapping would silently fail on default settings if the user does not have a lightning wallet preinstalled on their device.
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
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
a324523b85 ndb: new methods for profile fetched_at
This adds a few methods to Ndb for reading and writing fetched_at stats.
These are a way of tracking when we last tried to fetch profiles so that
we don't need to keep fetching them.
2023-10-23 10:44:54 +08:00
William Casarin
1cf898e0b2 ndb: update nostrdb
This includes the new profile fetched_at logic and reaction stats.

When receiving new profiles, nostrdb will record when it was last
received in a new database. This database is a mapping from Pubkey to
timestamp.

You can manually read/write to this table using:

ndb_read_last_profile_fetch
ndb_write_last_profile_fetch

This patch also includes the new reaction counting metadata table. It is
not used yet (but reactions are still counted!)

Changelog-Added: Added reaction counters to nostrdb
Changelog-Added: Record when profile is last fetched in nostrdb
2023-10-23 10:40:11 +08:00
William Casarin
502ceee6d4 ndb: update bindings
This adds new bindings from nostrdb related to tracking reaction stats.
We aren't using this yet but it's a part of the latest nostrdb update.
2023-10-23 10:39:27 +08:00
William Casarin
4f628ec733 Merge remote-tracking branch 'github/translations' 2023-10-23 09:18:45 +08:00
William Casarin
29915159db v1.6 (24) changelog 2023-10-22 14:27:56 +08:00
William Casarin
2b102671e5 smol fix 2023-10-22 10:41:36 +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
William Casarin
4ed79ff3c3 ui: reduce size of event menu hitbox
Changelog-Fixed: Reduce size of event menu hitbox
2023-10-22 10:40:29 +08:00
William Casarin
17331301da Clarified camera and mic usage strings
Fixes: https://github.com/damus-io/damus/issues/1628
2023-10-22 10:25:03 +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