This PR adds a button to allow users to easily connect to Coinos
Also cleans up and organizes assets.
Changelog-Added: Coinos connection button in Wallet view
Signed-off-by: ericholguin <ericholguin@apache.org>
This commit implements profile image cropping and optimization, as well
as a major refactor on EditPictureControl.
It now employs the following techniques:
- Users can now crop their profile pictures to fit a square aspect
ratio nicely and avoid issues with automatic resizing/cropping
- Profile images are resized to a 400px by 400px image before sending it
over the wire for better bandwidth usage
- Profile pictures are now tagged as such to the media uploaders, to
enable media optimization or special care on their end.
Integrating the cropping step was very difficult with the previous
structures, so `EditPictureControl` was heavily refactored to have
improved state handling and better testability:
1. Enums with associated values are being used to capture all of the
state in the picture selection process, as that helps ensure the
needed info in each step is there and more clearly delianeate
different steps — all at compile-time
2. The view was split into a view-model architecture, with almost all of
the view logic ported to the new view-model class, making the view
and the logic more clear to read as concerns are separated. This also
enables better testabilty
Several automated tests were added to cover EditPictureControl logic and
looks.
Closes: https://github.com/damus-io/damus/issues/2643
Changelog-Added: Profile image cropping tools
Changelog-Changed: Improved profile image bandwidth optimization
Changelog-Changed: Improved reliability of picture selector
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit adds the SwiftyCrop dependency, to provide users with a way
to crop their profile images prior to upload
- Dependency version is commit-hash-locked for extra security and
reproducibility
- Reviewed code contents of the library to check for any user tracking
code. None was found
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Turn on strict concurrency checks on the compiler to make potential
concurrency issues more visible and aid during debugging, as well as to
start preparing us for Swift 6.
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit adds an automated UI test to check if the edit banner button
UI is clickable and not hidden behind a top bar or another invisible
element.
It also improves accessibility support for some elements on login and
top bar.
Changelog-Changed: Improved accessibility support on some elements
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit fixes build errors caused by logical merge issues from
changes that worked in isolation but not when combined.
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This PR change adds Damus Share feature to the app that allows the users to share Photos and URLs from foreign apps.
Changelog-Added: Add Damus Share Feature
Signed-off-by: Swift Coder <scoder1747@gmail.com>
1. Removed the dependency on finding the profile event for displaying actions to the user, even if the full profile couldn't be loaded. This allowed showing useful options such as the option to follow that pubkey.
2. Opened a profile preview sheet instead of navigating to the full profile page, enabling quick actions and saving bandwidth by not loading their timeline immediately.
3. Refactored most of that view to simplify state management and make it less prone to errors.
4. Improved error handling and management.
5. Ensured the view truly reflected the internal state of the scanner to the user.
Changelog-Fixed: Fixed some issues where QR code would not work, and improved UX
Closes: https://github.com/damus-io/damus/issues/2032
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit makes several improvements to video coordination,
and implements a new video control view.
The video support stack in Damus has been re-architected to achieve
this.
The new architecture can be summarized as follows:
1. `DamusVideoCoordinator` is a singleton object in `DamusState`, and it
is responsible for deciding which video should have the "main stage"
focus, based on main stage requests that video player views make when
they become visible.
Having "main stage" focus means that the coordinator will auto-play
that video and pause others, and is used throughout the app to
determine which video to talk to or control, in the case of app-wide
controls (analogous to how Apple Music needs to know which song is
playing for displaying playback controls on the iOS home screen)
Having a singleton take care of this establishes
clear ownership and prevents conflicts such as double-playing video.
This coordinator also holds a pool of video media items (`DamusVideoPlayer`),
with exactly ONE `DamusVideoPlayer` per URL, to reduce
bandwidth and ensure perfect syncing of the same video in different
contexts.
2. `DamusVideoPlayer` objects hold the actual media item (video data, playback state),
much like `AVPlayer`.
In fact, `DamusVideoPlayer` can be described as a wrapper for `AVPlayer`,
except it has an interface that is much more SwiftUI friendly,
enabling playback state syncing with minimal effort.
`DamusVideoPlayer` is NOT a view. And there is only ONE `DamusVideoPlayer`
per URL — held by the coordinator.
However, when the app needs to display that same video in multiple
places, the app can instantiate multiple video player VIEWS of the
same `DamusVideoPlayer`
3. `DamusVideoPlayer.BaseView` is the most basic video player view for a
`DamusVideoPlayer` item. It has basically no features other than
showing the video itself.
4. `DamusVideoPlayerView` is the standard, batteries-included, video
player view for `DamusVideoPlayer` items, that is used throughout the
app.
It also tries to detect its own visibility, and makes requests to
`DamusVideoCoordinator` to take over the main stage when it becomes
visible.
5. `DamusVideoControlsView` is a view that presents video playback
controls (play/pause, mute, scrubbing) for a `DamusVideoPlayer`
object.
How a `DamusVideoPlayerView` gains and loses main stage focus:
1. `DamusVideoPlayerView` uses `VisibilityTracker` to find out when it
becomes visible or not
2. When it becomes visible, it makes a request to the video coordinator
to take main stage focus. The request also specifies which layer the
video view is in (Full screen layer? Normal app layer?), which the
video player view gets from the `\.view_layer_context` environment
variable set by `damus_full_screen_cover`
3. The coordinator (`DamusVideoCoordinator`) keeps all of these
requests, and uses its own internal logic and info to determine which
video should get the main stage.
The logic also depends on whether or not the app finds itself in full
screen mode.
Once the main stage is given to a different video, the previous video
is paused, the main-staged-video is played, and the requestor
receives a callback.
4. Once the video disappears from view, it tells the coordinator that it
is giving up the main stage, and the coordinator then picks another
main stage request again.
On top of this, several of other small changes and improvements were made,
such as video gesture improvements
Note: This commit causes some breakage over the image carousel sizing
logic, which will be addressed separately in the next commit.
Changelog-Fixed: Fixed iOS 18 gesture issues that would take user to the thread view when clicking on a video or unmuting it
Changelog-Fixed: Fixed several issues that would cause video to automatically play or pause incorrectly
Changelog-Fixed: Fixed issue where full screen video would disappear when going to landscape mode
Changelog-Added: Added new easy to use video controls for full screen video
Changelog-Changed: Improved video syncing and bandwidth usage when switching between timeline video and full screen mode
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit introduces new mechanisms to solve some issues with full screen support:
1. Full screen covers disappear when its caller disappears (e.g. when it
is an event in a lazy stack, and an orientation change causes the
view to disappear along with the full screen cover)
2. There are no mechanisms for views to determine whether they are being
presented under a full screen cover or not, and whether the device is
in full screen mode or not.
The commit overcomes the above limitations through the following:
1. A full screen cover on `ContentView` that can be accessed by any view
when calling `present(fullScreenItem)`
2. A new `damus_full_screen_cover` view modifier that automatically
tracks whether a device is in full screen mode or not, and allows
any descendant view in its hierarchy to introspect on which view
layer it is being presented in.
This commit lays a foundation that will later become important for
improving video coordination.
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit renames this class to better represent what it does.
This reduces some of the term overloading between this class and other video
controller classes/structs. (Such as AVPlayerController)
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit fixes an issue with the chat bubble view where it would
unexpectedly trigger the reaction emoji keyboard when scrolling or
swiping, which became specially sensitive on iOS 18.
The fix consists of 2 parts:
- Changing the long press gesture logic to better adhere to Apple's API specs
- Modify the SwipeActions library to allow the gesture priority to be
configurable, and demote the swiping gesture to have normal priority
(it was found that having a high-priority drag gesture prevents
long-presses from being activated)
Closes: https://github.com/damus-io/damus/issues/2577
Changelog-Fixed: Fix sensitive long-press gesture on event chat bubble in iOS 18
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This PR is a ux change to make the header, tabbar, and post button disappear when the user scrolls.
The main tabbar is now an overlay which means it will display over views, this was needed in
order to get the timeline to extend behind it. However, this mean we must add bottom padding to any
view where the main tabbar is present to account for the overlap.
Changelog-Added: Disappearing header, tabbar, and post button on scroll
Signed-off-by: ericholguin <ericholguin@apache.org>
This is needed because we already have a 1.10 build approved by Apple,
and they require a version number bump
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Pull some things from the 1.10 release branch into master:
Daniel D’Aquino (1):
Fix unclickable elements
William Casarin (4):
relays: add some ping/pong and connection logs
relay: don't reconnect when we don't have to
The introduction of iOS 18 brought a new bug that made `KFAnimatedImage`
not recognize tap gestures and become unclickable. (https://github.com/onevcat/Kingfisher/issues/2295)
This commit addresses the issue with a workaround found here:
https://github.com/onevcat/Kingfisher/issues/2046#issuecomment-1554068070
The workaround was suggested by the author of the library to fix a
slightly different issue, but that property seems to work for our
purposes.
The issue is addressed by adding a `contentShape` property to usages
of `KFAnimatedImage`, in order to make them clickable. A custom modifier
was created to make the solution less obscure and more obvious.
Furthermore, one empty tap gesture handler was removed as it was
preventing other tap gesture handlers on the image carousel from being
triggered on iOS 18
Testing
-------
PASS
Configurations:
- iPhone 13 mini on iOS 18.0
- iPhone SE simulator on iOS 17.5
Damus: This commit
Coverage:
- Check that the following views are clickable:
- Images in the carousel
- Profile picture on notes
- Profile picture on thread comments
- Profile picture on profile page
Changelog-Fixed: Fix items that became unclickable on iOS 18
Closes: https://github.com/damus-io/damus/issues/2342
Closes: https://github.com/damus-io/damus/issues/2370
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This PR adds the NDB search functionality from the pull down search in the
posting timeline to the universe view.
Changelog-Added: Added NDB search functionality to the universe view
Signed-off-by: ericholguin <ericholguin@apache.org>
This commit links localization data to the extension targets so that
those targets can successfully localize data
Testing
-------
PASS
Device: iPhone 13 Mini
Damus: This commit
iOS: 17.6.1
Setup:
- Staging environment
- Push notifications enabled and configured
Steps:
1. Send a zap without message to the device with push notifications setup
2. Ensure message appears localized, not a localization key (`zap_notification_no_message`)
3. Change language to Portuguese
4. Make a highlight via the extension. Ensure some or all of the UI elements are localized into Portuguese
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Closes: https://github.com/damus-io/damus/issues/2419
This commit adds an option that allows a user to choose a custom push
notification server, as well as the staging notify server, to help with testing
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit adds a highlighting extension for web pages. This works on
Safari, and can be used by selecting a text on a page and hitting the
share button at the bottom of the Safari UI
To make this possible, some refactoring was necessary:
1. Several sources were included in the extension bundle to provide access to DamusState, PostView, and the postbox
2. UIApplication.shared was replaced with `this_app`, which routes to UIApplication.shared on the main app bundle,
and routes to a bogus UIApplication() in the extension. This is needed because UIApplication.shared cannot be used on an extension.
3. Some items were moved to different files to facilitate the transition.
The extension itself uses PostView, and implements views for several edge cases, and tries to handle the note publishing process gracefully.
Changelog-Added: Add highlighter for web pages
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit implements rendering comments from the `["comment",
<COMMENT_TEXT>]` tag in a highlight note.
Comment contents get rendered like a kind 1 note's "content" field
This commit also adds the `r` "reference" tag as a standard tag reference type
Changelog-Added: Add support for rendering highlights with comments
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This is an attempt to fix various issues when acquiring a IPC
semaphore on iOS
See: https://github.com/damus-io/damus/issues/2323#issuecomment-2323181204
Running this patch gives us these names:
mdb_env_setup_locks: using semnames
'group.com.damus/MDBrwDDi_FHxD' (29),
'group.com.damus/MDBwwDDi_FHxD' (29)
From old Apple docs:
> IPC and POSIX Semaphores and Shared Memory
>
> Normally, sandboxed apps cannot use Mach IPC, POSIX semaphores and
> shared memory, or UNIX domain sockets (usefully). However, by specifying
> an entitlement that requests membership in an application group, an app
> can use these technologies to communicate with other members of that
> application group.
>
> Note: System V semaphores are not supported in sandboxed apps.
>
> UNIX domain sockets are straightforward; they work just like any other
> file.
>
> Any semaphore or Mach port that you wish to access within a sandboxed
> app must be named according to a special convention:
>
> POSIX semaphores and shared memory names must begin with the application
> group identifier, followed by a slash (/), followed by a name of your
> choosing.
>
> Mach port names must begin with the application group identifier,
> followed by a period (.), followed by a name of your choosing.
>
> For example, if your application group’s name is
> Z123456789.com.example.app-group, you might create two semaphores named
> Z123456789.myappgroup/rdyllwflg and Z123456789.myappgroup/bluwhtflg. You
> might create a Mach port named
> Z123456789.com.example.app-group.Port_of_Kobe.
>
> Note: The maximum length of a POSIX semaphore name is only 31 bytes, so
> if you need to use POSIX semaphores, you should keep your app group
> names short.
Link: https://github.com/damus-io/damus/issues/2323#issuecomment-2323305949
Signed-off-by: William Casarin <jb55@jb55.com>
mdb_env_setup_locks: using semnames
'group.com.damus/MDBrwDDi_FHxD' (29),
'group.com.damus/MDBwwDDi_FHxD' (29)
From old Apple docs:
> IPC and POSIX Semaphores and Shared Memory
>
> Normally, sandboxed apps cannot use Mach IPC, POSIX semaphores and
> shared memory, or UNIX domain sockets (usefully). However, by specifying
> an entitlement that requests membership in an application group, an app
> can use these technologies to communicate with other members of that
> application group.
>
> Note: System V semaphores are not supported in sandboxed apps.
>
> UNIX domain sockets are straightforward; they work just like any other
> file.
>
> Any semaphore or Mach port that you wish to access within a sandboxed
> app must be named according to a special convention:
>
> POSIX semaphores and shared memory names must begin with the application
> group identifier, followed by a slash (/), followed by a name of your
> choosing.
>
> Mach port names must begin with the application group identifier,
> followed by a period (.), followed by a name of your choosing.
>
> For example, if your application group’s name is
> Z123456789.com.example.app-group, you might create two semaphores named
> Z123456789.myappgroup/rdyllwflg and Z123456789.myappgroup/bluwhtflg. You
> might create a Mach port named
> Z123456789.com.example.app-group.Port_of_Kobe.
>
> Note: The maximum length of a POSIX semaphore name is only 31 bytes, so
> if you need to use POSIX semaphores, you should keep your app group
> names short.
Link: https://github.com/damus-io/damus/issues/2323#issuecomment-2323305949
Signed-off-by: William Casarin <jb55@jb55.com>
This commit adds a highlighting extension for web pages. This works on
Safari, and can be used by selecting a text on a page and hitting the
share button at the bottom of the Safari UI
To make this possible, some refactoring was necessary:
1. Several sources were included in the extension bundle to provide access to DamusState, PostView, and the postbox
2. UIApplication.shared was replaced with `this_app`, which routes to UIApplication.shared on the main app bundle,
and routes to a bogus UIApplication() in the extension. This is needed because UIApplication.shared cannot be used on an extension.
3. Some items were moved to different files to facilitate the transition.
The extension itself uses PostView, and implements views for several edge cases, and tries to handle the note publishing process gracefully.
Changelog-Added: Add highlighter for web pages
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit implements rendering comments from the `["comment",
<COMMENT_TEXT>]` tag in a highlight note.
Comment contents get rendered like a kind 1 note's "content" field
This commit also adds the `r` "reference" tag as a standard tag reference type
Changelog-Added: Add support for rendering highlights with comments
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
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>
This commit changes the thread view to a new UX concept where children views of the selected view are now presented as chat bubbles, and the entire tree of conversation is shown flattened. New interactions, layout, and design changes have been introduced to revamp the user experience.
Testing
-------
Device: A mix of iPhone physical devices and simulator
iOS: A mix of iOS 17 versions
Damus: A mix of versions leading up to this one.
Coverage:
1. Unit tests are passing
2. A select few users have been using prototypes versions of this as their daily driver
3. Layout tested with an eclectic mix of threads
4. Posting new notes to the thread works
5. Clicking on reply quote view takes user to the mentioned message with a momentary visible highlight
6. Swipe actions work
7. Long press on chat bubbles works and shows emoji selector. Adding emoji sends the reaction
8. Clicking on notes selects them with an easy to follow transition
Known issues:
1. The text on the reply quote view occasionally appears to be off-center (in about 10% of occurrences). The cause is still unknown
2. Long press will still show the emoji keyboard even if user is on "onlyzaps" mode
3. Quoted events are not rendered on chat bubbles. When user posts a quoted event with no text, that could lead to confusion
Closes: https://github.com/damus-io/damus/issues/1126
Changelog-Added: Completely new threads experience that is easier and more pleasant to use
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit moves the device token logic to a new
PushNotificationClient, to move complexity from this specific feature
away from damusApp.swift
This commit also slightly improves the handling of device tokens, by
caching it on the client struct even if the user is using local
notifications, so that the device token can be sent to the server immediately after
switching to push notifications mode.
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Reviewed-by: William Casarin <jb55@jb55.com>
When a user is following several accounts, they may get a stale feed
caused by the subscription request being rejected by relays (due to max filter item limits).
This commit implements a fix that gets around the issue by
creating several chunked filters for the home feed event and contact
metadata subscriptions.
This is a short to medium-term practical fix, where we get around the
practical limitations imposed by most relays. In the future we should
work on longer-term solutions, which will likely require protocol improvements
Main Test
---------
Procedure:
1. Login with Elsat's npub (Or some account that follows about 2K people)
2. Check the home feed. There should be fresh notes.
REPRO:
Device: iPhone 15 simulator
iOS: 17.4
Damus: 1.9 (3) (0d9954290a)
Results:
- No fresh notes, most recent post is from several hours ago (Feed is stale)
FIX TEST:
Device: iPhone 15 simulator
iOS: 17.4
Damus: This commit
Results:
- Fresh notes appear, most recent post is from a few seconds ago.
Other testing:
--------------
- New automated test passing
- All other automated tests passing
- Tested scrolling down the feed on these conditions:
- Device: iPhone 13 Mini
- iOS: 17.4.1
- Accounts:
- One with about 160 contacts and 10 relays (Daniel D’Aquino)
- One with about 1K+ contacts and 9 relays (Freedom Smuggler)
- One with about 981 contacts and 6 relays (jb55)
- Elsat's account (2K+ accounts and 8 relays)
- Result: None of those were stale
Changelog-Fixed: Fix stale feed issue when follow list is too big
Closes: https://github.com/damus-io/damus/issues/2194
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Reviewed-by: William Casarin <jb55@jb55.com>
This removes EventRefs alltogether and uses the form we use in Damus
Android.
This simplifies our ThreadReply logic and fixes a reply-to-root bug
Reported-by: NotBiebs <justinbieber@stemstr.app>
Changelog-Fixed: Fix thread bug where a quote isn't picked up as a reply
Signed-off-by: William Casarin <jb55@jb55.com>