Skip to content

Commit

Permalink
[Gutenberg] Remove code associated to Story block (#22758)
Browse files Browse the repository at this point in the history
  • Loading branch information
fluiddot authored Mar 5, 2024
2 parents e29a8ed + 9d5d210 commit ed63c3b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 70 deletions.
2 changes: 1 addition & 1 deletion Gutenberg/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
#
# LOCAL_GUTENBERG=../my-gutenberg-fork bundle exec pod install
ref:
tag: v1.114.0
tag: v1.115.0-alpha1
github_org: wordpress-mobile
repo_name: gutenberg-mobile
6 changes: 3 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ DEPENDENCIES:
- FSInteractiveMap (from `https://github.com/wordpress-mobile/FSInteractiveMap.git`, tag `0.2.0`)
- Gifu (= 3.3.1)
- Gridicons (~> 1.2)
- Gutenberg (from `https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.114.0.podspec`)
- Gutenberg (from `https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.115.0-alpha1.podspec`)
- JTAppleCalendar (~> 8.0.5)
- Kanvas (~> 1.4.4)
- MediaEditor (>= 1.2.2, ~> 1.2)
Expand Down Expand Up @@ -174,7 +174,7 @@ EXTERNAL SOURCES:
:git: https://github.com/wordpress-mobile/FSInteractiveMap.git
:tag: 0.2.0
Gutenberg:
:podspec: https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.114.0.podspec
:podspec: https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.115.0-alpha1.podspec

CHECKOUT OPTIONS:
FSInteractiveMap:
Expand All @@ -193,7 +193,7 @@ SPEC CHECKSUMS:
FSInteractiveMap: a396f610f48b76cb540baa87139d056429abda86
Gifu: 416d4e38c4c2fed012f019e0a1d3ffcb58e5b842
Gridicons: 4455b9f366960121430e45997e32112ae49ffe1d
Gutenberg: 0f7cae5102b7966424c3b448a31554c486ab009d
Gutenberg: 1fcb7e0487f31a13e252a8bf4d85ac40dd3de0d2
JTAppleCalendar: 16c6501b22cb27520372c28b0a2e0b12c8d0cd73
Kanvas: cc027f8058de881a4ae2b5aa5f05037b6d054d08
MediaEditor: d08314cfcbfac74361071a306b4bc3a39b3356ae
Expand Down
4 changes: 2 additions & 2 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
24.5
-----

* [*] [internal] Block editor: Remove code associated to Story block [#22758]

24.4
-----
Expand All @@ -11,7 +11,7 @@
* [*] Block editor: Media & Text blocks correctly show an error message when the attached video upload fails [https://github.com/WordPress/gutenberg/pull/59288]
* [**] [internal] Refactored .org REST API calls. [#22612]
* [**] [internal] Update loading images in Reader posts list and Posts list. [#22707]
[***] [Jetpack-only] Stats: Introducing Traffic tab, delivering improved graphs, and combining Days/Weeks/Months/Years tabs into one, behind a feature flag. [#22746]
* [***] [Jetpack-only] Stats: Introducing Traffic tab, delivering improved graphs, and combining Days/Weeks/Months/Years tabs into one, behind a feature flag. [#22746]

24.3
-----
Expand Down
3 changes: 0 additions & 3 deletions WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ import Foundation
case storyIntroDismissed
case storyIntroCreateStoryButtonTapped
case storyAddedMedia
case storyBlockAddMediaTapped

// Jetpack
case jetpackSettingsViewed
Expand Down Expand Up @@ -812,8 +811,6 @@ import Foundation
return "story_intro_create_story_button_tapped"
case .storyAddedMedia:
return "story_added_media"
case .storyBlockAddMediaTapped:
return "story_block_add_media_tapped"

// Jetpack
case .jetpackSettingsViewed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import UIKit
import Gutenberg
import Aztec
import WordPressFlux
import Kanvas
import React

class GutenbergViewController: UIViewController, PostEditor, FeaturedImageDelegate, PublishingEditor {
Expand All @@ -29,8 +28,6 @@ class GutenbergViewController: UIViewController, PostEditor, FeaturedImageDelega
return view
}()

private var storyEditor: StoryEditor?

private lazy var service: BlogJetpackSettingsService? = {
guard
let settings = post.blog.settings,
Expand Down Expand Up @@ -366,7 +363,6 @@ class GutenbergViewController: UIViewController, PostEditor, FeaturedImageDelega
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// Handles refreshing controls with state context after options screen is dismissed
storyEditor = nil
editorContentWasUpdated()
}

Expand Down Expand Up @@ -767,63 +763,6 @@ extension GutenbergViewController: GutenbergBridgeDelegate {
present(alertController, animated: true, completion: nil)
}

func gutenbergDidRequestMediaFilesEditorLoad(_ mediaFiles: [[String: Any]], blockId: String) {

if mediaFiles.isEmpty {
WPAnalytics.track(.storyBlockAddMediaTapped)
}

let files = mediaFiles.compactMap({ content -> MediaFile? in
return MediaFile.file(from: content)
})

// If the story editor is already shown, ignore this new load request
guard presentedViewController is StoryEditor == false else {
return
}

do {
try showEditor(files: files, blockID: blockId)
} catch let error {
switch error {
case StoryEditor.EditorCreationError.unsupportedDevice:
let title = NSLocalizedString("Unsupported Device", comment: "Title for stories unsupported device error.")
let message = NSLocalizedString("The Stories editor is not currently available for your iPad. Please try Stories on your iPhone.", comment: "Message for stories unsupported device error.")
let controller = UIAlertController(title: title, message: message, preferredStyle: .alert)
let dismiss = UIAlertAction(title: "Dismiss", style: .default) { _ in
controller.dismiss(animated: true, completion: nil)
}
controller.addAction(dismiss)
present(controller, animated: true, completion: nil)
default:
let title = NSLocalizedString("Unable to Create Stories Editor", comment: "Title for stories unknown error.")
let message = NSLocalizedString("There was a problem with the Stories editor. If the problem persists you can contact us via the Me > Help & Support screen.", comment: "Message for stories unknown error.")
let controller = UIAlertController(title: title, message: message, preferredStyle: .alert)
let dismiss = UIAlertAction(title: "Dismiss", style: .default) { _ in
controller.dismiss(animated: true, completion: nil)
}
controller.addAction(dismiss)
present(controller, animated: true, completion: nil)
}
}
}

func showEditor(files: [MediaFile], blockID: String) throws {
storyEditor = try StoryEditor.editor(post: post, mediaFiles: files, publishOnCompletion: false, updated: { [weak self] result in
switch result {
case .success(let content):
self?.gutenberg.replace(blockID: blockID, content: content)
self?.dismiss(animated: true, completion: nil)
case .failure(let error):
self?.dismiss(animated: true, completion: nil)
DDLogError("Failed to update story: \(error)")
}
})

storyEditor?.trackOpen()
storyEditor?.present(on: self, with: files)
}

func gutenbergDidRequestMediaUploadActionDialog(for mediaID: Int32) {

guard let media = mediaInserterHelper.mediaFor(uploadID: mediaID) else {
Expand Down

0 comments on commit ed63c3b

Please sign in to comment.