mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Rename userAvatarURLString to userAvatarUrl
This commit is contained in:
+1
-1
@@ -122,7 +122,7 @@ class RoomListPresenterTests {
|
|||||||
fun `present - should start with no user and then load user with error`() = runTest {
|
fun `present - should start with no user and then load user with error`() = runTest {
|
||||||
val matrixClient = FakeMatrixClient(
|
val matrixClient = FakeMatrixClient(
|
||||||
userDisplayName = Result.failure(AN_EXCEPTION),
|
userDisplayName = Result.failure(AN_EXCEPTION),
|
||||||
userAvatarURLString = Result.failure(AN_EXCEPTION),
|
userAvatarUrl = Result.failure(AN_EXCEPTION),
|
||||||
)
|
)
|
||||||
val scope = CoroutineScope(coroutineContext + SupervisorJob())
|
val scope = CoroutineScope(coroutineContext + SupervisorJob())
|
||||||
val presenter = createRoomListPresenter(client = matrixClient, coroutineScope = scope)
|
val presenter = createRoomListPresenter(client = matrixClient, coroutineScope = scope)
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ interface MatrixClient : Closeable {
|
|||||||
*/
|
*/
|
||||||
suspend fun logout(ignoreSdkError: Boolean): String?
|
suspend fun logout(ignoreSdkError: Boolean): String?
|
||||||
suspend fun loadUserDisplayName(): Result<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 getAccountManagementUrl(action: AccountManagementAction?): Result<String?>
|
||||||
suspend fun uploadMedia(mimeType: String, data: ByteArray, progressCallback: ProgressCallback?): Result<String>
|
suspend fun uploadMedia(mimeType: String, data: ByteArray, progressCallback: ProgressCallback?): Result<String>
|
||||||
fun roomMembershipObserver(): RoomMembershipObserver
|
fun roomMembershipObserver(): RoomMembershipObserver
|
||||||
|
|||||||
+2
-2
@@ -19,11 +19,11 @@ package io.element.android.libraries.matrix.api.user
|
|||||||
import io.element.android.libraries.matrix.api.MatrixClient
|
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].
|
* and [MatrixClient.loadUserDisplayName].
|
||||||
*/
|
*/
|
||||||
suspend fun MatrixClient.getCurrentUser(): MatrixUser {
|
suspend fun MatrixClient.getCurrentUser(): MatrixUser {
|
||||||
val userAvatarUrl = loadUserAvatarURLString().getOrNull()
|
val userAvatarUrl = loadUserAvatarUrl().getOrNull()
|
||||||
val userDisplayName = loadUserDisplayName().getOrNull()
|
val userDisplayName = loadUserDisplayName().getOrNull()
|
||||||
return MatrixUser(
|
return MatrixUser(
|
||||||
userId = sessionId,
|
userId = sessionId,
|
||||||
|
|||||||
+1
-1
@@ -426,7 +426,7 @@ class RustMatrixClient(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun loadUserAvatarURLString(): Result<String?> = withContext(sessionDispatcher) {
|
override suspend fun loadUserAvatarUrl(): Result<String?> = withContext(sessionDispatcher) {
|
||||||
runCatching {
|
runCatching {
|
||||||
client.avatarUrl()
|
client.avatarUrl()
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -48,7 +48,7 @@ import kotlinx.coroutines.delay
|
|||||||
class FakeMatrixClient(
|
class FakeMatrixClient(
|
||||||
override val sessionId: SessionId = A_SESSION_ID,
|
override val sessionId: SessionId = A_SESSION_ID,
|
||||||
private val userDisplayName: Result<String> = Result.success(A_USER_NAME),
|
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 roomListService: RoomListService = FakeRoomListService(),
|
||||||
override val mediaLoader: MatrixMediaLoader = FakeMediaLoader(),
|
override val mediaLoader: MatrixMediaLoader = FakeMediaLoader(),
|
||||||
private val sessionVerificationService: FakeSessionVerificationService = FakeSessionVerificationService(),
|
private val sessionVerificationService: FakeSessionVerificationService = FakeSessionVerificationService(),
|
||||||
@@ -135,8 +135,8 @@ class FakeMatrixClient(
|
|||||||
return userDisplayName
|
return userDisplayName
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun loadUserAvatarURLString(): Result<String?> {
|
override suspend fun loadUserAvatarUrl(): Result<String?> {
|
||||||
return userAvatarURLString
|
return userAvatarUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getAccountManagementUrl(action: AccountManagementAction?): Result<String?> {
|
override suspend fun getAccountManagementUrl(action: AccountManagementAction?): Result<String?> {
|
||||||
|
|||||||
+1
-1
@@ -297,7 +297,7 @@ class DefaultNotificationDrawerManager @Inject constructor(
|
|||||||
operation = {
|
operation = {
|
||||||
// myUserDisplayName cannot be empty else NotificationCompat.MessagingStyle() will crash
|
// myUserDisplayName cannot be empty else NotificationCompat.MessagingStyle() will crash
|
||||||
val myUserDisplayName = client.loadUserDisplayName().getOrNull() ?: sessionId.value
|
val myUserDisplayName = client.loadUserDisplayName().getOrNull() ?: sessionId.value
|
||||||
val userAvatarUrl = client.loadUserAvatarURLString().getOrNull()
|
val userAvatarUrl = client.loadUserAvatarUrl().getOrNull()
|
||||||
MatrixUser(
|
MatrixUser(
|
||||||
userId = sessionId,
|
userId = sessionId,
|
||||||
displayName = myUserDisplayName,
|
displayName = myUserDisplayName,
|
||||||
|
|||||||
Reference in New Issue
Block a user