Display unsupported/unexpected messages in room details with red color

This commit is contained in:
giomfo 2014-10-28 18:22:16 +01:00
parent 3932b6241b
commit 9d671ddc18
3 changed files with 16 additions and 2 deletions

View file

@ -16,6 +16,8 @@
#import <MatrixSDK/MatrixSDK.h>
extern NSString *const kMatrixHandlerUnsupportedMessagePrefix;
@interface MatrixHandler : NSObject
@property (strong, nonatomic) MXHomeServer *mxHomeServer;

View file

@ -17,6 +17,8 @@
#import "MatrixHandler.h"
#import "AppDelegate.h"
NSString *const kMatrixHandlerUnsupportedMessagePrefix = @"UNSUPPORTED MSG: ";
static MatrixHandler *sharedHandler = nil;
@interface MatrixHandler () {
@ -325,7 +327,11 @@ static MatrixHandler *sharedHandler = nil;
if (displayText == nil) {
NSLog(@"ERROR: Unsupported message %@)", message.description);
displayText = @"";
if (isSubtitle) {
displayText = @"";
} else {
displayText = [NSString stringWithFormat:@"%@%@", kMatrixHandlerUnsupportedMessagePrefix, message.description];
}
}
return displayText;

View file

@ -576,7 +576,13 @@ NSString *const kFailedEventId = @"failedEventId";
}
}
cell.messageTextView.text = [mxHandler displayTextFor:mxEvent inSubtitleMode:NO];
NSString *displayText = [mxHandler displayTextFor:mxEvent inSubtitleMode:NO];
if ([displayText hasPrefix:kMatrixHandlerUnsupportedMessagePrefix]) {
cell.messageTextView.textColor = [UIColor redColor];
} else {
cell.messageTextView.textColor = [UIColor blackColor];
}
cell.messageTextView.text = displayText;
return cell;
}