Skip to content

Commit

Permalink
Remove StoryEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jun 24, 2024
1 parent 4b66f07 commit 3ec3d0d
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 329 deletions.
2 changes: 0 additions & 2 deletions WordPress/Classes/Models/Blog.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ typedef NS_ENUM(NSUInteger, BlogFeature) {
BlogFeatureTenor,
/// Does the blog support setting the homepage type and pages?
BlogFeatureHomepageSettings,
/// Does the blog support stories?
BlogFeatureStories,
/// Does the blog support Jetpack contact info block?
BlogFeatureContactInfo,
BlogFeatureBlockEditorSettings,
Expand Down
7 changes: 0 additions & 7 deletions WordPress/Classes/Models/Blog.m
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,6 @@ - (BOOL)supports:(BlogFeature)feature
return [self isAdmin];
case BlogFeatureHomepageSettings:
return [self supportsRestApi] && [self isAdmin];
case BlogFeatureStories:
return [self supportsStories];
case BlogFeatureContactInfo:
return [self supportsContactInfo];
case BlogFeatureBlockEditorSettings:
Expand Down Expand Up @@ -712,11 +710,6 @@ - (BOOL)supportsPluginManagement
return supports;
}

- (BOOL)supportsStories
{
return NO;
}

- (BOOL)supportsContactInfo
{
return [self hasRequiredJetpackVersion:@"8.5"] || self.isHostedAtWPcom;
Expand Down
200 changes: 0 additions & 200 deletions WordPress/Classes/Services/Stories/StoryEditor.swift

This file was deleted.

10 changes: 0 additions & 10 deletions WordPress/Classes/Stores/UserPersistentRepositoryUtility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ private enum UPRUConstants {
static let createButtonTooltipWasDisplayed = "CreateButtonTooltipWasDisplayed"
static let createButtonTooltipDisplayCount = "CreateButtonTooltipDisplayCount"
static let savedPostsPromoWasDisplayed = "SavedPostsV1PromoWasDisplayed"
static let storiesIntroWasAcknowledged = "storiesIntroWasAcknowledged"
static let currentAnnouncementsKey = "currentAnnouncements"
static let currentAnnouncementsDateKey = "currentAnnouncementsDate"
static let announcementsVersionDisplayedKey = "announcementsVersionDisplayed"
Expand Down Expand Up @@ -126,15 +125,6 @@ extension UserPersistentRepositoryUtility {
}
}

var storiesIntroWasAcknowledged: Bool {
get {
return UserPersistentStoreFactory.instance().bool(forKey: UPRUConstants.storiesIntroWasAcknowledged)
}
set {
UserPersistentStoreFactory.instance().set(newValue, forKey: UPRUConstants.storiesIntroWasAcknowledged)
}
}

var announcements: [Announcement]? {
get {
guard let encodedAnnouncements = UserPersistentStoreFactory.instance().object(forKey: UPRUConstants.currentAnnouncementsKey) as? Data,
Expand Down
44 changes: 0 additions & 44 deletions WordPress/Classes/System/RootViewPresenter+EditorNavigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ extension RootViewPresenter {
showPageEditor(blog: forBlog)
}

func showStoryEditor(forBlog: Blog? = nil) {
showStoryEditor(blog: forBlog)
}

/// Show the page tab
/// - Parameter blog: Blog to a add a page to. Uses the current or last blog if not provided
func showPageEditor(blog inBlog: Blog? = nil, title: String? = nil, content: String? = nil, source: String = "create_button") {
Expand Down Expand Up @@ -97,44 +93,4 @@ extension RootViewPresenter {
let editorViewController = EditPageViewController(blog: blog, postTitle: title, content: content)
rootViewController.present(editorViewController, animated: false)
}

/// Show the story editor
/// - Parameter blog: Blog to a add a story to. Uses the current or last blog if not provided
func showStoryEditor(blog inBlog: Blog? = nil, title: String? = nil, content: String? = nil, source: String = "create_button") {
// If we are already showing a view controller, dismiss and show the editor afterward
guard rootViewController.presentedViewController == nil else {
rootViewController.dismiss(animated: true) { [weak self] in
self?.showStoryEditor(blog: inBlog, title: title, content: content, source: source)
}
return
}

if UserPersistentStoreFactory.instance().storiesIntroWasAcknowledged == false {
// Show Intro screen
let intro = StoriesIntroViewController(continueTapped: { [weak self] in
UserPersistentStoreFactory.instance().storiesIntroWasAcknowledged = true
self?.showStoryEditor()
}, openURL: { [weak self] url in
let webViewController = WebViewControllerFactory.controller(url: url, source: "show_story_example")
let navController = UINavigationController(rootViewController: webViewController)
self?.rootViewController.presentedViewController?.present(navController, animated: true)
})

rootViewController.present(intro, animated: true, completion: {
StoriesIntroViewController.trackShown()
})
} else {
guard let blog = inBlog ?? self.currentOrLastBlog() else { return }
let blogID = blog.dotComID?.intValue ?? 0 as Any

WPAppAnalytics.track(.editorCreatedPost, withProperties: [WPAppAnalyticsKeyTapSource: source, WPAppAnalyticsKeyBlogID: blogID, WPAppAnalyticsKeyEditorSource: "stories", WPAppAnalyticsKeyPostType: "post"])

do {
let controller = try StoryEditor.editor(blog: blog, context: ContextManager.shared.mainContext, updated: {_ in })
rootViewController.present(controller, animated: true, completion: nil)
} catch {
assertionFailure("Story editor should not fail since this button is hidden on iPads.")
}
}
}
}
16 changes: 0 additions & 16 deletions WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ import Foundation
case featureAnnouncementShown
case featureAnnouncementButtonTapped

// Stories
case storyIntroShown
case storyIntroDismissed
case storyIntroCreateStoryButtonTapped
case storyAddedMedia

// Jetpack
case jetpackSettingsViewed
case jetpackManageConnectionViewed
Expand Down Expand Up @@ -887,16 +881,6 @@ import Foundation
case .featureAnnouncementButtonTapped:
return "feature_announcement_button_tapped"

// Stories
case .storyIntroShown:
return "story_intro_shown"
case .storyIntroDismissed:
return "story_intro_dismissed"
case .storyIntroCreateStoryButtonTapped:
return "story_intro_create_story_button_tapped"
case .storyAddedMedia:
return "story_added_media"

// Jetpack
case .jetpackSettingsViewed:
return "jetpack_settings_viewed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,10 @@ extension MySiteViewController {
})
}

let newStory = {
let presenter = RootViewCoordinator.sharedPresenter
let blog = presenter.currentOrLastBlog()
presenter.showStoryEditor(forBlog: blog)
}

let source = "my_site"

var actions: [ActionSheetItem] = []

if blog?.supports(.stories) ?? false {
actions.append(StoryAction(handler: newStory, source: source))
}

actions.append(PostAction(handler: newPost, source: source))
// TODO: check if the current site is eligible
if RemoteFeatureFlag.voiceToContent.enabled() {
Expand Down
9 changes: 0 additions & 9 deletions WordPress/Classes/ViewRelated/Post/PostEditor+Publish.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ protocol PublishingEditor where Self: UIViewController {
/// Return the current html in the editor
func getHTML() -> String

/// When the Prepublishing sheet or Prepublishing alert is dismissed, this is called.
func publishingDismissed()

/// Returns the word counts of the content in the editor.
var wordCount: UInt { get }

Expand All @@ -43,11 +40,6 @@ protocol PublishingEditor where Self: UIViewController {
}

extension PublishingEditor {

func publishingDismissed() {
// Default implementation is empty, can be optionally implemented by other classes.
}

func emitPostSaveEvent() {
// Default implementation is empty, can be optionally implemented by other classes.
}
Expand Down Expand Up @@ -119,7 +111,6 @@ extension PublishingEditor {
let presentBloggingReminders = JetpackNotificationMigrationService.shared.shouldPresentNotifications()
self.dismissOrPopView(presentBloggingReminders: presentBloggingReminders)
case .cancelled:
self.publishingDismissed()
WPAnalytics.track(.editorPostPublishDismissed)
}
}
Expand Down
Loading

0 comments on commit 3ec3d0d

Please sign in to comment.