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

Fixing webviews not being cleared properly #718

Merged
merged 1 commit into from
Aug 7, 2020

Conversation

emawby
Copy link
Contributor

@emawby emawby commented Aug 5, 2020

Webviews were not being cleared properly if multiple were queued in a row. #606

In OneSignalWebView's showInApp method we were attempting to reuse navController and viewControllerForPresentation when opening webviews in the App. However the presentationController delegate lifecycle methods were not being properly called for the second webivew after removing the viewControllerForPresentation.view from its superview.

This was because upon clearing the navController its presentationController delegate would get reset, and we only set the delegate if the navController was nil. The fix is to always set the navController.presentationController.delegate = self


This change is Reviewable

@emawby emawby force-pushed the fix/second_webview_not_cleared branch from 9b48ad9 to ce02055 Compare August 5, 2020 22:42
@emawby emawby changed the title WiP Fixing webviews not being cleared properly Fixing webviews not being cleared properly Aug 5, 2020
Copy link
Contributor

@Jeasmine Jeasmine left a comment

Choose a reason for hiding this comment

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

LGTM nit comment

}
navController.presentationController.delegate = self;
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a comment to explain this? for the future 😬

Copy link
Member

Choose a reason for hiding this comment

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

This looks like a standard delegate setup, I am ok without having a comment in code
https://developer.apple.com/documentation/uikit/uipresentationcontroller/1618329-delegate

if (!viewControllerForPresentation.view.superview)
[mainWindow addSubview:[viewControllerForPresentation view]];
if (!viewControllerForPresentation.view.superview) {
[mainWindow addSubview:[viewControllerForPresentation view]];
Copy link
Contributor

Choose a reason for hiding this comment

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

is this well formatted?

Copy link
Member

Choose a reason for hiding this comment

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

ah yes, there is an extra space here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed this one!

}
navController.presentationController.delegate = self;
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a standard delegate setup, I am ok without having a comment in code
https://developer.apple.com/documentation/uikit/uipresentationcontroller/1618329-delegate

if (!viewControllerForPresentation.view.superview)
[mainWindow addSubview:[viewControllerForPresentation view]];
if (!viewControllerForPresentation.view.superview) {
[mainWindow addSubview:[viewControllerForPresentation view]];
Copy link
Member

Choose a reason for hiding this comment

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

ah yes, there is an extra space here

@emawby emawby force-pushed the fix/second_webview_not_cleared branch from ce02055 to ccd0251 Compare August 7, 2020 18:42
@emawby emawby requested a review from Jeasmine August 7, 2020 18:42
@emawby emawby merged commit 380f40f into master Aug 7, 2020
@emawby emawby deleted the fix/second_webview_not_cleared branch August 7, 2020 18:47
@emawby emawby mentioned this pull request Aug 13, 2020
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.

Swiping down to close launch URL notification content causes app to become unresponsive
3 participants