Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion WordPress/Classes/Utility/ZendeskUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,6 @@ private extension ZendeskUtils {
static func getTags() -> [String] {

let context = ContextManager.sharedInstance().mainContext
let blogService = BlogService(managedObjectContext: context)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crazytonyli I think this was a leftover from the various iterations on the API used to fetch resources, right?

I checked the implementation and couldn't find a reason to init the service without using it. But I might have missed something...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it must be, but should be safe to remove though. Thanks!

let allBlogs = (try? BlogQuery().blogs(in: context)) ?? []
var tags = [String]()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ final class AppIconListViewModel: AppIconListViewModelType {
let currentLightIcons = allIcons.filter({ $0.isLegacy == false && $0.isBordered == true })
.sorted(by: sortWithPriority(toItemsWithPrefix: AppIcon.defaultIconName))
let legacyIcons = {
var icons = allIcons.filter({ $0.isLegacy == true })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning itself was on this being a var that was never mutated. While I was at it, I also adopted guard for the early-return.

if let legacyIconName = AppIcon.defaultLegacyIconName {
return icons.sorted(by: sortWithPriority(toItemsWithPrefix: legacyIconName))
let icons = allIcons.filter({ $0.isLegacy == true })

guard let legacyIconName = AppIcon.defaultLegacyIconName else {
return icons
}
return icons

return icons.sorted(by: sortWithPriority(toItemsWithPrefix: legacyIconName))
}()

// Set icons
Expand Down