Skip to content

Commit

Permalink
Merge pull request #21369 from wordpress-mobile/task/remove-new-post
Browse files Browse the repository at this point in the history
Remove the New Photo Post app shortcut
  • Loading branch information
kean authored Aug 22, 2023
2 parents 6582af6 + 2d426ca commit f79d651
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 65 deletions.
4 changes: 4 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
23.2
-----
* [*] Remove the "New Photo Post" app quick action [#21369](https://github.com/wordpress-mobile/WordPress-iOS/pull/21369)

23.1
-----
* [*] Block editor: Hide undo/redo buttons when using the HTML editor [#21253]
Expand Down
11 changes: 1 addition & 10 deletions WordPress/Classes/System/3DTouch/WP3DTouchShortcutCreator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ open class WP3DTouchShortcutCreator: NSObject {
enum LoggedIn3DTouchShortcutIndex: Int {
case notifications = 0,
stats,
newPhotoPost,
newPost
}

Expand All @@ -27,7 +26,6 @@ open class WP3DTouchShortcutCreator: NSObject {
fileprivate let logInShortcutIconImageName = "icon-shortcut-signin"
fileprivate let notificationsShortcutIconImageName = "icon-shortcut-notifications"
fileprivate let statsShortcutIconImageName = "icon-shortcut-stats"
fileprivate let newPhotoPostShortcutIconImageName = "icon-shortcut-new-photo"
fileprivate let newPostShortcutIconImageName = "icon-shortcut-new-post"

public init(shortcutsProvider: ApplicationShortcutsProvider) {
Expand Down Expand Up @@ -92,19 +90,13 @@ open class WP3DTouchShortcutCreator: NSObject {
icon: UIApplicationShortcutIcon(templateImageName: statsShortcutIconImageName),
userInfo: [WP3DTouchShortcutHandler.applicationShortcutUserInfoIconKey: WP3DTouchShortcutHandler.ShortcutIdentifier.Stats.rawValue as NSSecureCoding])

let newPhotoPostShortcut = UIMutableApplicationShortcutItem(type: WP3DTouchShortcutHandler.ShortcutIdentifier.NewPhotoPost.type,
localizedTitle: NSLocalizedString("New Photo Post", comment: "New Photo Post 3D Touch Shortcut"),
localizedSubtitle: defaultBlogName,
icon: UIApplicationShortcutIcon(templateImageName: newPhotoPostShortcutIconImageName),
userInfo: [WP3DTouchShortcutHandler.applicationShortcutUserInfoIconKey: WP3DTouchShortcutHandler.ShortcutIdentifier.NewPhotoPost.rawValue as NSSecureCoding])

let newPostShortcut = UIMutableApplicationShortcutItem(type: WP3DTouchShortcutHandler.ShortcutIdentifier.NewPost.type,
localizedTitle: NSLocalizedString("New Post", comment: "New Post 3D Touch Shortcut"),
localizedSubtitle: defaultBlogName,
icon: UIApplicationShortcutIcon(templateImageName: newPostShortcutIconImageName),
userInfo: [WP3DTouchShortcutHandler.applicationShortcutUserInfoIconKey: WP3DTouchShortcutHandler.ShortcutIdentifier.NewPost.rawValue as NSSecureCoding])

return [notificationsShortcut, statsShortcut, newPhotoPostShortcut, newPostShortcut]
return [notificationsShortcut, statsShortcut, newPostShortcut]
}

@objc fileprivate func createLoggedInShortcuts() {
Expand All @@ -126,7 +118,6 @@ open class WP3DTouchShortcutCreator: NSObject {
}

if AppConfiguration.allowsNewPostShortcut {
visibleShortcutArray.append(entireShortcutArray[LoggedIn3DTouchShortcutIndex.newPhotoPost.rawValue])
visibleShortcutArray.append(entireShortcutArray[LoggedIn3DTouchShortcutIndex.newPost.rawValue])
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ open class WP3DTouchShortcutHandler: NSObject {
enum ShortcutIdentifier: String {
case LogIn
case NewPost
case NewPhotoPost
case Stats
case Notifications

Expand Down Expand Up @@ -33,11 +32,7 @@ open class WP3DTouchShortcutHandler: NSObject {
return true
case ShortcutIdentifier.NewPost.type:
WPAnalytics.track(.shortcutNewPost)
rootViewPresenter.showPostTab(animated: false, toMedia: false)
return true
case ShortcutIdentifier.NewPhotoPost.type:
WPAnalytics.track(.shortcutNewPhotoPost)
rootViewPresenter.showPostTab(animated: false, toMedia: true)
rootViewPresenter.showPostTab(animated: false)
return true
case ShortcutIdentifier.Stats.type:
WPAnalytics.track(.shortcutStats)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extension RootViewPresenter {
if Blog.count(in: context) == 0 {
mySitesCoordinator.showAddNewSite()
} else {
showPostTab(animated: true, toMedia: false, completion: afterDismiss)
showPostTab(animated: true, completion: afterDismiss)
}
}

Expand All @@ -28,12 +28,11 @@ extension RootViewPresenter {
if Blog.count(in: context) == 0 {
mySitesCoordinator.showAddNewSite()
} else {
showPostTab(animated: true, toMedia: false, blog: blog)
showPostTab(animated: true, blog: blog)
}
}

func showPostTab(animated: Bool,
toMedia openToMedia: Bool,
blog: Blog? = nil,
completion afterDismiss: (() -> Void)? = nil) {
if rootViewController.presentedViewController != nil {
Expand All @@ -47,7 +46,6 @@ extension RootViewPresenter {
let editor = EditPostViewController(blog: blog)
editor.modalPresentationStyle = .fullScreen
editor.showImmediately = !animated
editor.openWithMediaPicker = openToMedia
editor.afterDismiss = afterDismiss

let properties = [WPAppAnalyticsKeyTapSource: "create_button", WPAppAnalyticsKeyPostType: "post"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ class AztecPostViewController: UIViewController, PostEditor {

var editorSession: PostEditorAnalyticsSession

/// Indicates if Aztec was launched for Photo Posting
///
var isOpenedDirectlyForPhotoPost = false

var postIsReblogged: Bool = false

let navigationBarManager = PostEditorNavigationBarManager()
Expand Down Expand Up @@ -549,10 +545,6 @@ class AztecPostViewController: UIViewController, PostEditor {
configureConstraints()
view.setNeedsUpdateConstraints()

if isOpenedDirectlyForPhotoPost {
presentMediaPickerFullScreen(animated: false)
}

if !editorSession.started {
editorSession.start()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ class GutenbergViewController: UIViewController, PostEditor, FeaturedImageDelega

var onClose: ((Bool, Bool) -> Void)?

var isOpenedDirectlyForPhotoPost: Bool = false

var postIsReblogged: Bool = false

var isEditorClosing: Bool = false
Expand Down Expand Up @@ -140,29 +138,6 @@ class GutenbergViewController: UIViewController, PostEditor, FeaturedImageDelega
mediaToInsertOnPost = []
}

private func showMediaSelectionOnStart() {
isOpenedDirectlyForPhotoPost = false
mediaPickerHelper.presentMediaPickerFullScreen(animated: true,
filter: .image,
dataSourceType: .device,
allowMultipleSelection: false,
callback: {(asset) in
guard let phAsset = asset as? [PHAsset] else {
return
}
self.mediaInserterHelper.insertFromDevice(assets: phAsset, callback: { media in
guard let media = media,
let mediaInfo = media.first,
let mediaID = mediaInfo.id,
let mediaURLString = mediaInfo.url,
let mediaURL = URL(string: mediaURLString) else {
return
}
self.gutenberg.appendMedia(id: mediaID, url: mediaURL, type: .image)
})
})
}

private func editMedia(with mediaUrl: URL, callback: @escaping MediaPickerDidPickMediaCallback) {

let image = GutenbergMediaEditorImage(url: mediaUrl, post: post)
Expand Down Expand Up @@ -969,9 +944,6 @@ extension GutenbergViewController: GutenbergBridgeDelegate {
}
if isFirstGutenbergLayout {
insertPrePopulatedMedia()
if isOpenedDirectlyForPhotoPost {
showMediaSelectionOnStart()
}
focusTitleIfNeeded()
mediaInserterHelper.refreshMediaStatus()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class EditPostViewController: UIViewController {

/// appear instantly, without animations
@objc var showImmediately: Bool = false
/// appear with the media picker open
@objc var openWithMediaPicker: Bool = false
/// appear with the post epilogue visible
@objc var openWithPostPost: Bool = false
/// appear with media pre-inserted into the post
Expand Down Expand Up @@ -157,9 +155,6 @@ class EditPostViewController: UIViewController {
}

private func showEditor(_ editor: EditorViewController) {
editor.isOpenedDirectlyForPhotoPost = openWithMediaPicker
// only open the media picker once.
openWithMediaPicker = false
editor.onClose = { [weak self, weak editor] changesSaved, showPostEpilogue in
guard let strongSelf = self else {
editor?.dismiss(animated: true) {}
Expand Down
4 changes: 0 additions & 4 deletions WordPress/Classes/ViewRelated/Post/PostEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ protocol PostEditor: PublishingEditor, UIViewControllerTransitioningDelegate {
///
var post: AbstractPost { get set }

/// Whether the editor should open directly to the media picker.
///
var isOpenedDirectlyForPhotoPost: Bool { get set }

/// Initializer
///
/// - Parameters:
Expand Down

0 comments on commit f79d651

Please sign in to comment.