Skip to content

Commit 3788424

Browse files
Merge pull request #1700 from Infomaniak/ignore-default-avatars
Ignore defaults avatars coming from the API for the User profile
2 parents 1e4792a + 5e3533c commit 3788424

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

app/src/main/java/com/infomaniak/mail/ui/login/LoginActivity.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Infomaniak Mail - Android
3-
* Copyright (C) 2022-2023 Infomaniak Network SA
3+
* Copyright (C) 2022-2024 Infomaniak Network SA
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -88,7 +88,10 @@ class LoginActivity : AppCompatActivity() {
8888
if (AccountUtils.getUserById(apiToken.userId) != null) return getErrorResponse(RCore.string.errorUserAlreadyPresent)
8989

9090
InfomaniakCore.bearerToken = apiToken.accessToken
91-
val userProfileResponse = ApiRepository.getUserProfile(HttpClient.okHttpClientNoTokenInterceptor)
91+
val userProfileResponse = ApiRepository.getUserProfile(
92+
HttpClient.okHttpClientNoTokenInterceptor,
93+
ignoreDefaultAvatar = true,
94+
)
9295

9396
if (userProfileResponse.result == ApiResponseStatus.ERROR) return userProfileResponse
9497
if (userProfileResponse.data == null) return getErrorResponse(RCore.string.anErrorHasOccurred)

app/src/main/java/com/infomaniak/mail/utils/AccountUtils.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Infomaniak Mail - Android
3-
* Copyright (C) 2022-2023 Infomaniak Network SA
3+
* Copyright (C) 2022-2024 Infomaniak Network SA
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -117,7 +117,7 @@ object AccountUtils : CredentialManager() {
117117
}
118118

119119
suspend fun updateCurrentUser(okHttpClient: OkHttpClient = HttpClient.okHttpClient) {
120-
with(ApiRepository.getUserProfile(okHttpClient)) {
120+
with(ApiRepository.getUserProfile(okHttpClient, ignoreDefaultAvatar = true)) {
121121
if (result != ApiResponseStatus.ERROR) requestUser(remoteUser = data ?: return)
122122
}
123123
}

0 commit comments

Comments
 (0)