mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-22 13:05:31 +03:00
fix file name of voice recording
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
f44885bd78
commit
ce8c4b2b84
1 changed files with 8 additions and 3 deletions
|
@ -140,14 +140,19 @@ class MediaRecorderManager : LifecycleAwareManager {
|
||||||
private fun setVoiceRecordFileName(context: Context, currentConversation: ConversationModel) {
|
private fun setVoiceRecordFileName(context: Context, currentConversation: ConversationModel) {
|
||||||
val simpleDateFormat = SimpleDateFormat(FILE_DATE_PATTERN)
|
val simpleDateFormat = SimpleDateFormat(FILE_DATE_PATTERN)
|
||||||
val date: String = simpleDateFormat.format(Date())
|
val date: String = simpleDateFormat.format(Date())
|
||||||
|
val regex = "[/\\\\:%]".toRegex()
|
||||||
|
val displayName = currentConversation.displayName.replace(regex, " ")
|
||||||
|
val validDisplayName = displayName.replace("\\s+".toRegex(), " ")
|
||||||
|
|
||||||
val fileNameWithoutSuffix = String.format(
|
var fileNameWithoutSuffix = String.format(
|
||||||
context.resources.getString(R.string.nc_voice_message_filename),
|
context.resources.getString(R.string.nc_voice_message_filename),
|
||||||
date,
|
date,
|
||||||
currentConversation.displayName
|
validDisplayName
|
||||||
)
|
)
|
||||||
|
if (fileNameWithoutSuffix.length > 146) {
|
||||||
|
fileNameWithoutSuffix = fileNameWithoutSuffix.substring(0, 146)
|
||||||
|
}
|
||||||
val fileName = fileNameWithoutSuffix + VOICE_MESSAGE_FILE_SUFFIX
|
val fileName = fileNameWithoutSuffix + VOICE_MESSAGE_FILE_SUFFIX
|
||||||
|
|
||||||
currentVoiceRecordFile = "${context.cacheDir.absolutePath}/$fileName"
|
currentVoiceRecordFile = "${context.cacheDir.absolutePath}/$fileName"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue