Skip to content

Commit 3eb1f86

Browse files
committed
7916 Sync announcements after webview swiped away
Syncing announcements after the webview is closed will allow the JITM to be automatically removed in response to user action, if the user no longer fits the profile to recieve the message after they have taken the action in the webview.
1 parent 1969d79 commit 3eb1f86

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

WooCommerce/Classes/ViewRelated/Dashboard/DashboardViewController.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ private extension DashboardViewController {
299299
self.viewModel.syncAnnouncements(for: self.siteID)
300300
}
301301
let hostingController = UIHostingController(rootView: webViewSheet)
302+
hostingController.presentationController?.delegate = self
302303
present(hostingController, animated: true, completion: nil)
303304
}
304305

@@ -385,12 +386,21 @@ private extension DashboardViewController {
385386
}
386387
}
387388

389+
// MARK: - Delegate conformance
388390
extension DashboardViewController: DashboardUIScrollDelegate {
389391
func dashboardUIScrollViewDidScroll(_ scrollView: UIScrollView) {
390392
hiddenScrollView.updateFromScrollViewDidScrollEventForLargeTitleWorkaround(scrollView)
391393
}
392394
}
393395

396+
extension DashboardViewController: UIAdaptivePresentationControllerDelegate {
397+
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
398+
if presentationController.presentedViewController is UIHostingController<WebViewSheet> {
399+
viewModel.syncAnnouncements(for: siteID)
400+
}
401+
}
402+
}
403+
394404
// MARK: - Updates
395405
//
396406
private extension DashboardViewController {

0 commit comments

Comments
 (0)