Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

closeWebView fixes for url_launcher #997

Merged
merged 5 commits into from
Feb 15, 2019
Merged

closeWebView fixes for url_launcher #997

merged 5 commits into from
Feb 15, 2019

Conversation

timtraversy
Copy link
Contributor

Fixing some unnoticed issues from #924. Moved the deallocation of the currentSession object to a closure that is called when the Safari VC is dismissed. Now it is deallocated if the closeWebView function is called, or if the user manually dismissed the VC.

I didn't notice any Android issues while testing. I think sometimes the simulator can take a while to launch a Web View and if it takes longer than 5 seconds it appears like there is a bug, but it is working fine for me.

@timtraversy timtraversy changed the title Url launch closer closeWebView fixes for url_launcher Dec 20, 2018
@KingIdee
Copy link

Please, when can we expect this to be merged. Please before the holidays... 🙏

@timtraversy timtraversy reopened this Feb 14, 2019
@timtraversy
Copy link
Contributor Author

timtraversy commented Feb 14, 2019

Sorry, had some problems rebasing this, not sure why it pinged everybody for review.
Close web view is still broken on iOS.

  [self.viewController presentViewController:self.currentSession.safari
	                                                 animated:YES
	                                              completion:^void() {
	                                                 weakSelf.currentSession = nil;
	                                              }];

This completion handles is called the moment the moment the VS finishes loading, so once the closeWebViewWithResult is called [self.currentSession close] does nothing because currentSession has already been set to nil.

To prevent a memory leak by never setting it to nil, I've added a closure to the FLTUrlLaunchSession so the VS is deallocated if the closeWebView function is called, or if the user manually dismisses the VC.

Other options for handling this: #1145, #1010

@cyanglaz cyanglaz assigned cyanglaz and unassigned cyanglaz Feb 14, 2019
Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

Need to add CHANGLOG and pubspec updates.

@mehmetf mehmetf merged commit 36c56ee into flutter:master Feb 15, 2019
@timtraversy timtraversy deleted the urlLaunchCloser branch February 15, 2019 16:33
andreidiaconu pushed a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
andreidiaconu added a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
karantanwar pushed a commit to karantanwar/plugins that referenced this pull request Feb 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants