Improve deep link handling on cold start #2026
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, if the app was not already running when the Safari action extension was used to open a post in the app, the post would open in the in-app Safari instead of using the Ice Cubes UI.
The action extension only worked well if Ice Cubes was already running but backgrounded when it was used.
This was because of the
hasConnection(with:)
check used to ensure that the current server has a federation relationship with the server the post is on.Early in app launch, the list of federated peers has not come back from the API request yet, so
hasConnection(with:)
was always returningfalse
.To fix, issue a request to fetch the peers as part of the URL handling process, before checking
hasConnection(with:)
to make the final navigation decision.As an optimization, only do this if
hasConnection(with:)
returnsfalse
initially -- if it returnstrue
, we already know a connection exists so no need to check again.