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

Add publish functionality to Gutenberg editor #10461

Merged
merged 17 commits into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions WordPress/Classes/Services/EditorSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class EditorSettings: NSObject {
// a configure block as a hack.
// In Swift 4, we'll be able to do `instantiateEditor() -> UIViewController & PostEditor`,
// and then let the caller configure the editor.
@objc func instantiatePostEditor(post: AbstractPost, configure: (PostEditor, UIViewController) -> Void) -> UIViewController {
func instantiatePostEditor(post: AbstractPost, configure: (PostEditor, UIViewController) -> Void) -> UIViewController {
switch current {
case .aztec:
let vc = AztecPostViewController(post: post)
Expand All @@ -97,7 +97,7 @@ class EditorSettings: NSObject {
}
}

@objc func instantiatePageEditor(page post: AbstractPost, configure: (PostEditor, UIViewController) -> Void) -> UIViewController {
func instantiatePageEditor(page post: AbstractPost, configure: (PostEditor, UIViewController) -> Void) -> UIViewController {
switch current {
case .aztec:
let vc = AztecPostViewController(post: post)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import UIKit

class AztecVerificationPromptHelper: NSObject {

typealias VerificationPromptCompletion = (Bool) -> ()

protocol VerificationPromptHelper {

func updateVerificationStatus()

func displayVerificationPrompt(from presentingViewController: UIViewController,
then: VerificationPromptCompletion?)

func needsVerification(before action: PostEditorAction) -> Bool
}

class AztecVerificationPromptHelper: NSObject, VerificationPromptHelper {

private let accountService: AccountService
private let wpComAccount: WPAccount

private weak var displayedAlert: FancyAlertViewController?
private var completionBlock: AztecVerificationPromptCompletion?

typealias AztecVerificationPromptCompletion = (Bool) -> ()
private var completionBlock: VerificationPromptCompletion?

@objc init?(account: WPAccount?) {
guard let passedAccount = account,
Expand Down Expand Up @@ -51,7 +62,7 @@ class AztecVerificationPromptHelper: NSObject {
/// - parameter then: Completion callback to be called after the user dismisses the prompt.
/// **Note**: The callback fires only when the user tapped "OK" or we silently verified the account in background. It isn't fired when user attempts to resend the verification email.
@objc func displayVerificationPrompt(from presentingViewController: UIViewController,
then: AztecVerificationPromptCompletion?) {
then: VerificationPromptCompletion?) {

let fancyAlert = FancyAlertViewController.verificationPromptController { [weak self] in
let needsVerification = self?.wpComAccount.needsEmailVerification ?? true
Expand Down Expand Up @@ -87,7 +98,6 @@ class AztecVerificationPromptHelper: NSObject {
self?.completionBlock?(!updatedAccount.needsEmailVerification)
}, failure: nil)
}

}

// MARK: - UIViewControllerTransitioningDelegate
Expand Down
Loading