Merge branch 'develop' into dla/feature/custom_room_notification_settings_list
This commit is contained in:
commit
e2adecbcf4
30 changed files with 306 additions and 39 deletions
|
|
@ -16,9 +16,8 @@
|
|||
|
||||
package io.element.android.libraries.matrix.impl
|
||||
|
||||
import android.content.Context
|
||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
import io.element.android.libraries.di.CacheDirectory
|
||||
import io.element.android.libraries.network.useragent.UserAgentProvider
|
||||
import io.element.android.libraries.sessionstorage.api.SessionData
|
||||
import io.element.android.libraries.sessionstorage.api.SessionStore
|
||||
|
|
@ -32,8 +31,8 @@ import java.io.File
|
|||
import javax.inject.Inject
|
||||
|
||||
class RustMatrixClientFactory @Inject constructor(
|
||||
@ApplicationContext private val context: Context,
|
||||
private val baseDirectory: File,
|
||||
@CacheDirectory private val cacheDirectory: File,
|
||||
private val appCoroutineScope: CoroutineScope,
|
||||
private val coroutineDispatchers: CoroutineDispatchers,
|
||||
private val sessionStore: SessionStore,
|
||||
|
|
@ -63,7 +62,7 @@ class RustMatrixClientFactory @Inject constructor(
|
|||
appCoroutineScope = appCoroutineScope,
|
||||
dispatchers = coroutineDispatchers,
|
||||
baseDirectory = baseDirectory,
|
||||
baseCacheDirectory = context.cacheDir,
|
||||
baseCacheDirectory = cacheDirectory,
|
||||
clock = clock,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2023 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.matrix.impl.media
|
||||
|
||||
import io.element.android.libraries.matrix.api.media.AudioDetails
|
||||
import org.matrix.rustcomponents.sdk.UnstableAudioDetailsContent as RustAudioDetails
|
||||
|
||||
fun RustAudioDetails.map(): AudioDetails = AudioDetails(
|
||||
duration = duration,
|
||||
waveform = waveform.map { it.toInt() },
|
||||
)
|
||||
|
||||
fun AudioDetails.map(): RustAudioDetails = RustAudioDetails(
|
||||
duration = duration,
|
||||
waveform = waveform.map { it.toUShort() }
|
||||
)
|
||||
|
|
@ -75,7 +75,13 @@ class EventMessageMapper {
|
|||
|
||||
fun mapMessageType(type: RustMessageType?) = when (type) {
|
||||
is RustMessageType.Audio -> {
|
||||
AudioMessageType(type.content.body, type.content.source.map(), type.content.info?.map())
|
||||
AudioMessageType(
|
||||
body = type.content.body,
|
||||
source = type.content.source.map(),
|
||||
info = type.content.info?.map(),
|
||||
details = type.content.audio?.map(),
|
||||
isVoiceMessage = type.content.voice != null,
|
||||
)
|
||||
}
|
||||
is RustMessageType.File -> {
|
||||
FileMessageType(type.content.body, type.content.source.map(), type.content.info?.map())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue