Skip to content

Commit

Permalink
Add support for media on private sites.
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioEstevao committed Nov 20, 2019
1 parent a59eda2 commit 8419330
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,8 @@ extension GutenbergViewController: GutenbergBridgeDelegate {
}

func gutenbergDidRequestFullscreenImage(with mediaUrl: URL) {
let controller = WPImageViewController(url: mediaUrl)
let controller = WPImageViewController(externalMediaURL: mediaUrl)
controller.post = self.post
controller.modalTransitionStyle = .crossDissolve
controller.modalPresentationStyle = .fullScreen
self.present(controller, animated: true)
Expand Down
2 changes: 2 additions & 0 deletions WordPress/Classes/ViewRelated/Reader/WPImageViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
@import WPMediaPicker;

@class Media;
@class AbstractPost;

NS_ASSUME_NONNULL_BEGIN
@interface WPImageViewController : UIViewController

@property (nonatomic, readonly, nullable) id<WPMediaAsset> mediaAsset;
@property (nonatomic, assign) BOOL shouldDismissWithGestures;
@property (nonatomic, weak) AbstractPost* post;

- (instancetype)initWithImage:(UIImage *)image;
- (instancetype)initWithURL:(NSURL *)url;
Expand Down
5 changes: 4 additions & 1 deletion WordPress/Classes/ViewRelated/Reader/WPImageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,11 @@ - (void)loadImageFromExternalURL
{
self.isLoadingImage = YES;

__weak __typeof__(self) weakSelf = self;
__weak __typeof__(self) weakSelf = self;
[self.imageLoader loadImageWithURL:self.url
fromPost:self.post
preferredSize:CGSizeZero
placeholder:nil
success:^{
weakSelf.isLoadingImage = NO;
weakSelf.image = weakSelf.imageView.image;
Expand Down

0 comments on commit 8419330

Please sign in to comment.