Report Matrix SDK api changes (urlOfContentThumbnail)

This commit is contained in:
giomfo 2015-04-09 17:43:26 +02:00
parent 1d625ae5dc
commit 30812cb955
6 changed files with 5 additions and 26 deletions

View file

@ -106,8 +106,4 @@ typedef enum : NSUInteger {
// return YES if the text contains a bing word
- (BOOL)containsBingWord:(NSString*)text;
// Return the suitable url to display the content thumbnail into the provided view size
// Note: the provided view size is supposed in points, this method will convert this size in pixels by considering screen scale
- (NSString*)thumbnailURLForContent:(NSString*)contentURI inViewSize:(CGSize)viewSize withMethod:(MXThumbnailingMethod)thumbnailingMethod;
@end

View file

@ -1285,21 +1285,4 @@ static MatrixSDKHandler *sharedHandler = nil;
return NO;
}
#pragma mark - Thumbnail
// Return the suitable url to display the content thumbnail into the provided view size
// Note: the provided view size is supposed in points, this method will convert this size in pixels by considering screen scale
- (NSString*)thumbnailURLForContent:(NSString*)contentURI inViewSize:(CGSize)viewSize withMethod:(MXThumbnailingMethod)thumbnailingMethod {
// Suppose this url is a matrix content uri, we use SDK to get the well adapted thumbnail from server
// Convert first the provided size in pixels
CGFloat scale = [[UIScreen mainScreen] scale];
CGSize sizeInPixels = CGSizeMake(viewSize.width * scale, viewSize.height * scale);
NSString *thumbnailURL = [self.mxRestClient urlOfContentThumbnail:contentURI withSize:sizeInPixels andMethod:thumbnailingMethod];
if (nil == thumbnailURL) {
// Manage backward compatibility. The content URL used to be an absolute HTTP URL
thumbnailURL = contentURI;
}
return thumbnailURL;
}
@end

View file

@ -91,7 +91,7 @@
MXUser* user = [mxHandler.mxSession userWithUserId:_matrixID];
if (user) {
avatarURL = [mxHandler thumbnailURLForContent:user.avatarUrl inViewSize:avatarSize withMethod:MXThumbnailingMethodCrop];
avatarURL = [mxHandler.mxSession.matrixRestClient urlOfContentThumbnail:user.avatarUrl toFitViewSize:avatarSize withMethod:MXThumbnailingMethodCrop];
[self downloadAvatarImage];
} else {
@ -99,7 +99,7 @@
if (mxHandler.mxRestClient) {
[mxHandler.mxRestClient avatarUrlForUser:_matrixID
success:^(NSString *avatarUrl) {
avatarURL = [mxHandler thumbnailURLForContent:avatarUrl inViewSize:avatarSize withMethod:MXThumbnailingMethodCrop];
avatarURL = [mxHandler.mxSession.matrixRestClient urlOfContentThumbnail:avatarUrl toFitViewSize:avatarSize withMethod:MXThumbnailingMethodCrop];
[self downloadAvatarImage];
}
failure:^(NSError *error) {

View file

@ -115,7 +115,7 @@
if (roomMember.avatarUrl) {
// Suppose this url is a matrix content uri, we use SDK to get the well adapted thumbnail from server
MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler];
thumbnailURL = [mxHandler thumbnailURLForContent:roomMember.avatarUrl inViewSize:self.pictureView.frame.size withMethod:MXThumbnailingMethodCrop];
thumbnailURL = [mxHandler.mxSession.matrixRestClient urlOfContentThumbnail:roomMember.avatarUrl toFitViewSize:self.pictureView.frame.size withMethod:MXThumbnailingMethodCrop];
}
self.pictureView.mediaFolder = kMXKMediaManagerAvatarThumbnailFolder;
[self.pictureView setImageURL:thumbnailURL withImageOrientation:UIImageOrientationUp andPreviewImage:[UIImage imageNamed:@"default-profile"]];

View file

@ -166,7 +166,7 @@
if (_mxRoomMember.avatarUrl) {
// Suppose this url is a matrix content uri, we use SDK to get the well adapted thumbnail from server
MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler];
thumbnailURL = [mxHandler thumbnailURLForContent:_mxRoomMember.avatarUrl inViewSize:self.memberThumbnailButton.frame.size withMethod:MXThumbnailingMethodCrop];
thumbnailURL = [mxHandler.mxSession.matrixRestClient urlOfContentThumbnail:_mxRoomMember.avatarUrl toFitViewSize:self.memberThumbnailButton.frame.size withMethod:MXThumbnailingMethodCrop];
NSString *cacheFilePath = [MXKMediaManager cachePathForMediaWithURL:thumbnailURL inFolder:kMXKMediaManagerAvatarThumbnailFolder];
// Check whether the image download is in progress

View file

@ -509,7 +509,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl
if (currentPictureURL) {
// Suppose this url is a matrix content uri, we use SDK to get the well adapted thumbnail from server
MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler];
currentPictureThumbURL = [mxHandler thumbnailURLForContent:currentPictureURL inViewSize:self.userPictureButton.frame.size withMethod:MXThumbnailingMethodCrop];
currentPictureThumbURL = [mxHandler.mxSession.matrixRestClient urlOfContentThumbnail:currentPictureURL toFitViewSize:self.userPictureButton.frame.size withMethod:MXThumbnailingMethodCrop];
NSString *cacheFilePath = [MXKMediaManager cachePathForMediaWithURL:currentPictureThumbURL inFolder:kMXKMediaManagerAvatarThumbnailFolder];
// Check whether the image download is in progress