mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-29 14:38:45 +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 queryUri: Uri,
|
||||||
val mimeType: String?,
|
val mimeType: String?,
|
||||||
val type: Type,
|
val type: Type,
|
||||||
val waveform: List<Int?>? = null
|
val waveform: List<Int>? = null
|
||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
|
|
||||||
@JsonClass(generateAdapter = false)
|
@JsonClass(generateAdapter = false)
|
||||||
|
|
|
@ -185,7 +185,7 @@ internal class DefaultSendService @AssistedInject constructor(
|
||||||
name = messageContent.body,
|
name = messageContent.body,
|
||||||
queryUri = Uri.parse(messageContent.url),
|
queryUri = Uri.parse(messageContent.url),
|
||||||
type = ContentAttachmentData.Type.AUDIO,
|
type = ContentAttachmentData.Type.AUDIO,
|
||||||
waveform = messageContent.audioWaveformInfo?.waveform
|
waveform = messageContent.audioWaveformInfo?.waveform?.filterNotNull()
|
||||||
)
|
)
|
||||||
localEchoRepository.updateSendState(localEcho.eventId, roomId, SendState.UNSENT)
|
localEchoRepository.updateSendState(localEcho.eventId, roomId, SendState.UNSENT)
|
||||||
internalSendMedia(listOf(localEcho.root), attachmentData, true)
|
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.
|
* The array should have no less than 30 elements and no more than 120.
|
||||||
* List of integers between zero and 1024, inclusive.
|
* 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()) {
|
if (waveForm.isNullOrEmpty()) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ internal class WaveFormSanitizer @Inject constructor() {
|
||||||
val repeatTimes = ceil(MIN_NUMBER_OF_VALUES / waveForm.size.toDouble()).toInt()
|
val repeatTimes = ceil(MIN_NUMBER_OF_VALUES / waveForm.size.toDouble()).toInt()
|
||||||
waveForm.map { value ->
|
waveForm.map { value ->
|
||||||
repeat(repeatTimes) {
|
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()
|
val keepOneOf = ceil(waveForm.size.toDouble() / MAX_NUMBER_OF_VALUES).toInt()
|
||||||
waveForm.mapIndexed { idx, value ->
|
waveForm.mapIndexed { idx, value ->
|
||||||
if (idx % keepOneOf == 0) {
|
if (idx % keepOneOf == 0) {
|
||||||
sizeInRangeList.add(value ?: 0)
|
sizeInRangeList.add(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
sizeInRangeList.addAll(waveForm.filterNotNull())
|
sizeInRangeList.addAll(waveForm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue