Rename userAvatarURLString to userAvatarUrl

This commit is contained in:
Benoit Marty
2024-01-19 15:59:50 +01:00
parent 603b10264b
commit 0e57fbf352
6 changed files with 9 additions and 9 deletions

View File

@@ -122,7 +122,7 @@ class RoomListPresenterTests {
fun `present - should start with no user and then load user with error`() = runTest {
val matrixClient = FakeMatrixClient(
userDisplayName = Result.failure(AN_EXCEPTION),
userAvatarURLString = Result.failure(AN_EXCEPTION),
userAvatarUrl = Result.failure(AN_EXCEPTION),
)
val scope = CoroutineScope(coroutineContext + SupervisorJob())
val presenter = createRoomListPresenter(client = matrixClient, coroutineScope = scope)

View File

@@ -72,7 +72,7 @@ interface MatrixClient : Closeable {
*/
suspend fun logout(ignoreSdkError: Boolean): String?
suspend fun loadUserDisplayName(): Result<String>
suspend fun loadUserAvatarURLString(): Result<String?>
suspend fun loadUserAvatarUrl(): Result<String?>
suspend fun getAccountManagementUrl(action: AccountManagementAction?): Result<String?>
suspend fun uploadMedia(mimeType: String, data: ByteArray, progressCallback: ProgressCallback?): Result<String>
fun roomMembershipObserver(): RoomMembershipObserver

View File

@@ -19,11 +19,11 @@ package io.element.android.libraries.matrix.api.user
import io.element.android.libraries.matrix.api.MatrixClient
/**
* Get the current user, as [MatrixUser], using [MatrixClient.loadUserAvatarURLString]
* Get the current user, as [MatrixUser], using [MatrixClient.loadUserAvatarUrl]
* and [MatrixClient.loadUserDisplayName].
*/
suspend fun MatrixClient.getCurrentUser(): MatrixUser {
val userAvatarUrl = loadUserAvatarURLString().getOrNull()
val userAvatarUrl = loadUserAvatarUrl().getOrNull()
val userDisplayName = loadUserDisplayName().getOrNull()
return MatrixUser(
userId = sessionId,

View File

@@ -426,7 +426,7 @@ class RustMatrixClient(
}
}
override suspend fun loadUserAvatarURLString(): Result<String?> = withContext(sessionDispatcher) {
override suspend fun loadUserAvatarUrl(): Result<String?> = withContext(sessionDispatcher) {
runCatching {
client.avatarUrl()
}

View File

@@ -48,7 +48,7 @@ import kotlinx.coroutines.delay
class FakeMatrixClient(
override val sessionId: SessionId = A_SESSION_ID,
private val userDisplayName: Result<String> = Result.success(A_USER_NAME),
private val userAvatarURLString: Result<String> = Result.success(AN_AVATAR_URL),
private val userAvatarUrl: Result<String> = Result.success(AN_AVATAR_URL),
override val roomListService: RoomListService = FakeRoomListService(),
override val mediaLoader: MatrixMediaLoader = FakeMediaLoader(),
private val sessionVerificationService: FakeSessionVerificationService = FakeSessionVerificationService(),
@@ -135,8 +135,8 @@ class FakeMatrixClient(
return userDisplayName
}
override suspend fun loadUserAvatarURLString(): Result<String?> {
return userAvatarURLString
override suspend fun loadUserAvatarUrl(): Result<String?> {
return userAvatarUrl
}
override suspend fun getAccountManagementUrl(action: AccountManagementAction?): Result<String?> {

View File

@@ -297,7 +297,7 @@ class DefaultNotificationDrawerManager @Inject constructor(
operation = {
// myUserDisplayName cannot be empty else NotificationCompat.MessagingStyle() will crash
val myUserDisplayName = client.loadUserDisplayName().getOrNull() ?: sessionId.value
val userAvatarUrl = client.loadUserAvatarURLString().getOrNull()
val userAvatarUrl = client.loadUserAvatarUrl().getOrNull()
MatrixUser(
userId = sessionId,
displayName = myUserDisplayName,