-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Bugfix FXIOS-13855 [Share Manager] Add remoteURL capability to .file share types for the Send to Device activity #30194
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
Conversation
dicarobinho
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
💪 Quality guardian1 tests files modified. You're a champion of test coverage! 🚀 🥇 Perfect PR sizeSmaller PRs are easier to review. Thanks for making life easy for reviewers! ✨ 💬 Description craftsmanGreat PR description! Reviewers salute you 🫡 ❌ Per-file test coverage gateThe following changed file(s) are below 35.0% coverage:
Client.app: Coverage: 37.11
Generated by 🚫 Danger Swift against f85003b |
|
Thanks @dicarobinho for testing and updating the unit tests! 🎉 Opening this PR now. |
cyndichin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for adding this feature and all the clarifying comments 🔥 ~~ I added some thoughts I had while reviewing and some nits. Nothing blocking from my side.
I also followed the QA steps you listed and it looks good 👍 . Nice work!
|
|
||
| let activityItems = ShareManager.getActivityItems( | ||
| forShareType: .file(url: testFileURL), | ||
| forShareType: .file(url: testFileURL, remoteURL: nil), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to add tests for when remoteURL != nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I'll add this. Also, I'll look at adding some SendToDeviceActivity tests since I noticed we don't have any specific to custom app activities. It's a little different than the other share types.
| TelemetryWrapper.recordEvent(category: .action, method: .tap, object: .sharePageWith) | ||
| navigationHandler?.showShareSheet( | ||
| shareType: .file(url: fileURL), | ||
| shareType: .file(url: fileURL, remoteURL: remoteURL), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of passing in nil, could we set remoteURL: nil and add the comment here instead. Unless there is an existing case in which we want the value to not be nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh good catch, I'll remove the param and just set nil here with a comment now!
|
|
||
| // If we successfully got a temp file URL, share it like a downloaded file | ||
| return .file(url: fileURL) | ||
| return .file(url: fileURL, remoteURL: shareType.wrappedURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a bit confused at first since the wrappedURL is pulling from the url and not remoteURL in ShareType, but it seems this is in the right format so we use the existing shareType url for the new shared type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: Replied to the wrong comment, let me move what I'd said to the right chain!
Yeahhhhh I was a bit concerned the 2 URLs might be confusing. I am open to adjusting the naming or documentation anywhere I can to make this clearer. 🙏
The distinction here is that the wrapped file URL is always a file:// URL, whereas the remoteURL will always (if present) link to online web content (a https:// type URL).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you could elaborate why we are passing in the wrapped file in the remoteURL that would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, tryDownloadingTabFileToShare will download the PDF in the background when a user views an online PDF in the browser. Then, if the user tries to share the current tab, the share activity gets the file to attach to emails, iMessages, etc. But for Send to Device, we actually just want to send the link, not the downloaded file. So the shareType passed into tryDownloadingTabFileToShare is always a tab share and thus we can get the "remote URL" from the tab share's wrapped URL. I will add some comments to hopefully make this a little clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh okay that makes sense. Yeah I think if you add that, it will be a lot more helpful. Maybe adding this would help too? With a clarifying comment above?
let tabRemoteUrl = shareType.wrappedURL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I just finished restructuring this function and adding some comments. I think you'll find it a lot clearer now since it can only apply the logic to a tabURL and a ShareTabe instead of a generic ShareType. Will commit soon after I test! 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See if you think it's clearer now @cyndichin !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes much better!!! Thank you for restructuring it! 🥳
…ile-remote-url * mozilla/main: (45 commits) Bugfix FXIOS-13995 ⁃ Toggle for “Website Dark Mode” is labeled “Turn On Website Dark Mode” instead of using On/Off state (#30333) Revert FXIOS-13998 - "Add FXIOS-13799 - Update keyboard's accessory view for iOS 26 (#30058)" (#30334) Bugfix FXIOS-13771 ⁃ The initial menu needs to be scrolled (#30326) (Local AS flow) Nightly auto-update (146.0.20251101050307) (#30317) Bugfix FXIOS-13925 ⁃ [New Error Pages] [Accessibility] - Homepage items announced with voice over (#30292) Update Firefox icons from Acorn repo (#30323) Add FXIOS-13673 [Debug Menu] New item to remove credit card encryption keys for testing (#29656) Refactor FXIOS-12995 [Swift 6 Migration] Update NotificationCenter usage to use Notifiable pattern (part 1) (#30250 Add FXIOS-30299 [Stories Feed] Use standalone tab for stories web view (#30300) [no-ticket] Disable 18.x for Robo tests (#30303) Refactor FXIOS-12796 [Swift 6 Migration] Fix GleanPlumbMessageManager shared state warnings (#30286) Refactor FXIOS-12796 [Swift 6 Migration] Fix misc. missing "final" class warnings for `Sendable` conforming classes (#30287) Refactor FXIOS-13481 [Swift 6 Migration] Turn on Concurrency for ComponenetLibrary Tests in BrowserKit (#29763) Refactor FXIOS-13481 [Swift 6 Migration] Turn on Concurrency for OnboardingKitTests Tests in BrowserKit (#29775) Refactor FXIOS-13944 [Swift 6] remove nonisolated from unsubscribeFromRedux (#30276) Bump version to 145.1 Add FXIOS-13967 [Translations] toast UI for handling error messages (#30278) Add FXIOS-13648 [Trending Searches] initial recent searches UI (#30274) Bugfix FXIOS-13970 [Homepage] Blank homepage on iOS 15 (#30282) Bugfix FXIOS-13881 [iOS 26] [New first run onboarding] Add glass effect to default browser popup (#30071) ...
…tation for clarity.
|
@cyndichin I've addressed all your comments and added a bunch more tests! |
firefox-ios/firefox-ios-tests/Tests/ClientTests/Sharing/ShareManagerTests.swift
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now, way better!! Thank you!!! Seems like there may be a dupe in the tests? If it passes CI, then good to merge! Don't want to block ya since its towards my EOD.
7b18723 to
f85003b
Compare
Yep whoops, just noticed the dupe I pushed up before my meeting. It's fixed now! 😆 Always fun writing tests for really old code (Send to Device) lol. Thanks for the thorough review! 🙏 |
|
🚀 PR merged to |
📜 Tickets
Jira ticket
Github issue
💡 Description
New:
This PR addresses the issue in FXIOS-13855 where online PDFs viewed in a tab did not show "Send Link to Device" as a share option in the share sheet. This was by original design, but the code has been updated now to include a "remote URL" for
.filetype shares. This means online PDFs viewed in a tab can now be shared via this remote URL to other Firefox synced devices, like your desktop browser.Note that files shared from the Downloads Panel, or opened into a tab from the Downloads Panel, do not have a remote URL. That means "Send Link to Device" will not appear in the share options.
(Testing steps in ticket under QA notes)
Demo:
Share.Send.Link.to.Device.Demo.mov
Old:
Just a quick draft reference PR for discussion on #30059.
📝 Checklist