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
2 changes: 1 addition & 1 deletion RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
21.5
-----
* [***] [internal] A significant refactor to the app’s architecture was made to allow for the new simplified UI. Regression testing on the app’s main flows is needed. [#19817]

* [**] [internal] Disable Story posts when Jetpack features are removed [#19823]

21.4
-----
Expand Down
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
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I originally considered checking the isPad and feature removal conditions in a specific helper within the StoryAction class. But I finally ended up using the supports functionality of the Blog model as the logic seemed closer to me. In any case, please let me know if there's a better approach for this, thanks!

{
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 jetpackFeaturesEnabled];
}

- (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()
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

/// A class containing convenience methods for the the Jetpack features removal experience
class JetpackFeaturesRemovalCoordinator {
class JetpackFeaturesRemovalCoordinator: NSObject {

/// Enum descibing the current phase of the Jetpack features removal
enum GeneralPhase: String {
Expand Down Expand Up @@ -108,6 +108,7 @@ class JetpackFeaturesRemovalCoordinator {
}

/// Used to determine if the Jetpack features are enabled based on the removal phase.
@objc
static func jetpackFeaturesEnabled() -> Bool {
switch generalPhase() {
case .four, .newUsers:
Expand Down