This commit adds region-specific relays for Thailand and Germany. The list was blindly copied and pasted from the tickets.
Testing
-------
Device: iPhone 15 Pro simulator
iOS: 17.0.1
Damus: A locally modded version combining these changes with changes made in #1730 (A bit hacky, but makes testing faster)
Steps:
1. Change region to Canada. Only international relays should be shown in recommended relay list. PASS
2. Change region to Japan. International + Japanese relays should be shown in the recommended list. PASS
3. Repeat step (2) for Thailand and Germany. International + corresponding regional relays should be shown. PASS
Changelog-Added: Add regional relays for Thailand
Closes: https://github.com/damus-io/damus/issues/1698
Changelog-Added: Add regional relays for Germany
Closes: https://github.com/damus-io/damus/issues/1750
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
This change was made so that NostrDB data can be accessed from different build targets such as the notification service extension.
Upon initialization of NostrDB, it will check both DB file locations (the old documents directory, and the new shared app group container). If it sees the DB is present on the old location, and not on the new location, it will move the files to the new location. In any other condition it will keep the files intact to prevent data loss.
In order to avoid any conflicts between the damusApp's Ndb instance and the extension's Ndb instance when writing or moving the file, a new parameter called "owns_db_file" was added, and set to "false" for the extension. This ensures that the extension will not attempt to move DB files or create a new DB file on its own. Only the main app can move or create the DB file.
Testing
-------
PASS
Device: iPhone 15 Pro simulator
iOS: 17.0.1
Damus: This commit
Steps:
1. Run with the debugger attached to the extension target.
2. Using Apple's push notification testing dashboard, send a test push notification with a real payload (that includes the nostr event under `nostr_event`. Payload generated by strfry-push-notify).
3. Watch logs. It should show a message like "Got push notification from <DISPLAY_NAME>", where `DISPLAY_NAME` is the correct profile name of the user who generated the event. PASS
Regression testing
------------------
Device: iPhone 13 Mini (Real device)
iOS: 17.1.1
Damus: This commit
Other preconditions:
- Damus is at 1.6 (29) at the start of the test
- NostrDB filled with real data on the old location
Steps:
1. Flash (upgrade) the new Damus version (this commit) (This will be the first time upgrading, shared file container is empty)
2. Try to use the app normally. Scroll and navigate to several locations. Interact with some notes. App should be stable, work, and appear to have profile names already (i.e. It shouldn't start with a bunch of npubs in the place of profile names on known contacts). PASS
3. Downgrade back to the App store version (v1.6 (29))
4. Try to use the app normally. Scroll and navigate, interact, etc. App should work and be stable, but profile name cache is expected to be lost (i.e. shows npubs for a bit until profile is reloaded into NostrDB). PASS
5. Upgrade app again to the version in this commit.
6. Repeat step 2. Everything should work as normal and all profiles should be preloaded from the start. PASS
Closes: https://github.com/damus-io/damus/issues/1744
This change includes several source files related to NostrDB into the extension target as well, so that we can use it from that context (and thus enable more advanced push notification formatting and suppression)
To make this change possible, I had to split some source files as well as to move some functions to different files, to ensure we don't have to pull too much unnecessary code into the extension.
Testing
-------
PASS
Device: iPhone 15 Pro simulator
iOS: 17.0.1
Damus: This commit
Test steps:
1. Build DamusNotificationService. Should succeed. PASS
2. Build Damus (the app). PASS
3. Run app, scroll around some notes, go to a few different views, post a note. Should work as normal. PASS
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>
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>
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
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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.
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
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>