Skip to content

Instantly share code, notes, and snippets.

@frosty
Last active May 9, 2018 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frosty/b96af2452626a9b5e1da83e535c471df to your computer and use it in GitHub Desktop.
Save frosty/b96af2452626a9b5e1da83e535c471df to your computer and use it in GitHub Desktop.
diff --git a/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift b/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift
index 0e37dd48c2..257f1907b0 100644
--- a/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift
+++ b/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift
@@ -1198,7 +1198,7 @@ extension AztecPostViewController {
if !UserDefaults.standard.asyncPromoWasDisplayed {
promoBlock()
} else {
- displayPublishConfirmationAlert(onPublish: publishBlock)
+ displayPublishConfirmationAlert(for: action, onPublish: publishBlock)
}
} else {
publishBlock()
@@ -1389,12 +1389,13 @@ private extension AztecPostViewController {
/// Displays a publish confirmation alert with two options: "Keep Editing" and "Publish".
///
/// - Parameters:
+ /// - action: The publish action being performed.
/// - dismissWhenDone: if `true`, the VC will be dismissed if the user picks "Publish".
///
- func displayPublishConfirmationAlert(onPublish publishAction: @escaping () -> ()) {
- let title = postEditorStateContext.publishQuestionTitleText
+ func displayPublishConfirmationAlert(for action: PostEditorAction, onPublish publishAction: @escaping () -> ()) {
+ let title = action.publishingActionQuestionLabel
let keepEditingTitle = NSLocalizedString("Keep Editing", comment: "Button shown when the author is asked for publishing confirmation.")
- let publishTitle = postEditorStateContext.publishButtonText
+ let publishTitle = action.publishActionLabel
let style: UIAlertControllerStyle = UIDevice.isPad() ? .alert : .actionSheet
let alertController = UIAlertController(title: title, message: nil, preferredStyle: style)
diff --git a/WordPress/Classes/ViewRelated/Post/PostEditorState.swift b/WordPress/Classes/ViewRelated/Post/PostEditorState.swift
index c9ced7df33..61eb3f264b 100644
--- a/WordPress/Classes/ViewRelated/Post/PostEditorState.swift
+++ b/WordPress/Classes/ViewRelated/Post/PostEditorState.swift
@@ -32,7 +32,7 @@ public enum PostEditorAction {
}
}
- fileprivate var publishActionLabel: String {
+ var publishActionLabel: String {
switch self {
case .publish:
return NSLocalizedString("Publish", comment: "Label for the publish (verb) button. Tapping publishes a draft post.")
@@ -51,7 +51,7 @@ public enum PostEditorAction {
}
}
- fileprivate var publishingActionQuestionLabel: String {
+ var publishingActionQuestionLabel: String {
switch self {
case .publish:
return NSLocalizedString("Are you sure you want to publish?", comment: "Title of the message shown when the user taps Publish while editing a post. Options will be Publish and Keep Editing.")
@@ -312,10 +312,6 @@ public class PostEditorStateContext {
return action.publishActionLabel
}
- var publishQuestionTitleText: String {
- return action.publishingActionQuestionLabel
- }
-
/// Returns the WPAnalyticsStat enum to be tracked when this post is published
///
var publishActionAnalyticsStat: WPAnalyticsStat {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment