Skip to content

fix(ios): populate missing linkMetadata values from URL fetch#1737

Open
MathieuWhite wants to merge 1 commit intoreact-native-share:mainfrom
MathieuWhite:main
Open

fix(ios): populate missing linkMetadata values from URL fetch#1737
MathieuWhite wants to merge 1 commit intoreact-native-share:mainfrom
MathieuWhite:main

Conversation

@MathieuWhite
Copy link
Copy Markdown

Overview

  • Defer UIActivityViewController initialization and presentation until the LPMetadataProvider fetch completes, so fetched values can fill in any missing fields in the custom linkMetadata before the delegate is called
  • Remove fetchMetadataForURL calls from itemForActivityType which were triggering redundant concurrent fetches, once when UIActivityViewController was initialized and called the delegate, and again each time the user tapped an activity

Related to #1690

Test Plan

Tested using activityItemSources with a custom linkMetadata title and a URL placeholder on an iOS simulator.

  • Verified the share sheet presents with the custom title and the thumbnail fetched from the URL's metadata
  • Verified fetchMetadataForURL is no longer called redundantly from itemForActivityType
  • Verified RNShareActivityItemSource deallocates after the share sheet is dismissed with no leaked objects in the memory graph debugger

The following screenshots use the same activityItemSources options as the example included in this PR.

Before — original code: share sheet displays only the custom title with no thumbnail since the URL fetch completes after the delegate is called
before

After — with fix: share sheet displays both the custom title and the thumbnail fetched from the URL metadata since presentation is deferred until the fetch completes
after

- Defer UIActivityViewController initialization and presentation until the LPMetadataProvider fetch completes, so fetched values can fill in any missing fields in the custom linkMetadata before the delegate is called
- Remove fetchMetadataForURL calls from itemForActivityType which were triggering redundant concurrent fetches, once when UIActivityViewController was initialized and called the delegate, and again each time the user tapped an activity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant