Skip to content

Commit

Permalink
Disable Story posts when Jetpack features are removed
Browse files Browse the repository at this point in the history
  • Loading branch information
fluiddot committed Dec 30, 2022
1 parent 16fa3c3 commit ac08a81
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extension MySiteViewController {

var actions: [ActionSheetItem] = []

if shouldShowNewStory {
if StoryAction.shouldBeShown(blog: blog) {
actions.append(StoryAction(handler: newStory, source: source))
}

Expand All @@ -38,8 +38,4 @@ extension MySiteViewController {
let coordinator = CreateButtonCoordinator(self, actions: actions, source: source, blog: blog)
return coordinator
}

private var shouldShowNewStory: Bool {
return (blog?.supports(.stories) ?? false) && !UIDevice.isPad()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class PostListViewController: AbstractPostListViewController, UIViewControllerRe
self?.createPost()
}, source: Constants.source)
]
if blog.supports(.stories) {
if StoryAction.shouldBeShown(blog: blog) {
actions.insert(StoryAction(handler: { [weak self] in
guard let self = self else {
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import WordPressFlux
private let noticeAnimator = NoticeAnimator(duration: 0.5, springDampening: 0.7, springVelocity: 0.0)

private func notice(for blog: Blog) -> Notice {
let showsStories = blog.supports(.stories)
let showsStories = StoryAction.shouldBeShown(blog: blog)
let title = showsStories ? NSLocalizedString("Create a post, page, or story", comment: "The tooltip title for the Floating Create Button") : NSLocalizedString("Creates new post, or page", comment: " Accessibility hint for create floating action button")
let notice = Notice(title: title,
message: "",
Expand Down Expand Up @@ -201,7 +201,7 @@ import WordPressFlux
}

@objc func showCreateButton(for blog: Blog) {
let showsStories = blog.supports(.stories)
let showsStories = StoryAction.shouldBeShown(blog: blog)
button.accessibilityHint = showsStories ? NSLocalizedString("Creates new post, page, or story", comment: " Accessibility hint for create floating action button") : NSLocalizedString("Create a post or page", comment: " Accessibility hint for create floating action button")
showCreateButton(notice: notice(for: blog))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,8 @@ struct StoryAction: ActionSheetItem {
badge.backgroundColor = Constants.Badge.backgroundColor
return badge
}

static func shouldBeShown(blog: Blog?) -> Bool {
return (blog?.supports(.stories) ?? false) && !UIDevice.isPad() && !JetpackFeaturesRemovalCoordinator.shouldRemoveJetpackFeatures()
}
}

0 comments on commit ac08a81

Please sign in to comment.