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 Jan 2, 2023
1 parent 5787bbf commit 6197b2b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions WordPress/Classes/Models/Blog.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@class UserSuggestion;
@class SiteSuggestion;
@class PageTemplateCategory;
@class JetpackFeaturesRemovalCoordinator;

extern NSString * const BlogEntityName;
extern NSString * const PostFormatStandard;
Expand Down
3 changes: 2 additions & 1 deletion WordPress/Classes/Models/Blog.m
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,8 @@ - (BOOL)supportsPluginManagement
- (BOOL)supportsStories
{
BOOL hasRequiredJetpack = [self hasRequiredJetpackVersion:@"9.1"];
return hasRequiredJetpack || self.isHostedAtWPcom;
// Stories are disabled in iPad until this Kanvas issue is solved: https://github.com/tumblr/kanvas-ios/issues/104
return (hasRequiredJetpack || self.isHostedAtWPcom) && ![UIDevice isPad] && ![JetpackFeaturesRemovalCoordinator shouldRemoveJetpackFeatures];
}

- (BOOL)supportsContactInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extension MySiteViewController {

var actions: [ActionSheetItem] = []

if shouldShowNewStory {
if blog?.supports(.stories) ?? false {
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()
}
}

0 comments on commit 6197b2b

Please sign in to comment.