mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 15:09:31 +02:00
Display unsupported/unexpected messages in room details with red color
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user