Feature/4382 performance send message

This commit is contained in:
Frank Rotermund
2023-03-31 10:31:06 +00:00
parent ef25b94e59
commit 54e8305e5c
14 changed files with 119 additions and 52 deletions
+20 -4
View File
@@ -1393,6 +1393,10 @@ static CGSize kThreadListBarButtonItemImageSize;
MXStrongifyAndReturnIfNil(self);
if (readyToSend)
{
// bwi: evaluate send message performance
PerformanceProfile *sendTextMessageProfile = [[PerformanceProfile alloc] initWithThreshold:BWIBuildSettings.shared.sendMessageThreshold];
[sendTextMessageProfile startMeasurement];
// The event modified is always fetch from the actual data source
MXEvent *eventModified = [self.roomDataSource eventWithEventId:self.customizedRoomDataSource.selectedEventId];
@@ -1401,25 +1405,36 @@ static CGSize kThreadListBarButtonItemImageSize;
[self setupRoomDataSourceToResolveEvent:^(MXKRoomDataSource *roomDataSource) {
if (self.inputToolBarSendMode == RoomInputToolbarViewSendModeReply && eventModified)
{
[roomDataSource sendReplyToEvent:eventModified withTextMessage:msgTxt success:nil failure:^(NSError *error) {
[roomDataSource sendReplyToEvent:eventModified withTextMessage:msgTxt success:^(NSString *string)
{
[self finishTextMessageProfil:sendTextMessageProfile];
} failure:^(NSError *error) {
// Just log the error. The message will be displayed in red in the room history
MXLogDebug(@"[MXKRoomViewController] sendTextMessage failed.");
[sendTextMessageProfile abortMeasurement];
}];
}
else if (self.inputToolBarSendMode == RoomInputToolbarViewSendModeEdit && eventModified)
{
[roomDataSource replaceTextMessageForEvent:eventModified withTextMessage:msgTxt success:nil failure:^(NSError *error) {
// Just log the error. The message will be displayed in red
[roomDataSource replaceTextMessageForEvent:eventModified withTextMessage:msgTxt success:^(NSString *string)
{
[self finishTextMessageProfil:sendTextMessageProfile];
} failure:^(NSError *error) {
// Just log the error. The message will be displayed in red in the room history
MXLogDebug(@"[MXKRoomViewController] sendTextMessage failed.");
[sendTextMessageProfile abortMeasurement];
}];
}
else
{
// Let the datasource send it and manage the local echo
[roomDataSource sendTextMessage:msgTxt success:nil failure:^(NSError *error)
[roomDataSource sendTextMessage:msgTxt success:^(NSString *string)
{
[self finishTextMessageProfil:sendTextMessageProfile];
} failure:^(NSError *error) {
// Just log the error. The message will be displayed in red in the room history
MXLogDebug(@"[MXKRoomViewController] sendTextMessage failed.");
[sendTextMessageProfile abortMeasurement];
}];
}
@@ -8125,6 +8140,7 @@ static CGSize kThreadListBarButtonItemImageSize;
}];
}
[BWIAnalytics.sharedTracker trackEvent:@"Session" action:@"No DIMENSION"];
}
#pragma mark - BWI Emoji History