Skip to content

Commit 1b9a7c5

Browse files
committed
add: configure draft and schedule for posts card
1 parent 52fa4ee commit 1b9a7c5

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Posts/DashboardPostsCardCell.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@ import UIKit
22

33
class DashboardPostsCardCell: UICollectionViewCell, Reusable, BlogDashboardCardConfigurable {
44
func configure(blog: Blog, viewController: BlogDashboardViewController?, dataModel: NSDictionary?) {
5-
guard let viewController = viewController else {
5+
guard let viewController = viewController, let dataModel = dataModel else {
66
return
77
}
88

9+
let hasDrafts = (dataModel["draft"] as? Array<Any>)?.count ?? 0 > 0
10+
let hasScheduled = (dataModel["scheduled"] as? Array<Any>)?.count ?? 0 > 0
11+
912
let postsViewController = PostsCardViewController(blog: blog)
13+
14+
if hasDrafts {
15+
postsViewController.status = .draft
16+
} else if hasScheduled {
17+
postsViewController.status = .scheduled
18+
}
19+
1020
viewController.addChild(postsViewController)
1121
contentView.addSubview(postsViewController.view)
1222
postsViewController.view.translatesAutoresizingMaskIntoConstraints = false

0 commit comments

Comments
 (0)