Skip to content

Commit

Permalink
Merge pull request #4963 from wordpress-mobile/issue/3d-touch-crash
Browse files Browse the repository at this point in the history
Issue/3d touch crash
  • Loading branch information
sendhil committed Mar 15, 2016
2 parents f263100 + b6416c6 commit 01f0401
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion WordPress/Classes/System/3DTouch/WP3DTouchShortcutCreator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ public class WP3DTouchShortcutCreator: NSObject
}

if loggedIn {
createLoggedInShortcuts()
if hasBlog() {
createLoggedInShortcuts()
} else {
clearShortcuts()
}
} else {
createLoggedOutShortcuts()
}
Expand Down Expand Up @@ -99,6 +103,10 @@ public class WP3DTouchShortcutCreator: NSObject
application.shortcutItems = visibleShortcutArray
}

private func clearShortcuts() {
application.shortcutItems = nil
}

private func createLoggedOutShortcuts() {
application.shortcutItems = loggedOutShortcutArray()
}
Expand All @@ -122,4 +130,8 @@ public class WP3DTouchShortcutCreator: NSObject

return hasWordPressComAccount() && currentBlog.supports(BlogFeature.Stats)
}

private func hasBlog() -> Bool {
return blogService.blogCountForAllAccounts() > 0
}
}

0 comments on commit 01f0401

Please sign in to comment.