-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace WPImageViewController with LightboxViewController #23922
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6ddb017
Rename ImageLoadingController
kean 6e9cd70
Add LightboxViewController to replace WPImageViewController
kean 386dc50
Integrate LightboxViewController in Reader
kean 23968d9
Add Media support in LightboxViewController
kean 72031aa
Add convenience init to LightboxViewController
kean 1ab5e6a
Integrate LightboxViewController in SiteMedia
kean 0a1ade1
Integrate LightboxViewController in ReaderDetailsCoordinator (cover i…
kean 74157da
INtegrate in DefaultContentCoordinator
kean f6defb7
Integrate LightboxViewController in Guteberg
kean 5da2855
Integrate LightboxViewController in ExternalMediaPickerViewController
kean d2ad70a
Integrate LightboxViewController in PostSettingsViewController (featu…
kean 176ab0e
Remove FeaturedImageViewController (ObjC)
kean 9f4da0d
Rewrite PostFeaturedImageCell
kean e5bee35
Integrate LightboxViewController in ReaderCommentsViewController
kean 19b004a
Update WPRichTextImage to use AsyncImageView
kean 496d178
Automatically pick thumbnail when available
kean 0241596
Remove WPImageViewController
kean 9e82544
Update release notes
kean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import Foundation | ||
import WordPressMedia | ||
|
||
/// Extends `MediaRequestAuthenticator.MediaHost` so that we can easily | ||
/// initialize it from a given `AbstractPost`. | ||
/// | ||
extension MediaHost { | ||
init(_ post: AbstractPost) { | ||
self.init(with: post.blog, failure: { error in | ||
// We just associate a post with the underlying error for simpler debugging. | ||
WordPressAppDelegate.crashLogging?.logError(error) | ||
}) | ||
} | ||
} | ||
|
||
/// Extends `MediaRequestAuthenticator.MediaHost` so that we can easily | ||
/// initialize it from a given `Blog`. | ||
/// | ||
extension MediaHost { | ||
enum BlogError: Swift.Error { | ||
case baseInitializerError(error: Error) | ||
} | ||
|
||
init(with blog: Blog) { | ||
self.init(with: blog) { error in | ||
// We'll log the error, so we know it's there, but we won't halt execution. | ||
WordPressAppDelegate.crashLogging?.logError(error) | ||
} | ||
} | ||
|
||
init(with blog: Blog, failure: (BlogError) -> ()) { | ||
let isAtomic = blog.isAtomic() | ||
self.init(with: blog, isAtomic: isAtomic, failure: failure) | ||
} | ||
|
||
init(with blog: Blog, isAtomic: Bool, failure: (BlogError) -> ()) { | ||
self.init( | ||
isAccessibleThroughWPCom: blog.isAccessibleThroughWPCom(), | ||
isPrivate: blog.isPrivate(), | ||
isAtomic: isAtomic, | ||
siteID: blog.dotComID?.intValue, | ||
username: blog.usernameForSite, | ||
authToken: blog.authToken, | ||
failure: { error in | ||
// We just associate a blog with the underlying error for simpler debugging. | ||
failure(BlogError.baseInitializerError(error: error)) | ||
} | ||
) | ||
} | ||
} | ||
|
||
/// Extends `MediaRequestAuthenticator.MediaHost` so that we can easily | ||
/// initialize it from a given `Blog`. | ||
/// | ||
extension MediaHost { | ||
init(_ post: ReaderPost) { | ||
let isAccessibleThroughWPCom = post.isWPCom || post.isJetpack | ||
|
||
// This is the only way in which we can obtain the username and authToken here. | ||
// It'd be nice if all data was associated with an account instead, for transparency | ||
// and cleanliness of the code - but this'll have to do for now. | ||
|
||
// We allow a nil account in case the user connected only self-hosted sites. | ||
let account = try? WPAccount.lookupDefaultWordPressComAccount(in: ContextManager.shared.mainContext) | ||
let username = account?.username | ||
let authToken = account?.authToken | ||
|
||
self.init( | ||
isAccessibleThroughWPCom: isAccessibleThroughWPCom, | ||
isPrivate: post.isBlogPrivate, | ||
isAtomic: post.isBlogAtomic, | ||
siteID: post.siteID?.intValue, | ||
username: username, | ||
authToken: authToken, | ||
failure: { error in | ||
WordPressAppDelegate.crashLogging?.logError(error) | ||
} | ||
) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
WordPress/Classes/ViewRelated/Cells/PostFeaturedImageCell.h
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was needed to make it work in
WPRichTextImage
(UIControl
, needed to pass gestures to the superview)