Skip to content

Commit 797b570

Browse files
authored
Merge pull request #18428 from wordpress-mobile/feature/18176-show_create_post
Blogging Prompts Feature Introduction: show post creation
2 parents ca541bb + 3ce2452 commit 797b570

3 files changed

Lines changed: 28 additions & 6 deletions

File tree

WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class DashboardPromptsCardCell: UICollectionViewCell, Reusable {
8888

8989
private lazy var answerCount: Int = {
9090
if forExampleDisplay {
91-
return Constants.maxAvatarCount
91+
return Constants.exampleAnswerCount
9292
}
9393
// TODO: For testing purposes. Remove once we actually have real avatar URLs.
9494
return 3
@@ -366,6 +366,7 @@ private extension DashboardPromptsCardCell {
366366
static let answeredButtonsSpacing: CGFloat = 16
367367
static let answerInfoViewSpacing: CGFloat = 6
368368
static let maxAvatarCount = 3
369+
static let exampleAnswerCount = 19
369370
static let cardIconSize = CGSize(width: 18, height: 18)
370371
static let cardFrameConstraintPriority = UILayoutPriority(999)
371372
}

WordPress/Classes/ViewRelated/Feature Introduction/Blogging Prompts/BloggingPromptsIntroductionPresenter.swift

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import UIKit
55
/// and directs the flow according to which action button is tapped.
66
/// - Try it: the answer prompt flow.
77
/// - Remind me: the blogging reminders flow.
8-
/// - If the account has multiple sites, a site picker is displayed before either of the above.
8+
/// - If the account has multiple sites, a site selector is displayed before either of the above.
99

1010
class BloggingPromptsIntroductionPresenter: NSObject {
1111

@@ -62,18 +62,32 @@ private extension BloggingPromptsIntroductionPresenter {
6262

6363
func showSiteSelector() {
6464
// TODO: show site selector
65-
navigationController.dismiss(animated: true, completion: nil)
65+
navigationController.dismiss(animated: true)
6666
}
6767

6868
func showPostCreation() {
69-
// TODO: show post creation
70-
navigationController.dismiss(animated: true, completion: nil)
69+
guard let blog = accountSites?.first,
70+
let presentingViewController = presentingViewController else {
71+
navigationController.dismiss(animated: true)
72+
return
73+
}
74+
75+
// TODO: pre-populate post content with prompt content.
76+
// Do something similar to `ReaderReblogPresenter:prepareForReblog`?
77+
let editor = EditPostViewController(blog: blog)
78+
editor.modalPresentationStyle = .fullScreen
79+
editor.entryPoint = .bloggingPromptsFeatureIntroduction
80+
81+
navigationController.dismiss(animated: true, completion: { [weak self] in
82+
presentingViewController.present(editor, animated: false)
83+
self?.trackPostEditorShown(blog)
84+
})
7185
}
7286

7387
func showRemindersScheduling() {
7488
guard let blog = accountSites?.first,
7589
let presentingViewController = presentingViewController else {
76-
navigationController.dismiss(animated: true, completion: nil)
90+
navigationController.dismiss(animated: true)
7791
return
7892
}
7993

@@ -84,4 +98,10 @@ private extension BloggingPromptsIntroductionPresenter {
8498
})
8599
}
86100

101+
func trackPostEditorShown(_ blog: Blog) {
102+
WPAppAnalytics.track(.editorCreatedPost,
103+
withProperties: [WPAppAnalyticsKeyTapSource: "blogging_prompts_feature_introduction", WPAppAnalyticsKeyPostType: "post"],
104+
with: blog)
105+
}
106+
87107
}

WordPress/Classes/ViewRelated/Post/PostEditor.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,5 @@ enum PostEditorEntryPoint: String {
154154
case unknown
155155
case postsList
156156
case dashboard
157+
case bloggingPromptsFeatureIntroduction
157158
}

0 commit comments

Comments
 (0)