Skip to content

Commit e2cd152

Browse files
committed
refactor: add remoteCases and localCases
1 parent 74eed2a commit e2cd152

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

WordPress/Classes/ViewRelated/Blog/Blog Dashboard/DashboardCard.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,14 @@ enum DashboardCard: String, CaseIterable {
3434
return DashboardStatsCardCell.self
3535
}
3636
}
37+
38+
/// All cards that are remote
39+
static var remoteCases: [DashboardCard] {
40+
return DashboardCard.allCases.filter { $0.isRemote }
41+
}
42+
43+
/// All cards that are local
44+
static var localCases: [DashboardCard] {
45+
return DashboardCard.allCases.filter { !$0.isRemote }
46+
}
3747
}

WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardService.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ class BlogDashboardService {
99
}
1010

1111
func fetch(wpComID: Int, completion: @escaping (DashboardSnapshot) -> Void) {
12-
let cardsToFetch: [String] = DashboardCard.allCases
13-
.filter { $0.isRemote }
14-
.map { $0.rawValue }
12+
let cardsToFetch: [String] = DashboardCard.remoteCases.map { $0.rawValue }
1513

1614
remoteService.fetch(cards: cardsToFetch, forBlogID: wpComID, success: { [weak self] cards in
1715

0 commit comments

Comments
 (0)