vector-im/element-ios/issues/4090 - Add custom reply text to voice messages, add duration and samples to sendVoiceMessage.
MODIFY
MatrixKit/Assets/MatrixKitAssets.bundle/en.lproj/MatrixKit.strings
MatrixKit/Assets/MatrixKitAssets.bundle/en.lproj/MatrixKit.strings
"message_reply_to_sender_sent_an_image" = "sent an image.";
"message_reply_to_sender_sent_a_video" = "sent a video.";
"message_reply_to_sender_sent_an_audio_file" = "sent an audio file.";
+"message_reply_to_sender_sent_a_voice_message" = "sent a voice message.";
"message_reply_to_sender_sent_a_file" = "sent a file.";
"message_reply_to_message_to_reply_to_prefix" = "In reply to";

MODIFY
MatrixKit/Models/Room/MXKAttachment.m
MatrixKit/Models/Room/MXKAttachment.m
@@ -95,15 +95,13 @@ NSString *const kMXKAttachmentErrorDomain = @"kMXKAttachmentErrorDomain";
{
_type = MXKAttachmentTypeImage;
}
- else if ([msgtype isEqualToString:kMXMessageTypeAudio])
+ else if (event.isVoiceMessage)
{
- if (eventContent[kMXMessageTypeVoiceMessage] ||
- eventContent[kMXMessageTypeVoiceMessageMSC2516] ||
- eventContent[kMXMessageTypeVoiceMessageMSC3245]) {
_type = MXKAttachmentTypeVoiceMessage;
- } else {
- _type = MXKAttachmentTypeAudio;
}
+ else if ([msgtype isEqualToString:kMXMessageTypeAudio])
+ {
+ _type = MXKAttachmentTypeAudio;
}
else if ([msgtype isEqualToString:kMXMessageTypeVideo])
{

MODIFY
MatrixKit/Models/Room/MXKRoomDataSource.h
MatrixKit/Models/Room/MXKRoomDataSource.h
@@ -546,12 +546,16 @@ extern NSString *const kMXKRoomDataSourceTimelineErrorErrorKey;
@param audioFileLocalURL the local filesystem path of the audio file to send.
@param mimeType (optional) the mime type of the file. Defaults to `audio/ogg`
+ @param duration the length of the voice message in milliseconds
+ @param samples an array of floating point values normalized to [0, 1], boxed within NSNumbers
@param success A block object called when the operation succeeds. It returns
the event id of the event generated on the homeserver
@param failure A block object called when the operation fails.
*/
- (void)sendVoiceMessage:(NSURL *)audioFileLocalURL
mimeType:mimeType
+ duration:(NSTimeInterval)duration
+ samples:(NSArray<NSNumber *> *)samples
success:(void (^)(NSString *))success
failure:(void (^)(NSError *))failure;

MODIFY
MatrixKit/Models/Room/MXKRoomDataSource.m
MatrixKit/Models/Room/MXKRoomDataSource.m
@@ -1885,11 +1885,16 @@ NSString *const kMXKRoomDataSourceTimelineErrorErrorKey = @"kMXKRoomDataSourceTi
}
}
-- (void)sendVoiceMessage:(NSURL *)audioFileLocalURL mimeType:mimeType success:(void (^)(NSString *))success failure:(void (^)(NSError *))failure
+- (void)sendVoiceMessage:(NSURL *)audioFileLocalURL
+ mimeType:mimeType
+ duration:(NSTimeInterval)duration
+ samples:(NSArray<NSNumber *> *)samples
+ success:(void (^)(NSString *))success
+ failure:(void (^)(NSError *))failure
{
__block MXEvent *localEchoEvent = nil;
- [_room sendVoiceMessage:audioFileLocalURL mimeType:mimeType localEcho:&localEchoEvent success:success failure:failure keepActualFilename:YES];
+ [_room sendVoiceMessage:audioFileLocalURL mimeType:mimeType duration:duration samples:samples localEcho:&localEchoEvent success:success failure:failure keepActualFilename:YES];
if (localEchoEvent)
{

MODIFY
MatrixKit/Models/Room/MXKSendReplyEventStringLocalizations.h
MatrixKit/Models/Room/MXKSendReplyEventStringLocalizations.h
@property (copy, readonly, nonnull) NSString *senderSentAnImage;
@property (copy, readonly, nonnull) NSString *senderSentAVideo;
@property (copy, readonly, nonnull) NSString *senderSentAnAudioFile;
+@property (copy, readonly, nonnull) NSString *senderSentAVoiceMessage;
@property (copy, readonly, nonnull) NSString *senderSentAFile;
@property (copy, readonly, nonnull) NSString *messageToReplyToPrefix;

MODIFY
MatrixKit/Models/Room/MXKSendReplyEventStringLocalizations.m
MatrixKit/Models/Room/MXKSendReplyEventStringLocalizations.m
_senderSentAnImage = [NSBundle mxk_localizedStringForKey:@"message_reply_to_sender_sent_an_image"];
_senderSentAVideo = [NSBundle mxk_localizedStringForKey:@"message_reply_to_sender_sent_a_video"];
_senderSentAnAudioFile = [NSBundle mxk_localizedStringForKey:@"message_reply_to_sender_sent_an_audio_file"];
+ _senderSentAVoiceMessage = [NSBundle mxk_localizedStringForKey:@"message_reply_to_sender_sent_a_voice_message"];
_senderSentAFile = [NSBundle mxk_localizedStringForKey:@"message_reply_to_sender_sent_a_file"];
_messageToReplyToPrefix = [NSBundle mxk_localizedStringForKey:@"message_reply_to_message_to_reply_to_prefix"];
}

vector-im/element-ios/issues/4090 - Add custom reply text to voice messages, add duration and samples to sendVoiceMessage.