This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix Share Screen Crash on iPad #48220
Merged
auto-submit
merged 10 commits into
flutter-team-archive:main
from
LouiseHsu:louisehsu/fix-share-screen-crashh-on-ipad
Nov 22, 2023
Merged
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
52a11ea
initial commit
LouiseHsu 2d678fa
formatting
LouiseHsu 4a65fdd
Merge branch 'main' into louisehsu/fix-share-screen-crashh-on-ipad
LouiseHsu 3b171dc
add positioning for ipad share menu
LouiseHsu d7a55b5
Merge branch 'louisehsu/fix-share-screen-crashh-on-ipad' of github.co…
LouiseHsu 7e72f93
add todo
LouiseHsu ae1880d
fix for RTL language, more TODOs
LouiseHsu 20a8f10
Merge branch 'main' into louisehsu/fix-share-screen-crashh-on-ipad
LouiseHsu 12e23aa
fix naming, update comments
LouiseHsu 0017713
Merge branch 'louisehsu/fix-share-screen-crashh-on-ipad' of github.co…
LouiseHsu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,6 +158,16 @@ - (void)showShareViewController:(NSString*)content { | |
| UIActivityViewController* activityViewController = | ||
| [[[UIActivityViewController alloc] initWithActivityItems:itemsToShare | ||
| applicationActivities:nil] autorelease]; | ||
|
|
||
| if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { | ||
| activityViewController.popoverPresentationController.sourceView = engineViewController.view; | ||
| activityViewController.popoverPresentationController.sourceRect = | ||
| CGRectMake(CGRectGetWidth(engineViewController.view.bounds) / 2, | ||
| CGRectGetHeight(engineViewController.view.bounds) / 2, 0, 0); | ||
| activityViewController.popoverPresentationController.permittedArrowDirections = | ||
| UIPopoverArrowDirection(); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this won't work for RTL language. possibly crash due to negative width
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, would it help if i just wrapped in abs() ? I dont know what rtl language is
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RTL = right-to-left, e.g. arabic/hebrew |
||
|
|
||
| [engineViewController presentViewController:activityViewController animated:YES completion:nil]; | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
UIKit uses this rect to tell where the pop over should be presented. This should be the rect of the selected text
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.
Yeah, but we would have to pass in the rect size/coords from the framework, and then add logic to make sure that the view is being rendered either above/below/next to the text so that it's not clipping off the screen depending on the position of the text and the current view bounds... which is totally doable but since this is a fatal crash I wanted to get it at least non-crashing as soon as possible
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.
Never mind, looks like the positioning is automatically handled 👀 will update this PR