Last active
July 19, 2018 10:43
-
-
Save frosty/4063cca5c427237280bb6e3f58825441 to your computer and use it in GitHub Desktop.
This file contains 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
diff --git a/WordPress/Classes/ViewRelated/Blog/QuickStartTourGuide.swift b/WordPress/Classes/ViewRelated/Blog/QuickStartTourGuide.swift | |
index 814fd8fac4..cbd95ec6a9 100644 | |
--- a/WordPress/Classes/ViewRelated/Blog/QuickStartTourGuide.swift | |
+++ b/WordPress/Classes/ViewRelated/Blog/QuickStartTourGuide.swift | |
@@ -24,10 +24,6 @@ open class QuickStartTourGuide: NSObject, UINavigationControllerDelegate { | |
} | |
func dismissTestQuickStartNotice() { | |
- guard let presenter = findNoticePresenter() else { | |
- return | |
- } | |
- | |
- presenter.dismissCurrentNotice() | |
+ ActionDispatcher.dispatch(NoticeAction.dismiss) | |
} | |
} | |
diff --git a/WordPress/Classes/ViewRelated/System/Notices/NoticePresenter.swift b/WordPress/Classes/ViewRelated/System/Notices/NoticePresenter.swift | |
index cc3651bbe6..1af016745f 100644 | |
--- a/WordPress/Classes/ViewRelated/System/Notices/NoticePresenter.swift | |
+++ b/WordPress/Classes/ViewRelated/System/Notices/NoticePresenter.swift | |
@@ -19,6 +19,7 @@ class NoticePresenter: NSObject { | |
super.init() | |
storeReceipt = store.onChange { [weak self] in | |
+ self?.dismissCurrentNotice() | |
self?.presentNextNoticeIfAvailable() | |
} | |
} | |
@@ -83,8 +84,8 @@ class NoticePresenter: NSObject { | |
let toState = onscreenState(for: noticeContainerView) | |
- let dismiss = { | |
- self.dismiss(container: noticeContainerView) | |
+ let dismiss: (() -> Void) = { [weak self] in | |
+ self?.dismiss() | |
} | |
noticeView.dismissHandler = dismiss | |
@@ -131,11 +132,12 @@ class NoticePresenter: NSObject { | |
} | |
} | |
- public func dismissCurrentNotice() { | |
+ private func dismissCurrentNotice() { | |
guard let currentContainer = currentContainer else { | |
return | |
} | |
+ self.currentContainer = nil | |
dismiss(container: currentContainer) | |
} | |
@@ -146,7 +148,6 @@ class NoticePresenter: NSObject { | |
self.animatePresentation(fromState: {}, toState: offscreenState(for: container), completion: { | |
container.removeFromSuperview() | |
- self.dismiss() | |
}) | |
} | |
diff --git a/WordPress/Classes/ViewRelated/System/Notices/NoticeView.swift b/WordPress/Classes/ViewRelated/System/Notices/NoticeView.swift | |
index 3730f46dd5..87925560ae 100644 | |
--- a/WordPress/Classes/ViewRelated/System/Notices/NoticeView.swift | |
+++ b/WordPress/Classes/ViewRelated/System/Notices/NoticeView.swift | |
@@ -13,7 +13,7 @@ class NoticeView: UIView { | |
private let messageLabel = UILabel() | |
private let actionButton = UIButton(type: .system) | |
- private let notice: Notice | |
+ let notice: Notice | |
var dismissHandler: (() -> Void)? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment