Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share: update shortUrl on demand, if needed, when sharing an url #963

Merged
merged 10 commits into from
Mar 12, 2024

Conversation

Gio2018
Copy link
Collaborator

@Gio2018 Gio2018 commented Mar 11, 2024

Summary

  • This PR fetches shortUrl if it's nil before sharing an item, in order to ensure we share shortUrl every time we can

References

  • Branch name

Implementation Details

  • Add graphQl query to fetch an Item's shortUrl
  • Use it to update shortUrl if nil, when sharing an item: this can happen when users migrate from previous versions to 8.5.0

Test Steps

  • Install the production (App Store) version and perform a refresh
  • Within 5 minutes, install this branch as an upgrade (do not delete the prod version)
  • Put a breakpoint where the share logic happens, for example here
  • verify that shortUrl is nil
  • put another breakpoint here and verify that the shortUrl has been fetched and assigned to the corresponding item
  • verify that share works properly, and that you are actually sharing a pocket.co url

PR Checklist:

  • Added Unit / UI tests
  • Self Review (review, clean up, documentation, run tests)
  • Basic Self QA

@Gio2018 Gio2018 changed the title Feat/pocket 9718 refresh short url on upgrade Share: update shortUrl on demand, if needed, when sharing an url Mar 11, 2024
@Gio2018 Gio2018 self-assigned this Mar 11, 2024
@Gio2018 Gio2018 added the share label Mar 11, 2024
@Gio2018 Gio2018 marked this pull request as ready for review March 11, 2024 21:35
@Gio2018 Gio2018 requested a review from bassrock as a code owner March 11, 2024 21:35
Copy link
Contributor

@bassrock bassrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving, but have a few questions around the async behavior

self.shortUrl = url
} else {
Task {
self.shortUrl = try? await source.getItemShortUrl(item.givenURL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a risk of no short url by the time the user saves?

Copy link
Collaborator Author

@Gio2018 Gio2018 Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see slack discussion, short answer: probably not a lot of real world cases, except offline users sharing via airdrop, where we would share the original url anyway.

self?.share(sharedWithYouItem, at: indexPath, with: sender)
}],
Task {
await self?.share(sharedWithYouItem, at: indexPath, with: sender)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work since its ui and needs main thread?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does because HomeViewModel is marked as @MainActor

@Gio2018 Gio2018 force-pushed the feat/POCKET-9718-refresh-shortUrl-on-upgrade branch from a652cc4 to d71a5a9 Compare March 12, 2024 18:08
@Gio2018 Gio2018 merged commit 6730377 into develop Mar 12, 2024
2 of 4 checks passed
@Gio2018 Gio2018 deleted the feat/POCKET-9718-refresh-shortUrl-on-upgrade branch March 12, 2024 22:35
Copy link

sentry-io bot commented Mar 24, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ App Hanging: App hanging for at least 2000 ms. HomeViewController View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants