Skip to content

Commit ac08a81

Browse files
committed
Disable Story posts when Jetpack features are removed
1 parent 16fa3c3 commit ac08a81

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

WordPress/Classes/ViewRelated/Blog/My Site/MySiteViewController+FAB.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extension MySiteViewController {
2828

2929
var actions: [ActionSheetItem] = []
3030

31-
if shouldShowNewStory {
31+
if StoryAction.shouldBeShown(blog: blog) {
3232
actions.append(StoryAction(handler: newStory, source: source))
3333
}
3434

@@ -38,8 +38,4 @@ extension MySiteViewController {
3838
let coordinator = CreateButtonCoordinator(self, actions: actions, source: source, blog: blog)
3939
return coordinator
4040
}
41-
42-
private var shouldShowNewStory: Bool {
43-
return (blog?.supports(.stories) ?? false) && !UIDevice.isPad()
44-
}
4541
}

WordPress/Classes/ViewRelated/Post/PostListViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class PostListViewController: AbstractPostListViewController, UIViewControllerRe
186186
self?.createPost()
187187
}, source: Constants.source)
188188
]
189-
if blog.supports(.stories) {
189+
if StoryAction.shouldBeShown(blog: blog) {
190190
actions.insert(StoryAction(handler: { [weak self] in
191191
guard let self = self else {
192192
return

WordPress/Classes/ViewRelated/System/Floating Create Button/CreateButtonCoordinator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import WordPressFlux
2222
private let noticeAnimator = NoticeAnimator(duration: 0.5, springDampening: 0.7, springVelocity: 0.0)
2323

2424
private func notice(for blog: Blog) -> Notice {
25-
let showsStories = blog.supports(.stories)
25+
let showsStories = StoryAction.shouldBeShown(blog: blog)
2626
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")
2727
let notice = Notice(title: title,
2828
message: "",
@@ -201,7 +201,7 @@ import WordPressFlux
201201
}
202202

203203
@objc func showCreateButton(for blog: Blog) {
204-
let showsStories = blog.supports(.stories)
204+
let showsStories = StoryAction.shouldBeShown(blog: blog)
205205
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")
206206
showCreateButton(notice: notice(for: blog))
207207
}

WordPress/Classes/ViewRelated/System/Floating Create Button/SheetActions.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,8 @@ struct StoryAction: ActionSheetItem {
7575
badge.backgroundColor = Constants.Badge.backgroundColor
7676
return badge
7777
}
78+
79+
static func shouldBeShown(blog: Blog?) -> Bool {
80+
return (blog?.supports(.stories) ?? false) && !UIDevice.isPad() && !JetpackFeaturesRemovalCoordinator.shouldRemoveJetpackFeatures()
81+
}
7882
}

0 commit comments

Comments
 (0)