mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
Display unsupported/unexpected messages in room details with red color
This commit is contained in:
parent
3932b6241b
commit
9d671ddc18
3 changed files with 16 additions and 2 deletions
|
@ -16,6 +16,8 @@
|
|||
|
||||
#import <MatrixSDK/MatrixSDK.h>
|
||||
|
||||
extern NSString *const kMatrixHandlerUnsupportedMessagePrefix;
|
||||
|
||||
@interface MatrixHandler : NSObject
|
||||
|
||||
@property (strong, nonatomic) MXHomeServer *mxHomeServer;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue