mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
Code review fixes.
This commit is contained in:
parent
1df867f345
commit
3bd392a55d
3 changed files with 6 additions and 6 deletions
|
@ -36,7 +36,7 @@ data class ContentAttachmentData(
|
|||
val queryUri: Uri,
|
||||
val mimeType: String?,
|
||||
val type: Type,
|
||||
val waveform: List<Int?>? = null
|
||||
val waveform: List<Int>? = null
|
||||
) : Parcelable {
|
||||
|
||||
@JsonClass(generateAdapter = false)
|
||||
|
|
|
@ -185,7 +185,7 @@ internal class DefaultSendService @AssistedInject constructor(
|
|||
name = messageContent.body,
|
||||
queryUri = Uri.parse(messageContent.url),
|
||||
type = ContentAttachmentData.Type.AUDIO,
|
||||
waveform = messageContent.audioWaveformInfo?.waveform
|
||||
waveform = messageContent.audioWaveformInfo?.waveform?.filterNotNull()
|
||||
)
|
||||
localEchoRepository.updateSendState(localEcho.eventId, roomId, SendState.UNSENT)
|
||||
internalSendMedia(listOf(localEcho.root), attachmentData, true)
|
||||
|
|
|
@ -33,7 +33,7 @@ internal class WaveFormSanitizer @Inject constructor() {
|
|||
* The array should have no less than 30 elements and no more than 120.
|
||||
* List of integers between zero and 1024, inclusive.
|
||||
*/
|
||||
fun sanitize(waveForm: List<Int?>?): List<Int>? {
|
||||
fun sanitize(waveForm: List<Int>?): List<Int>? {
|
||||
if (waveForm.isNullOrEmpty()) {
|
||||
return null
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ internal class WaveFormSanitizer @Inject constructor() {
|
|||
val repeatTimes = ceil(MIN_NUMBER_OF_VALUES / waveForm.size.toDouble()).toInt()
|
||||
waveForm.map { value ->
|
||||
repeat(repeatTimes) {
|
||||
sizeInRangeList.add(value ?: 0)
|
||||
sizeInRangeList.add(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,12 +54,12 @@ internal class WaveFormSanitizer @Inject constructor() {
|
|||
val keepOneOf = ceil(waveForm.size.toDouble() / MAX_NUMBER_OF_VALUES).toInt()
|
||||
waveForm.mapIndexed { idx, value ->
|
||||
if (idx % keepOneOf == 0) {
|
||||
sizeInRangeList.add(value ?: 0)
|
||||
sizeInRangeList.add(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
sizeInRangeList.addAll(waveForm.filterNotNull())
|
||||
sizeInRangeList.addAll(waveForm)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue